Add "frame" attribute to <attach> element.

The `<attach>` element now supports a "frame" attribute, allowing users to specify either a "body" or a "frame" to attach to, but not both. The XML parser has been updated to handle this new attribute and the mutual exclusivity constraint.

PiperOrigin-RevId: 941245904
Change-Id: I4c0edeed5f3a9e456aed96c373b1647fe79841d9
This commit is contained in:
Yuval Tassa
2026-07-01 12:49:01 -07:00
committed by Copybara-Service
parent 1f6cf4035c
commit c6c3ec3149
5 changed files with 77 additions and 27 deletions
+16 -2
View File
@@ -3,9 +3,23 @@
<model name="other" file="child.xml"/>
</asset>
<worldbody>
<!-- attach body to body -->
<body name="parent">
<geom name="geom" size="2"/>
<attach model="other" body="body" prefix="other"/>
<geom name="geom" size="1" pos="0 0 2"/>
<attach model="other" body="body" prefix="other1"/>
</body>
<!-- attach frame to body (world) -->
<attach model="other" frame="frame" prefix="other2"/>
<!-- attach frame to frame -->
<frame name="top" pos="0 0 4">
<attach model="other" frame="frame" prefix="other3"/>
</frame>
<!-- attach body to frame -->
<frame name="bottom-right" pos="2 0 -1">
<attach model="other" body="body" prefix="other4"/>
</frame>
</worldbody>
</mujoco>