Fix implicit integrator derivatives for actearly actuators.
The derivative calculation for actuator velocity in implicit integrators now correctly accounts for the `actearly` flag, using the next activation value when `actearly` is true. PiperOrigin-RevId: 868598722 Change-Id: Ia180afb15b31a718170aeaf9d4ac514bb9e6073b
This commit is contained in:
committed by
Copybara-Service
parent
730d494b7f
commit
7f74487a26
@@ -1117,9 +1117,15 @@ void mjd_actuator_vel(const mjModel* m, mjData* d) {
|
||||
if (m->actuator_dyntype[i] == mjDYN_NONE) {
|
||||
bias_vel += gain_vel * d->ctrl[i];
|
||||
} else {
|
||||
int act_first = m->actuator_actadr[i];
|
||||
int act_last = act_first + m->actuator_actnum[i] - 1;
|
||||
bias_vel += gain_vel * d->act[act_last];
|
||||
int act_adr = m->actuator_actadr[i] + m->actuator_actnum[i] - 1;
|
||||
mjtNum act = d->act[act_adr];
|
||||
|
||||
// use next activation if actearly is set (matching forward pass)
|
||||
if (m->actuator_actearly[i]) {
|
||||
act = mj_nextActivation(m, d, i, act_adr, d->act_dot[act_adr]);
|
||||
}
|
||||
|
||||
bias_vel += gain_vel * act;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user