Fast Tune Tool for MuJoCo Environment Construction
How do you get any placement position and rotation on MuJoCo quickly?
When I build up a new MuJoCo environment or need to modify the environment based on the previous environment, especially I want to insert a new body
or geom
with a precise position and rotation , sometimes it’s difficult because of the complexity of the high-DoF model and waste me lots of time. Here you can use the tool I support here to help you find your desired placement in quick.
Preparations: Please refer the mujoco-py
setup in my previous blog through this link to install related dependencies.
How to use:
-
Add these code blocks on your own MuJoCo
xml
file:- Add below on
<worldbody>
…</worldbody>
:
<body name="endeff_des" pos="0 0 0" mocap="true"> <geom type="sphere" size="0.015" rgba="1 0 0 1" /> <geom class="x_s_axis"/> <geom class="y_s_axis"/> <geom class="z_s_axis"/> </body>
- Add below on your
</default>
…</default>
:
<default class="x_s_axis"> <geom contype="0" conaffinity="0" group="1" rgba="1 0 0 1" type="cylinder" size=".005 0.05" pos="0.05 0 0" euler="0 1.570796327 0"/> </default> <default class="y_s_axis"> <geom contype="0" conaffinity="0" group="1" rgba="0 1 0 1" type="cylinder" size=".005 0.05" pos="0 0.05 0" euler="1.570796327 0 0"/> </default> <default class="z_s_axis"> <geom contype="0" conaffinity="0" group="1" rgba="0 0 1 1" type="cylinder" size=".005 0.05" pos="0 0 0.05" euler="0 0 0"/> </default>
- Add below on
-
Drag the
Fast_Tune.py
file in any location on your PC (suggested to put it on the same location of your MuJoCoxml
file.) -
Change the two lines on the code with your own MuJoCo environment file and referred frame:
ref_body_name = "satellite" # Change your refered frame xml_test_name = "/home/wam/sat_demo.xml" # Change your own environment file location
-
Then run the file. You will see the scenario like the following:
You can use ←
→
↑
↓
F
B
on your keyboard to change the frame location; And Q
/W
, A
/S
, Z
/X
to change the row, pitch, yaw roation of the frame. You need to put the frame on your desired location and rotation. Then afterthat, record the data on the right-head dashboard as
Note that when the frame is moving, the data on this area is also changing. W-position
means the position of moving frame relative to the world frame in X, Y, Z; B-position
means the position of moving frame relative to your specific frame in X, Y, Z;n Similar to W-Rotation
and B-Rotation
. Based on this information, you can change your xml
in a quick time.
Additionally, I also test in another project and find the effect is good.
Click the link to clone the project from Github.
If you can give me a star that this tool do help you for your project, I will be so happy.