Rotation mesh frame without rotating its geom (picture)
Does anyone know how to change the frame orientation of the middle geometry's mesh, so it equals the neighbouring frame-geom orientation? Hence rotating the middle frame 90° around the z achsis (blue), without rotating the geom/mesh itself.
I tried to change the orientation of the STL file but the frame is always assigned that way from mujoco itself.

Can you explain what you're trying to do? i.e why it's important to adjust the geom frames. Also, if possible please attach a sample model we can look at.
Is the geom frame important to you, or could you work with body frames instead? MuJoCo will generally recenter the mesh around its center of mass, and rotate it to be aligned with the principal axes of inertia, but body frames are easier to work with.
I created a custom python environment where a robot needs to position several into their designated position. Once one segment is positioned (the red segments on the picture are showing the target position of their respective segment.
After a segment is positioned, the end-effector segment shall change to initiate the next placement.
This I am achieving changing the mesh ID with model.geom_dataid .
The problem is that when mujoco changes the mesh ID it seems to reset the orientation of the mesh to the one declared by mujoco. Therefore I dont think that I can easily use the body frame, as it switching the mesh. Hence I would need to change the body orientation of that particular end-effector body, but only for the short segment.
Here is a sample of the issue: https://github.com/aliemil/tbm
Uploaded are a sample xml and 3 STL's:
- The long segment with the desired frame
- The short segment with the undesired frame
- Same short segment rotated in CAD
Also thanks for the help! :)
Very cool application!
Are these geoms just visual, or do you want them to have inertia and generate contacts?
- If they're just visual, rather than changing the
geom_dataidat run time, have you considered adding all the possible geoms as children of the end effector, but putting them all in a visualization group that's hidden? At run time you can toggle the visibility of a geom by changing its visualization group. - If these geoms aren't just visual geoms, and you want them to have inertia and generate contacts, then switching the
geom_dataidor toggling visualization groups isn't going to do the right thing. If that's the case, you may want to make the geoms separate free bodies, and use<weld>constraints to glue them to the end effector. This will be slightly tricky. You would define one weld constraint in your XML, and modifymodel.eq_obj2idat runtime.
Thanks, its the ring building phase of a tunnel boring machine - a part of my Master Thesis :) In the video you can see what exactly I mean. The collisions are turnt of, as my agent is not skilled good enought to avoid them yet. The end-effector segment shall be able to generate contacts with the white colored segments. You brought me to an idea! In fact I could do what you suggested in 1. and set all non selected segments transparent, conaffinity = contype = 0 and their masses ~ 0. I think that should work. Thanks a lot! :)
https://user-images.githubusercontent.com/74488721/176778832-fb691ef1-205b-4fa1-a4aa-507c3b4db046.mp4