ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
1

Building URDF from scratch, how to calculate inertial values?

asked 2017-04-28 03:45:07 -0500

Auton0mous gravatar image

I've been stuck on this for a while. Most resources online point to complex equations even for the simplest of shapes. Surely there is some sort of software in which I can just build my robot and have it generate inertial values?

edit retag flag offensive close merge delete

Comments

1

I don't know of any software that would "just" do this for you unfortunately. But to make sure: if you are not planning on using any sort of dynamic simulator (Gazebo, V-REP, etc), you don't need to specify any inertial properties.

gvdhoorn gravatar image gvdhoorn  ( 2017-04-28 04:46:17 -0500 )edit

3 Answers

Sort by ยป oldest newest most voted
1

answered 2017-04-28 08:42:29 -0500

Airuno2L gravatar image

I've found the following link to be very helpful: http://gazebosim.org/tutorials?tut=in...

And I actually just make my inertial values the same as a box the same size as my collision shapes so the inertial values are just calculated using the formula lists for cuboids on this wikipedia page using the values from my collision boxes. Like that gazebo tutorial mentions, if you temporarily set mass = 1, you can view the inertial cube in gazebo and it should be the same as your collision cube.

This is close enough for most applications.

edit flag offensive delete link more
1

answered 2022-06-28 05:21:07 -0500

vonunwerth gravatar image

updated 2022-06-28 05:21:16 -0500

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/MeshLab...

edit flag offensive delete link more
1

answered 2017-04-28 06:50:01 -0500

spooner-dev gravatar image

Check out the MyBot Tutorial and specifically its xacro file :

<macro name="cylinder_inertia" params="m r h">
      <inertia  ixx="${m*(3*r*r+h*h)/12}" ixy = "0" ixz = "0"
                  iyy="${m*(3*r*r+h*h)/12}" iyz = "0"
                  izz="${m*r*r/2}" /> 
      </macro>

<macro name="box_inertia" params="m x y z">
        <inertia  ixx="${m*(y*y+z*z)/12}" ixy = "0" ixz = "0"
                  iyy="${m*(x*x+z*z)/12}" iyz = "0"
                  izz="${m*(x*x+z*z)/12}" /> 
</macro>

<macro name="sphere_inertia" params="m r">
        <inertia  ixx="${2*m*r*r/5}" ixy = "0" ixz = "0"
                  iyy="${2*m*r*r/5}" iyz = "0"
                  izz="${2*m*r*r/5}" /> 
</macro>

These macroses are calculations for basic shapes and could be easily pulled into your project. But if you need inertias for some custom shapes, then you should look into some 3D modeling SW, they have capability to calculate necessary matrices for you.

edit flag offensive delete link more

Question Tools

3 followers

Stats

Asked: 2017-04-28 03:45:07 -0500

Seen: 3,849 times

Last updated: Jun 28 '22