ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
I implemented a python script reading an 3D file like stl or dae and outputting the full URDF XML inertial tag based on the gazebosim tutorial.
At first the script calculates the center of mass of the object. After that it scales the mesh by a factor of 100 to increase the numerical accuracy. You could manually change that, if you need to scale it more up. Now the convex hull of your object will be calculated. For the hull the geometric properties will be calculated, scaled back down and outputted as URDF XML inertial tag like that (the precision could also be changed in the script)
<inertial>
<origin xyz="0.00000002 -0.00000001 0.00000000"/>
<mass value="5.00000000"/>
<inertia ixx="7.90866056" ixy="0.00000006" ixz="0.00000000" iyy="7.90866060" iyz="0.00000000" izz="2.48398783"/>
</inertial>
Check it out here: https://github.com/vonunwerth/MeshLabInertiaToURDF
2 | No.2 Revision |
I implemented a python script reading an 3D file like stl or dae and outputting the full URDF XML inertial tag based on the gazebosim tutorial.
At first the script calculates the center of mass of the object. After that it scales the mesh by a factor of 100 to increase the numerical accuracy. You could manually change that, if you need to scale it more up. Now the convex hull of your object will be calculated. For the hull the geometric properties will be calculated, scaled back down and outputted as URDF XML inertial tag like that (the precision could also be changed in the script)
<inertial>
<origin xyz="0.00000002 -0.00000001 0.00000000"/>
<mass value="5.00000000"/>
<inertia ixx="7.90866056" ixy="0.00000006" ixz="0.00000000" iyy="7.90866060" iyz="0.00000000" izz="2.48398783"/>
</inertial>
Check it out here: https://github.com/vonunwerth/MeshLabInertiaToURDF