Use sparse (uncompressed) actuator_moment in mj_transmission.

PiperOrigin-RevId: 692179704
Change-Id: Ic30ac5a98dc13de2028e378df65dc88ba3912bf5
This commit is contained in:
Taylor Howell
2024-11-01 08:05:14 -07:00
committed by Copybara-Service
parent 1d58576d28
commit a51f346059
13 changed files with 230 additions and 81 deletions
+10 -1
View File
@@ -827,6 +827,10 @@ void mjd_actuator_vel(const mjModel* m, mjData* d) {
return;
}
// allocate dense actuator_moment row
mj_markStack(d);
mjtNum* moment = mj_stackAllocNum(d, nv);
// process actuators
for (int i=0; i < nu; i++) {
// skip if disabled
@@ -870,9 +874,14 @@ void mjd_actuator_vel(const mjModel* m, mjData* d) {
// add
if (bias_vel != 0) {
addJTBJ(m, d, d->actuator_moment+i*nv, &bias_vel, 1);
mju_sparse2dense(moment, d->actuator_moment, 1, nv, d->moment_rownnz + i,
d->moment_rowadr + i, d->moment_colind);
addJTBJ(m, d, moment, &bias_vel, 1);
}
}
// free space
mj_freeStack(d);
}