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

Revision history [back]

click to hide/show revision 1
initial version

I'm new to this myself, but I resently got DiffDriveController to work on my robot. If I understand your problem correctly, I think you need to fix the mass / inertia. From what I have read, the identity matrix is a bad default for the moment of inertia matrix.

I use these macros in my model:

  <xacro: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}" /> 
  </xacro:macro>

  <xacro:macro name="box_inertia" params="m w h d">
          <inertia
            ixx="${m / 12.0 * (d*d + h*h)}" ixy="0.0" ixz="0.0"
            iyy="${m / 12.0 * (w*w + h*h)}" iyz="0.0"
            izz="${m / 12.0 * (w*w + d*d)}"/>
  </xacro:macro>

I'm new to this myself, but I resently got DiffDriveController to work on my robot. If I understand your problem correctly, I think you need to fix the mass / inertia. From what I have read, the identity matrix is a bad default for the moment of inertia matrix.

I use these macros in my model:

  <xacro: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}" /> 
  </xacro:macro>

  <xacro:macro name="box_inertia" params="m w h d">
          <inertia
            ixx="${m / 12.0 * (d*d + h*h)}" ixy="0.0" ixz="0.0"
            iyy="${m / 12.0 * (w*w + h*h)}" iyz="0.0"
            izz="${m / 12.0 * (w*w + d*d)}"/>
  </xacro:macro>

Make sure you configure the friction of your wheels so they don't slip. Here's a sample from my model. You will probably have to play with the values, some of them may be overkill.

  <gazebo reference="wheel_FL">
    <mu1 value="100000.0"/>
    <mu2 value="100000.0"/>
    <fdir1>0 1 0</fdir1>
    <minDepth>0.01</minDepth>
    <slip1>0</slip1>
    <slip2>0</slip2>
  </gazebo>