google-deepmind / google-deepmind/mujoco
`MjSpec`: protocols for merging keyframes on attach
- Dominant language
- C++
- Stars
- 15.2k
- Forks
- 1.8k
- Avg merge
- 10d 16h
- Merged PRs (30d)
- 25
Description
### 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.
- Example: when specs have `` and ``, the result would be ``.
- `MjsFrame.attach_body(..., "by-index")`, which would merge all the keyframes with the same index.
- Example: when specs have `` and ``, the result would be ``.
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_
Contributor guide
Assessment
This issue has not been assessed yet.