Replies: 1 comment
-
Bodies can be placed recursively in the XML file. If a body is placed in another body it will have 0 DoF and move with the other body like if it was fixed to the other body, just like how a body is constrained to the worldbody. And just like a body inside a worldbody, If you want to have more than zero DoF then you simply add a joint. Here's a minimal example of a horizontal capsule attached to vertical cylinder using controllable joints:
<mujoco>
<worldbody>
<body pos="-.15 -.15 .3">
<joint name="hinge1" type="hinge" axis="0 0 1" limited="true" range="-75 75" />
<geom type="cylinder" size=".01" fromto="0 0 0 0 0 .1"/>
<body pos="0 0 .05">
<geom type="capsule" size=".01" fromto="-.25 0 0 .25 0 0"/>
<joint name="hinge2" type="hinge" axis="0 1 0" damping=".5" limited="true" range="-15 15" />
</body>
</body>
</worldbody>
<actuator>
<general joint="hinge1" biasprm="0" biastype="affine" ctrlrange="-.003 .003" ctrllimited="true" />
<general joint="hinge2" biasprm="0" biastype="affine" ctrlrange="-.3 .3" ctrllimited="true" />
</actuator>
</mujoco> The visuals of the simulation above won't win any reward, but it might show what you're asking for :) The XML Reference page is really good if you haven't found it yet: https://mujoco.readthedocs.io/en/stable/XMLreference.html if you are unsure of any of the parameters. |
Beta Was this translation helpful? Give feedback.
-
Could someone explain how to connect a rigid body to a moving one in the XML file? It is like a rod and I am connecting another rod that needs to move up and down and rotate. Is using "equality" the right approach? Pretty new to MuJoCo; would love some advice.
Beta Was this translation helpful? Give feedback.
All reactions