Description
In MJScene, when a body's mass changes during propagation (e.g. a depleting fuel tank), the
body's reported position stays pinned at the model reference pose for the whole maneuver,
even though its velocity and mass state integrate correctly.
Steps to reproduce
- Build a scene with a single translating body (free joint or three slide joints) and an
on-axis thrust actuator.
- Make the body mass a state that decreases each step (e.g. drive the
body mass rate directly).
- Propagate and record the body/site output message.
Expected
The recorded position integrates with the velocity (for a constant-thrust burn it should
follow the analytic Tsiolkovsky trajectory).
Actual
v_BN_N and the mass state are correct, but r_BN_N remains at the initial/reference pose —
off by the full displacement of the burn.
Cause
MJScene::equationsOfMotion calls mj_setConst on each step the mass changes, to refresh
MuJoCo's cached "constant" quantities. mj_setConst runs its internal computations at the model
reference pose: it overwrites data->qpos with qpos0/qpos_spring and leaves it there. Every
position-dependent quantity evaluated afterward in the same call — forward kinematics,
spring/gravity forces, and the site state-output messages — is therefore computed at the
reference pose instead of the current configuration. Since the branch fires every step of a
burn, the reported position never leaves the reference pose.
Description
In
MJScene, when a body's mass changes during propagation (e.g. a depleting fuel tank), thebody's reported position stays pinned at the model reference pose for the whole maneuver,
even though its velocity and mass state integrate correctly.
Steps to reproduce
on-axis thrust actuator.
body mass rate directly).
Expected
The recorded position integrates with the velocity (for a constant-thrust burn it should
follow the analytic Tsiolkovsky trajectory).
Actual
v_BN_Nand the mass state are correct, butr_BN_Nremains at the initial/reference pose —off by the full displacement of the burn.
Cause
MJScene::equationsOfMotioncallsmj_setConston each step the mass changes, to refreshMuJoCo's cached "constant" quantities.
mj_setConstruns its internal computations at the modelreference pose: it overwrites
data->qposwithqpos0/qpos_springand leaves it there. Everyposition-dependent quantity evaluated afterward in the same call — forward kinematics,
spring/gravity forces, and the site state-output messages — is therefore computed at the
reference pose instead of the current configuration. Since the branch fires every step of a
burn, the reported position never leaves the reference pose.