Add reset_data_keyframe to mirror mj_resetDataKeyframe in MuJoCo - #1489
Add reset_data_keyframe to mirror mj_resetDataKeyframe in MuJoCo#1489sibocw wants to merge 5 commits into
Conversation
|
@erikfrey what do we think about adding |
|
@thowell I think it's appropriate to add this to the mjwarp API. I bet that env frameworks would call it for smarter resetting. |
|
@sibocw the implementation looks great thanks for putting this together. lets update the implementation to set keyframes per world. instead of batching all of the keyframe fields in please let us know if you have any questions. thanks! |
|
@thowell How about this? I also noticed that there's no type/shape check for the per-world Thanks! |
Currently,
mujoco_warp.reset_datamirrorsmujoco.mj_resetData, but there's nomujoco_warp.reset_data_keyframethat mirrorsmujoco.mj_resetDataKeyframe.This PR aims to implement it by repeating exactly what
mj_resetDataKeyframedoes on the CPU: callingmj_resetData, then re-setting values defined in the keyframe.The complication is that
nkeyandkey_{time,qpos,qvel,act,mpos,mquat,ctrl}are not currently included inmujoco_warp.Model. Therefore, the reset-to-keypoint function would have to eitherMjModelobject as an additional input (this is the state after d599780), orModel(this is the current state of this PR). The dynamic attribute setting logic input_modelautomatically populates these fields, so we don't need to touchput_model.Would this be something useful?
PS. I guess we could in principle also allow different worlds to be reset to different keyframes, but IDK if this is a "real" use case.