ROS Answers: Open Source Q&A Forum - RSS feedhttps://answers.ros.org/questions/Open source question and answer forum written in Python and DjangoenROS Answers is licensed under Creative Commons Attribution 3.0Wed, 19 Dec 2012 08:15:12 -0600Choosing the right coefficients for Gazebo simulationhttps://answers.ros.org/question/30539/choosing-the-right-coefficients-for-gazebo-simulation/Hello,
I am trying to create an URDF and simulate it in Gazebo for a 4WD Skid steering robot. The chasis is actually a box with the following properties:
<li> body_width (base_size_y) : 22 cm
<li> body_length (base_size_x) : 27 cm
<li> body_height (base_size_z) : 5 cm
<li> body_mass : 5 kg
<p>and wheels:
<li> wheel_diameter : 0.12065 m
<li> wheel_width : 0.060325 m
<li> wheel_mass 0.181436948 kg
I have created the URDF and a differential drive plugin for gazebo to simulate the model but I have no idea how to choose appropriate values for torque, mu1, mu2, kp, kd and inertia matrix. The values that I am currently using are taken/combined from the erratic/guardian/turtlebot stacks.
<p>By publishing the odometry (calculated in the plugin) and comparing the robot's position in Gazebo and RViz I can see that the model slips a lot while performing turns.
<p>Relevant files: [myrobot.urdf.xacro](http://pastebin.com/LPdpShBW)
[myrobot_constants.xacro](http://pastebin.com/Wcwft3mH)
[myrobot_wheel.xacro](http://pastebin.com/KJT1MuWR)
[myrobot_materials.xacro](http://pastebin.com/37JrQHQE)
<p>Any help is appreciated.
<p>Thanks in advance.
<b><big>Update:</big></b>
Here is the output from Solidworks for the chassis:<br>
Output coordinate System: -- default --
Mass = 489.90 grams
Volume = 181445.50 cubic millimeters
Surface area = 189380.73 millimeters^2
Center of mass: ( millimeters )
X = 41.53
Y = 93.76
Z = 131.23
Principal axes of inertia and principal moments of inertia: ( grams *
square millimeters )
Taken at the center of mass.
Ix = (0.00, 0.01, 1.00) Px = 4157521.05
Iy = (1.00, 0.00, 0.00) Py = 5704820.80
Iz = (0.00, 1.00, -0.01) Pz = 9356042.65
Moments of inertia: ( grams * square millimeters )
Taken at the center of mass and aligned with the output coordinate system.
Lxx = 5704820.80 Lxy = 0.00 Lxz = -0.00
Lyx = 0.00 Lyy = 9355391.53 Lyz = 58176.21
Lzx = -0.00 Lzy = 58176.21 Lzz = 4158172.18
Moments of inertia: ( grams * square millimeters )
Taken at the output coordinate system.
Ixx = 18448329.91 Ixy = 1907623.47 Ixz = 2669963.78
Iyx = 1907623.47 Iyy = 18637105.26 Iyz = 6086030.51
Izx = 2669963.78 Izy = 6086030.51 Izz = 9309884.18
And here is how I've put it in URDF:
<link name="base_link">
<inertial>
<mass value="${chassis_mass}" />
<origin xyz="0.04153 0.09376 0.13123" />
<inertia ixx="0.00415752105" ixy="0.0" ixz="0.0"
iyy="0.0057048208" iyz="0.0"
izz="0.00935604265" />
</inertial>
Is this correct? I guess this is only correct if my model has the coordinate system aligned with the representation from Gazebo, right?
Tue, 27 Mar 2012 01:24:10 -0500https://answers.ros.org/question/30539/choosing-the-right-coefficients-for-gazebo-simulation/Comment by hsu for <p>Hello,
I am trying to create an URDF and simulate it in Gazebo for a 4WD Skid steering robot. The chasis is actually a box with the following properties:
</p><li> body_width (base_size_y) : 22 cm
</li><li> body_length (base_size_x) : 27 cm
</li><li> body_height (base_size_z) : 5 cm
</li><li> body_mass : 5 kg<p></p>
<p></p><p>and wheels:
</p></li><li> wheel_diameter : 0.12065 m
</li><li> wheel_width : 0.060325 m
</li><li> wheel_mass 0.181436948 kg<p></p>
<p>I have created the URDF and a differential drive plugin for gazebo to simulate the model but I have no idea how to choose appropriate values for torque, mu1, mu2, kp, kd and inertia matrix. The values that I am currently using are taken/combined from the erratic/guardian/turtlebot stacks.
</p><p>By publishing the odometry (calculated in the plugin) and comparing the robot's position in Gazebo and RViz I can see that the model slips a lot while performing turns.
</p><p>Relevant files: <a href="http://pastebin.com/LPdpShBW">myrobot.urdf.xacro</a>
<a href="http://pastebin.com/Wcwft3mH">myrobot_constants.xacro</a>
<a href="http://pastebin.com/KJT1MuWR">myrobot_wheel.xacro</a>
<a href="http://pastebin.com/37JrQHQE">myrobot_materials.xacro</a>
</p><p>Any help is appreciated.
</p><p>Thanks in advance.</p>
<p><b><big>Update:</big></b></p>
<p>Here is the output from Solidworks for the chassis:<br></p>
<pre><code>Output coordinate System: -- default --
Mass = 489.90 grams
Volume = 181445.50 cubic millimeters
Surface area = 189380.73 millimeters^2
Center of mass: ( millimeters )
X = 41.53
Y = 93.76
Z = 131.23
Principal axes of inertia and principal moments of inertia: ( grams *
square millimeters )
Taken at the center of mass.
Ix = (0.00, 0.01, 1.00) Px = 4157521.05
Iy = (1.00, 0.00, 0.00) Py = 5704820.80
Iz = (0.00, 1.00, -0.01) Pz = 9356042.65
Moments of inertia: ( grams * square millimeters )
Taken at the center of mass and aligned with the output coordinate system.
Lxx = 5704820.80 Lxy = 0.00 Lxz = -0.00
Lyx = 0.00 Lyy = 9355391.53 Lyz = 58176.21
Lzx = -0.00 Lzy = 58176.21 Lzz = 4158172.18
Moments of inertia: ( grams * square millimeters )
Taken at the output coordinate system.
Ixx = 18448329.91 Ixy = 1907623.47 Ixz = 2669963.78
Iyx = 1907623.47 Iyy = 18637105.26 Iyz = 6086030.51
Izx = 2669963.78 Izy = 6086030.51 Izz = 9309884.18
</code></pre>
<p>And here is how I've put it in URDF:</p>
<pre><code><link name="base_link">
<inertial>
<mass value="${chassis_mass}" />
<origin xyz="0.04153 0.09376 0.13123" />
<inertia ixx="0.00415752105" ixy="0.0" ixz="0.0"
iyy="0.0057048208" iyz="0.0"
izz="0.00935604265" />
</inertial>
</code></pre>
<p>Is this correct? I guess this is only correct if my model has the coordinate system aligned with the representation from Gazebo, right?</p>
</li>https://answers.ros.org/question/30539/choosing-the-right-coefficients-for-gazebo-simulation/?comment=30886#post-id-30886the update URDF block for base_link ineria looks right. Yes, assuming the coordinate system from your SWX export aligns with the coordinate of the URDF Link. Can you update the inertia blocks of the attached xacro files? Can you also post an approximation of slippage in your simulation? Thanks.Fri, 30 Mar 2012 09:44:15 -0500https://answers.ros.org/question/30539/choosing-the-right-coefficients-for-gazebo-simulation/?comment=30886#post-id-30886Answer by DimitriProsser for <p>Hello,
I am trying to create an URDF and simulate it in Gazebo for a 4WD Skid steering robot. The chasis is actually a box with the following properties:
</p><li> body_width (base_size_y) : 22 cm
</li><li> body_length (base_size_x) : 27 cm
</li><li> body_height (base_size_z) : 5 cm
</li><li> body_mass : 5 kg<p></p>
<p></p><p>and wheels:
</p></li><li> wheel_diameter : 0.12065 m
</li><li> wheel_width : 0.060325 m
</li><li> wheel_mass 0.181436948 kg<p></p>
<p>I have created the URDF and a differential drive plugin for gazebo to simulate the model but I have no idea how to choose appropriate values for torque, mu1, mu2, kp, kd and inertia matrix. The values that I am currently using are taken/combined from the erratic/guardian/turtlebot stacks.
</p><p>By publishing the odometry (calculated in the plugin) and comparing the robot's position in Gazebo and RViz I can see that the model slips a lot while performing turns.
</p><p>Relevant files: <a href="http://pastebin.com/LPdpShBW">myrobot.urdf.xacro</a>
<a href="http://pastebin.com/Wcwft3mH">myrobot_constants.xacro</a>
<a href="http://pastebin.com/KJT1MuWR">myrobot_wheel.xacro</a>
<a href="http://pastebin.com/37JrQHQE">myrobot_materials.xacro</a>
</p><p>Any help is appreciated.
</p><p>Thanks in advance.</p>
<p><b><big>Update:</big></b></p>
<p>Here is the output from Solidworks for the chassis:<br></p>
<pre><code>Output coordinate System: -- default --
Mass = 489.90 grams
Volume = 181445.50 cubic millimeters
Surface area = 189380.73 millimeters^2
Center of mass: ( millimeters )
X = 41.53
Y = 93.76
Z = 131.23
Principal axes of inertia and principal moments of inertia: ( grams *
square millimeters )
Taken at the center of mass.
Ix = (0.00, 0.01, 1.00) Px = 4157521.05
Iy = (1.00, 0.00, 0.00) Py = 5704820.80
Iz = (0.00, 1.00, -0.01) Pz = 9356042.65
Moments of inertia: ( grams * square millimeters )
Taken at the center of mass and aligned with the output coordinate system.
Lxx = 5704820.80 Lxy = 0.00 Lxz = -0.00
Lyx = 0.00 Lyy = 9355391.53 Lyz = 58176.21
Lzx = -0.00 Lzy = 58176.21 Lzz = 4158172.18
Moments of inertia: ( grams * square millimeters )
Taken at the output coordinate system.
Ixx = 18448329.91 Ixy = 1907623.47 Ixz = 2669963.78
Iyx = 1907623.47 Iyy = 18637105.26 Iyz = 6086030.51
Izx = 2669963.78 Izy = 6086030.51 Izz = 9309884.18
</code></pre>
<p>And here is how I've put it in URDF:</p>
<pre><code><link name="base_link">
<inertial>
<mass value="${chassis_mass}" />
<origin xyz="0.04153 0.09376 0.13123" />
<inertia ixx="0.00415752105" ixy="0.0" ixz="0.0"
iyy="0.0057048208" iyz="0.0"
izz="0.00935604265" />
</inertial>
</code></pre>
<p>Is this correct? I guess this is only correct if my model has the coordinate system aligned with the representation from Gazebo, right?</p>
</li> https://answers.ros.org/question/30539/choosing-the-right-coefficients-for-gazebo-simulation/?answer=30561#post-id-30561This may or may not help, but when I was building my robot's simulator, I used my real robot as the model. I calculated my real robot's speed and did my best to match it in Gazebo. I tuned the real robot such that a cmd_vel message of 1.2m/s ahead would result in exactly 1.2m/s. I then did the same in Gazebo. I set the cmd_vel to 1.2m/s and measured Gazebo's result. If the wheels were slipping too much, I would adjust the constants in the simulator.
`<kp>` and `<kd>` are basically the "solidness" of your model. As such, you want `<kp>` to be very high and `<kd>` to be low (I use a value of 1). As for `<mu1>` and `<mu2>`, I determined those by using the method that I mentioned above. (Mine came out to be `mu1` = 200 and `mu2` = 100 for my large robot). I tuned torque in the same way.
The only one that I can't help you with is the inertia of the wheels. I used my SolidWorks model of the robot to automatically calculate the mass-moments of inertia for each wheel. See [this](http://answers.ros.org/question/11350/is-there-any-way-to-calculate-inertial-property-of) question for help. Tue, 27 Mar 2012 04:02:22 -0500https://answers.ros.org/question/30539/choosing-the-right-coefficients-for-gazebo-simulation/?answer=30561#post-id-30561Answer by PeterMilani for <p>Hello,
I am trying to create an URDF and simulate it in Gazebo for a 4WD Skid steering robot. The chasis is actually a box with the following properties:
</p><li> body_width (base_size_y) : 22 cm
</li><li> body_length (base_size_x) : 27 cm
</li><li> body_height (base_size_z) : 5 cm
</li><li> body_mass : 5 kg<p></p>
<p></p><p>and wheels:
</p></li><li> wheel_diameter : 0.12065 m
</li><li> wheel_width : 0.060325 m
</li><li> wheel_mass 0.181436948 kg<p></p>
<p>I have created the URDF and a differential drive plugin for gazebo to simulate the model but I have no idea how to choose appropriate values for torque, mu1, mu2, kp, kd and inertia matrix. The values that I am currently using are taken/combined from the erratic/guardian/turtlebot stacks.
</p><p>By publishing the odometry (calculated in the plugin) and comparing the robot's position in Gazebo and RViz I can see that the model slips a lot while performing turns.
</p><p>Relevant files: <a href="http://pastebin.com/LPdpShBW">myrobot.urdf.xacro</a>
<a href="http://pastebin.com/Wcwft3mH">myrobot_constants.xacro</a>
<a href="http://pastebin.com/KJT1MuWR">myrobot_wheel.xacro</a>
<a href="http://pastebin.com/37JrQHQE">myrobot_materials.xacro</a>
</p><p>Any help is appreciated.
</p><p>Thanks in advance.</p>
<p><b><big>Update:</big></b></p>
<p>Here is the output from Solidworks for the chassis:<br></p>
<pre><code>Output coordinate System: -- default --
Mass = 489.90 grams
Volume = 181445.50 cubic millimeters
Surface area = 189380.73 millimeters^2
Center of mass: ( millimeters )
X = 41.53
Y = 93.76
Z = 131.23
Principal axes of inertia and principal moments of inertia: ( grams *
square millimeters )
Taken at the center of mass.
Ix = (0.00, 0.01, 1.00) Px = 4157521.05
Iy = (1.00, 0.00, 0.00) Py = 5704820.80
Iz = (0.00, 1.00, -0.01) Pz = 9356042.65
Moments of inertia: ( grams * square millimeters )
Taken at the center of mass and aligned with the output coordinate system.
Lxx = 5704820.80 Lxy = 0.00 Lxz = -0.00
Lyx = 0.00 Lyy = 9355391.53 Lyz = 58176.21
Lzx = -0.00 Lzy = 58176.21 Lzz = 4158172.18
Moments of inertia: ( grams * square millimeters )
Taken at the output coordinate system.
Ixx = 18448329.91 Ixy = 1907623.47 Ixz = 2669963.78
Iyx = 1907623.47 Iyy = 18637105.26 Iyz = 6086030.51
Izx = 2669963.78 Izy = 6086030.51 Izz = 9309884.18
</code></pre>
<p>And here is how I've put it in URDF:</p>
<pre><code><link name="base_link">
<inertial>
<mass value="${chassis_mass}" />
<origin xyz="0.04153 0.09376 0.13123" />
<inertia ixx="0.00415752105" ixy="0.0" ixz="0.0"
iyy="0.0057048208" iyz="0.0"
izz="0.00935604265" />
</inertial>
</code></pre>
<p>Is this correct? I guess this is only correct if my model has the coordinate system aligned with the representation from Gazebo, right?</p>
</li> https://answers.ros.org/question/30539/choosing-the-right-coefficients-for-gazebo-simulation/?answer=48558#post-id-48558It seems that the units for Inertia in Gazebo are Kg (meters)^2. -- sorry for the poor layout.
This is the standard SI units for Inertia. If solidworks is giving your units in g mm^2 then to convert to kg m^2 you would need to:
divide by 1 000 000 to convert from mm^2 to m^2.
divide by 1000 to convert from g to kg.
therefore you Ixx value of yours should be correct notwithstanding any differences in axes as I notice that you have used Izz as your Ixx value. To get around this potentially confusing issue, I typically have drawn the object as per a "rest" orientation, and used this as the basis for all values inputed into the urdf file.
You should only need to use the Inertia values about the centre of gravity, if your centre of gravity is not colocated with your origin then use the <origin> parameter for inertia for Gazebo to convert.
Hope this helps
Peter MilaniSun, 18 Nov 2012 17:16:01 -0600https://answers.ros.org/question/30539/choosing-the-right-coefficients-for-gazebo-simulation/?answer=48558#post-id-48558Answer by brawner for <p>Hello,
I am trying to create an URDF and simulate it in Gazebo for a 4WD Skid steering robot. The chasis is actually a box with the following properties:
</p><li> body_width (base_size_y) : 22 cm
</li><li> body_length (base_size_x) : 27 cm
</li><li> body_height (base_size_z) : 5 cm
</li><li> body_mass : 5 kg<p></p>
<p></p><p>and wheels:
</p></li><li> wheel_diameter : 0.12065 m
</li><li> wheel_width : 0.060325 m
</li><li> wheel_mass 0.181436948 kg<p></p>
<p>I have created the URDF and a differential drive plugin for gazebo to simulate the model but I have no idea how to choose appropriate values for torque, mu1, mu2, kp, kd and inertia matrix. The values that I am currently using are taken/combined from the erratic/guardian/turtlebot stacks.
</p><p>By publishing the odometry (calculated in the plugin) and comparing the robot's position in Gazebo and RViz I can see that the model slips a lot while performing turns.
</p><p>Relevant files: <a href="http://pastebin.com/LPdpShBW">myrobot.urdf.xacro</a>
<a href="http://pastebin.com/Wcwft3mH">myrobot_constants.xacro</a>
<a href="http://pastebin.com/KJT1MuWR">myrobot_wheel.xacro</a>
<a href="http://pastebin.com/37JrQHQE">myrobot_materials.xacro</a>
</p><p>Any help is appreciated.
</p><p>Thanks in advance.</p>
<p><b><big>Update:</big></b></p>
<p>Here is the output from Solidworks for the chassis:<br></p>
<pre><code>Output coordinate System: -- default --
Mass = 489.90 grams
Volume = 181445.50 cubic millimeters
Surface area = 189380.73 millimeters^2
Center of mass: ( millimeters )
X = 41.53
Y = 93.76
Z = 131.23
Principal axes of inertia and principal moments of inertia: ( grams *
square millimeters )
Taken at the center of mass.
Ix = (0.00, 0.01, 1.00) Px = 4157521.05
Iy = (1.00, 0.00, 0.00) Py = 5704820.80
Iz = (0.00, 1.00, -0.01) Pz = 9356042.65
Moments of inertia: ( grams * square millimeters )
Taken at the center of mass and aligned with the output coordinate system.
Lxx = 5704820.80 Lxy = 0.00 Lxz = -0.00
Lyx = 0.00 Lyy = 9355391.53 Lyz = 58176.21
Lzx = -0.00 Lzy = 58176.21 Lzz = 4158172.18
Moments of inertia: ( grams * square millimeters )
Taken at the output coordinate system.
Ixx = 18448329.91 Ixy = 1907623.47 Ixz = 2669963.78
Iyx = 1907623.47 Iyy = 18637105.26 Iyz = 6086030.51
Izx = 2669963.78 Izy = 6086030.51 Izz = 9309884.18
</code></pre>
<p>And here is how I've put it in URDF:</p>
<pre><code><link name="base_link">
<inertial>
<mass value="${chassis_mass}" />
<origin xyz="0.04153 0.09376 0.13123" />
<inertia ixx="0.00415752105" ixy="0.0" ixz="0.0"
iyy="0.0057048208" iyz="0.0"
izz="0.00935604265" />
</inertial>
</code></pre>
<p>Is this correct? I guess this is only correct if my model has the coordinate system aligned with the representation from Gazebo, right?</p>
</li> https://answers.ros.org/question/30539/choosing-the-right-coefficients-for-gazebo-simulation/?answer=50827#post-id-50827These answers all provide good information. I just want to point out that you should be taking the values for the moment of inertia from the block that specifies the 'moment of inertia taken at the center of mass aligned with the output coordinate system'. And then make sure your output coordinate system matches the link origin. That is, you can insert a reference coordinate system in SolidWorks where the visual and collision origins are set. If this weren't the base_link, you would place the output coordinate system at the origin location of the joint connecting the link to its parent link.Wed, 19 Dec 2012 08:15:12 -0600https://answers.ros.org/question/30539/choosing-the-right-coefficients-for-gazebo-simulation/?answer=50827#post-id-50827Answer by hsu for <p>Hello,
I am trying to create an URDF and simulate it in Gazebo for a 4WD Skid steering robot. The chasis is actually a box with the following properties:
</p><li> body_width (base_size_y) : 22 cm
</li><li> body_length (base_size_x) : 27 cm
</li><li> body_height (base_size_z) : 5 cm
</li><li> body_mass : 5 kg<p></p>
<p></p><p>and wheels:
</p></li><li> wheel_diameter : 0.12065 m
</li><li> wheel_width : 0.060325 m
</li><li> wheel_mass 0.181436948 kg<p></p>
<p>I have created the URDF and a differential drive plugin for gazebo to simulate the model but I have no idea how to choose appropriate values for torque, mu1, mu2, kp, kd and inertia matrix. The values that I am currently using are taken/combined from the erratic/guardian/turtlebot stacks.
</p><p>By publishing the odometry (calculated in the plugin) and comparing the robot's position in Gazebo and RViz I can see that the model slips a lot while performing turns.
</p><p>Relevant files: <a href="http://pastebin.com/LPdpShBW">myrobot.urdf.xacro</a>
<a href="http://pastebin.com/Wcwft3mH">myrobot_constants.xacro</a>
<a href="http://pastebin.com/KJT1MuWR">myrobot_wheel.xacro</a>
<a href="http://pastebin.com/37JrQHQE">myrobot_materials.xacro</a>
</p><p>Any help is appreciated.
</p><p>Thanks in advance.</p>
<p><b><big>Update:</big></b></p>
<p>Here is the output from Solidworks for the chassis:<br></p>
<pre><code>Output coordinate System: -- default --
Mass = 489.90 grams
Volume = 181445.50 cubic millimeters
Surface area = 189380.73 millimeters^2
Center of mass: ( millimeters )
X = 41.53
Y = 93.76
Z = 131.23
Principal axes of inertia and principal moments of inertia: ( grams *
square millimeters )
Taken at the center of mass.
Ix = (0.00, 0.01, 1.00) Px = 4157521.05
Iy = (1.00, 0.00, 0.00) Py = 5704820.80
Iz = (0.00, 1.00, -0.01) Pz = 9356042.65
Moments of inertia: ( grams * square millimeters )
Taken at the center of mass and aligned with the output coordinate system.
Lxx = 5704820.80 Lxy = 0.00 Lxz = -0.00
Lyx = 0.00 Lyy = 9355391.53 Lyz = 58176.21
Lzx = -0.00 Lzy = 58176.21 Lzz = 4158172.18
Moments of inertia: ( grams * square millimeters )
Taken at the output coordinate system.
Ixx = 18448329.91 Ixy = 1907623.47 Ixz = 2669963.78
Iyx = 1907623.47 Iyy = 18637105.26 Iyz = 6086030.51
Izx = 2669963.78 Izy = 6086030.51 Izz = 9309884.18
</code></pre>
<p>And here is how I've put it in URDF:</p>
<pre><code><link name="base_link">
<inertial>
<mass value="${chassis_mass}" />
<origin xyz="0.04153 0.09376 0.13123" />
<inertia ixx="0.00415752105" ixy="0.0" ixz="0.0"
iyy="0.0057048208" iyz="0.0"
izz="0.00935604265" />
</inertial>
</code></pre>
<p>Is this correct? I guess this is only correct if my model has the coordinate system aligned with the representation from Gazebo, right?</p>
</li> https://answers.ros.org/question/30539/choosing-the-right-coefficients-for-gazebo-simulation/?answer=30888#post-id-30888Friction / slippage is sensitive to constraint satisfaction (LCP) convergence. You may try increasing the LCP inner iterations (`<quickStepIters>` in [electric world file](https://code.ros.org/svn/ros-pkg/stacks/simulator_gazebo/branches/simulator_gazebo-1.4/gazebo_worlds/worlds/empty.world) or `<solver iters="10"/>` in [fuerte world file](https://code.ros.org/svn/ros-pkg/stacks/simulator_gazebo/trunk/gazebo_worlds/worlds/empty.world)) from 10 to 200 and check how friction slippage is affected.Fri, 30 Mar 2012 09:49:31 -0500https://answers.ros.org/question/30539/choosing-the-right-coefficients-for-gazebo-simulation/?answer=30888#post-id-30888