Rosanswers logo

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:

  • body_width (base_size_y) : 22 cm
  • body_length (base_size_x) : 27 cm
  • body_height (base_size_z) : 5 cm
  • body_mass : 5 kg

    and wheels:

  • wheel_diameter : 0.12065 m
  • wheel_width : 0.060325 m
  • 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.

    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.

    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)

    Any help is appreciated.

    Thanks in advance.


    Here is the output from Solidworks for the chassis:

    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">
            <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" />

    Is this correct? I guess this is only correct if my model has the coordinate system aligned with the representation from Gazebo, right?

    Originally posted by Rosia Nicolae on ROS Answers with karma: 91 on 2012-03-27

    Post score: 8

    Original comments

    Comment by hsu on 2012-03-30:
    the 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.

  • $\endgroup$

    4 Answers 4


    Rosanswers logo

    This 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 question for help.

    Originally posted by DimitriProsser with karma: 11163 on 2012-03-27

    This answer was ACCEPTED on the original site

    Post score: 12


    Rosanswers logo

    Friction / slippage is sensitive to constraint satisfaction (LCP) convergence. You may try increasing the LCP inner iterations (<quickStepIters> in electric world file or <solver iters="10"/> in fuerte world file) from 10 to 200 and check how friction slippage is affected.

    Originally posted by hsu with karma: 5780 on 2012-03-30

    This answer was NOT ACCEPTED on the original site

    Post score: 3


    Rosanswers logo

    It 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 parameter for inertia for Gazebo to convert.

    Hope this helps

    Peter Milani

    Originally posted by PeterMilani with karma: 1493 on 2012-11-18

    This answer was NOT ACCEPTED on the original site

    Post score: 3


    Rosanswers logo

    These 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.

    Originally posted by brawner with karma: 581 on 2012-12-19

    This answer was NOT ACCEPTED on the original site

    Post score: 2


    Your Answer

    By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.