You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When attaching bodies from one spec to another, it would be convenient to have some configurability on how the keyframes are handled as a result of the attachment. For example, I often have a "home" keyframe in both the attachment source and target specs and it would be convenient to be have a single "home" keyframe in the target spec after the attachment.
There's obviously no general solution that would magically always do the right thing, but the API could provide some pre-defined protocols that can be passed in as an argument to e.g. the MjsFrame.attach_body. For example my use cases would be largely covered by something like:
MjsFrame.attach_body(..., "by-name"), which would merge all the keyframes with the same name.
Example: when specs have <key name="home" qpos="1"/> and <key name="home" qpos="2"/>, the result would be <key name="home" qpos="1 2"/>.
MjsFrame.attach_body(..., "by-index"), which would merge all the keyframes with the same index.
Example: when specs have <key qpos="1"/><key qpos="2"/> and <key qpos="3"/><key qpos="4"/>, the result would be <key qpos="1 3"/><key qpos="2 4"/>.
There are obviously some details that would have to be figured out before implementing these. For example, what would happen if two specs have different number of key elements when attaching with by-index. Or if one key has an attribute and the other one does not.
Alternatives
The keyframes can currently be merged manually using the C- or Python-API.
Additional context
No response
The text was updated successfully, but these errors were encountered:
The feature, motivation and pitch
When attaching bodies from one spec to another, it would be convenient to have some configurability on how the keyframes are handled as a result of the attachment. For example, I often have a
"home"
keyframe in both the attachment source and target specs and it would be convenient to be have a single"home"
keyframe in the target spec after the attachment.There's obviously no general solution that would magically always do the right thing, but the API could provide some pre-defined protocols that can be passed in as an argument to e.g. the
MjsFrame.attach_body
. For example my use cases would be largely covered by something like:MjsFrame.attach_body(..., "by-name")
, which would merge all the keyframes with the same name.<key name="home" qpos="1"/>
and<key name="home" qpos="2"/>
, the result would be<key name="home" qpos="1 2"/>
.MjsFrame.attach_body(..., "by-index")
, which would merge all the keyframes with the same index.<key qpos="1"/><key qpos="2"/>
and<key qpos="3"/><key qpos="4"/>
, the result would be<key qpos="1 3"/><key qpos="2 4"/>
.There are obviously some details that would have to be figured out before implementing these. For example, what would happen if two specs have different number of key elements when attaching with
by-index
. Or if one key has an attribute and the other one does not.Alternatives
The keyframes can currently be merged manually using the C- or Python-API.
Additional context
No response
The text was updated successfully, but these errors were encountered: