Preparation for MIMO actuators: split actuator counts: nu (inputs), nactuator (objects), nout (outputs).
An actuator now owns a block of consecutive controls (actuator_ctrladr/ctrlnum, width defined by the actuator type) and a block of consecutive force outputs (actuator_outadr/outnum, width defined by the transmission type). Force outputs are the scalars of actuation space: one force, length, velocity and moment row each. nout = dim(actuator_force) is derived from transmission types; all current types have width 1, so all three counts coincide for every existing model and behavior is bit-exact. Array re-keying: ctrlrange/ctrllimited by nu; forcerange/forcelimited/gear/ acc0/length0/lengthrange and the moment row structure by nout; everything else per actuator. The mjModel actuator block is re-sorted by size key. Layout-breaking, not behavior-breaking: saved .mjb files are invalidated (size list changed) and recompilation is required. PiperOrigin-RevId: 948351772 Change-Id: Icbc196ffa083cb1eaa6f1a3710869c89d8f62540
This commit is contained in:
committed by
Copybara-Service
parent
06f12a9372
commit
d507e92198
@@ -1102,7 +1102,7 @@ mjtNum mj_actuatorDamping(const mjModel* m, mjtObj type, int id, mjtNum poly[mjN
|
||||
|
||||
// single actuator contributes damping
|
||||
if (actuatorid >= 0) {
|
||||
mjtNum gear2 = m->actuator_gear[6*actuatorid] * m->actuator_gear[6*actuatorid];
|
||||
mjtNum gear2 = m->actuator_gear[6*m->actuator_outadr[actuatorid]] * m->actuator_gear[6*m->actuator_outadr[actuatorid]];
|
||||
damping = m->actuator_damping[actuatorid] * gear2;
|
||||
for (int k = 0; k < mjNPOLY; k++) {
|
||||
poly[k] += m->actuator_dampingpoly[mjNPOLY*actuatorid+k] * gear2;
|
||||
@@ -1111,7 +1111,7 @@ mjtNum mj_actuatorDamping(const mjModel* m, mjtObj type, int id, mjtNum poly[mjN
|
||||
|
||||
// actuatorid < -1: scan all actuators for contributions
|
||||
else {
|
||||
for (int k = 0; k < m->nu; k++) {
|
||||
for (int k = 0; k < m->nactuator; k++) {
|
||||
// skip actuators that don't actuate the given joint/tendon
|
||||
if (m->actuator_trnid[2*k] != id) {
|
||||
continue;
|
||||
@@ -1126,7 +1126,7 @@ mjtNum mj_actuatorDamping(const mjModel* m, mjtObj type, int id, mjtNum poly[mjN
|
||||
}
|
||||
|
||||
// accumulate damping contribution
|
||||
mjtNum gear2 = m->actuator_gear[6*k] * m->actuator_gear[6*k];
|
||||
mjtNum gear2 = m->actuator_gear[6*m->actuator_outadr[k]] * m->actuator_gear[6*m->actuator_outadr[k]];
|
||||
damping += m->actuator_damping[k] * gear2;
|
||||
for (int j = 0; j < mjNPOLY; j++) {
|
||||
poly[j] += m->actuator_dampingpoly[mjNPOLY*k+j] * gear2;
|
||||
@@ -1157,13 +1157,13 @@ mjtNum mj_actuatorArmature(const mjModel* m, mjtObj type, int id) {
|
||||
|
||||
// single actuator contributes armature
|
||||
if (actuatorid >= 0) {
|
||||
mjtNum gear2 = m->actuator_gear[6*actuatorid] * m->actuator_gear[6*actuatorid];
|
||||
mjtNum gear2 = m->actuator_gear[6*m->actuator_outadr[actuatorid]] * m->actuator_gear[6*m->actuator_outadr[actuatorid]];
|
||||
armature = m->actuator_armature[actuatorid] * gear2;
|
||||
}
|
||||
|
||||
// actuatorid < -1: scan all actuators for contributions
|
||||
else {
|
||||
for (int k = 0; k < m->nu; k++) {
|
||||
for (int k = 0; k < m->nactuator; k++) {
|
||||
// skip actuators that don't actuate the given joint/tendon
|
||||
if (m->actuator_trnid[2*k] != id) {
|
||||
continue;
|
||||
@@ -1178,7 +1178,7 @@ mjtNum mj_actuatorArmature(const mjModel* m, mjtObj type, int id) {
|
||||
}
|
||||
|
||||
// accumulate armature contribution
|
||||
mjtNum gear2 = m->actuator_gear[6*k] * m->actuator_gear[6*k];
|
||||
mjtNum gear2 = m->actuator_gear[6*m->actuator_outadr[k]] * m->actuator_gear[6*m->actuator_outadr[k]];
|
||||
armature += m->actuator_armature[k] * gear2;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user