Closed emrecemal closed 3 weeks ago
Did you see this section?
I saw the section and tried that part. I added the following line to the URDF file:
<mujoco>
<compiler meshdir="./meshes/" discardvisual="false"/>
</mujoco>
Then, I dragged the URDF file into the Mujoco App and saw my robot there. However, when I save the MJCF file and open it, I can't see the inertia values. Do I need to modify it manually?
That is surprising. URDFs always have explicit inertial clauses, so they should always get saved...
Would you mind making a minimal URDF (no meshes or other external assets) that shows this issue?
Of course,
Here is a simple block's URDF with the mujoco's compiler line at the end:
<?xml version="1.0"?>
<robot name="block_2">
<link name="block_2_base_link">
<contact>
<lateral_friction value="1.0"/>
<spinning_friction value=".001"/>
</contact>
<inertial>
<origin rpy="0 0 0" xyz="0 0 0"/>
<mass value="0.02"/>
<inertia ixx="1" ixy="0" ixz="0" iyy="1" iyz="0" izz="1"/>
</inertial>
<visual>
<origin rpy="0 0 0" xyz="0.0 0.0 0.0"/>
<geometry>
<box size="0.10 0.018 0.018"/>
</geometry>
<material name="blockmat">
<color rgba="0.1 0.7 0.1 1"/>
</material>
</visual>
<collision>
<origin rpy="0 0 0" xyz="0.0 0.0 0.0"/>
<geometry>
<box size="0.10 0.018 0.018"/>
</geometry>
</collision>
</link>
<mujoco>
<compiler discardvisual="false"/>
</mujoco>
</robot>
After I uploaded on Mujoco, and saved it, the MJCF file looks like:
<mujoco model="block_2">
<compiler angle="radian"/>
<worldbody>
<geom size="0.05 0.009 0.009" type="box" contype="0" conaffinity="0" group="1" density="0" rgba="0.1 0.7 0.1 1"/>
<geom size="0.05 0.009 0.009" type="box" rgba="0.1 0.7 0.1 1"/>
</worldbody>
</mujoco>
Hold on, can you set fusestatic to false? It is on by default for URDF, so these bodies get fused with the world body, which has no inertia...
I have achieved the desired result! Thank you very much for your assistance. Regarding the model transfer, here are the following steps:
scene.xml
file from one of the models in the repository and made the necessary import for my robot. However, I noticed that the model has collisions with the ground despite the absence of collision geometry definitions in the new XML file. Is this the expected behavior? Do I need to define the collision geometries?<freejoint/>
line just below my robot's trunk to ensure proper floating base dynamics.Do I need extra steps to get a complete model?
@emrecemal Looks reasonable to me.
I want to create an MJCF file for my bipedal robot that I designed in Onshape. I used the onshape-to-robot tool to obtain the URDF file for the robot. From what I understand, I need to manually create the MJCF file based on the URDF. However, I find the process quite complex as the XML Reference is very detailed, and I'm hesitant to delve deeper into it. Can you provide me with some guidelines or suggestions on how to convert my robot more conveniently?