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

diff_drive skid steer, front wheels not turning/veering right

asked 2021-09-21 13:07:10 -0500

kneave gravatar image

Hi, I'm creating a URDF for my robot which is tracked and I'm trying to use the diff_drive plugin in gazebo to simulate it. I can control the robot using the keyboard teleop utility but it veers to the right and when I look at the wheels in Gazebo I can see that though the rear wheels are turning as expected the front wheels aren't, if anything they look like they're digging in. If I drive in reverse the opposite happens.

The joints are all set to be continuous rather than revolute with a limit, I just can't figure this out and feel I'm bashing my head against the wall!

Is the wheel not turning expected behaviour for diff_drive with skid steer emulation or have I messed up with the URDF?

image description

This is the first URDF and gazebo simulation that I've created so if I'm honest I've been doing a lot of trial and error to try and figure out why this isn't working and I've honestly lost track a little.

Full code is available on github if anyone wanted to give it a go themselves. I'm honest completely lost and no idea what to try next so if anyone could assist I would be massively grateful!

This is the definition of the right wheels:

  <link name="rear_right_wheel">
    <inertial>
      <origin rpy="0 0 0" xyz="0 0 0" />
      <mass value="0.001" />
      <inertia ixx="0.000283500005025417" ixy="0" ixz="0" iyy="0.000283500005025417" iyz="0" izz="0.000323999993270263" />
    </inertial>
    <visual>
      <origin rpy="-4.712389 0 0" xyz="0 -0.01 0" />
      <geometry>
        <cylinder length="0.02" radius="0.025" />
      </geometry>
      <material name="black" />
    </visual>
    <collision>
      <origin rpy="-4.712389 0 0" xyz="0 -0.01 0" />
      <geometry>
        <cylinder length="0.02" radius="0.025" />
      </geometry>
    </collision>
  </link>
  <link name="front_right_wheel">
    <inertial>
      <origin rpy="0 0 0" xyz="0 0 0" />
      <mass value="0.001" />
      <inertia ixx="0.000283500005025417" ixy="0" ixz="0" iyy="0.000283500005025417" iyz="0" izz="0.000323999993270263" />
    </inertial>
    <visual>
      <origin rpy="-4.712389 0 0" xyz="0 -0.01 0" />
      <geometry>
        <cylinder length="0.02" radius="0.025" />
      </geometry>
      <material name="black" />
    </visual>
    <collision>
      <origin rpy="-1.570796 0 0" xyz="0 -0.01 0" />
      <geometry>
        <cylinder length="0.02" radius="0.025" />
      </geometry>
    </collision>
  </link>

This is the definition for the transmissions:

<transmission name="rear_left_wheel_transmission">
  <type>transmission_interface/SimpleTransmission</type>
  <joint name="base_link_rear_left_wheel_joint">
    <hardwareInterface>hardware_interface/VelocityJointInterface</hardwareInterface>
  </joint>
  <actuator name="rear_left_wheel_actuator">
    <mechanicalReduction>1</mechanicalReduction>
    <hardwareInterface>VelocityJointInterface</hardwareInterface>
  </actuator>
</transmission>

<transmission name="rear_right_wheel_transmission">
  <type>transmission_interface/SimpleTransmission</type>
  <joint name="base_link_rear_right_wheel_joint">
    <hardwareInterface>hardware_interface/VelocityJointInterface</hardwareInterface>
  </joint>
  <actuator name="rear_right_wheel_actuator">
    <mechanicalReduction>1</mechanicalReduction>
    <hardwareInterface>VelocityJointInterface</hardwareInterface>
  </actuator>
</transmission>

<transmission name="front_left_wheel_transmission">
  <type>transmission_interface/SimpleTransmission</type>
  <joint name="base_link_front_left_wheel_joint">
    <hardwareInterface>hardware_interface/VelocityJointInterface</hardwareInterface>
  </joint> ...
(more)
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2021-09-21 17:27:07 -0500

kneave gravatar image

So it turns out I had the coliders messed up and they were inside the chassis and completely bound up, you can see that in the original question.

If anyone stumbles upon this, this is the working diff_drive for gazebo. You'll want to change the name of the joints, the namespace, and the command topic to match your robot but as long as your URDF is right this should work:

  <plugin name="differential_drive_controller" filename="libgazebo_ros_diff_drive.so">
    <legacyMode>false</legacyMode>
    <alwaysOn>true</alwaysOn>
    <publishWheelTF>true</publishWheelTF>
    <publishTf>1</publishTf>
    <publishWheelJointState>true</publishWheelJointState>
    <updateRate>100.0</updateRate>
    <leftJoint>base_link_rear_left_wheel_joint</leftJoint>
    <leftJoint>base_link_front_left_wheel_joint</leftJoint>
    <rightJoint>base_link_rear_right_wheel_joint</rightJoint>
    <rightJoint>base_link_front_right_wheel_joint</rightJoint>
    <wheelAcceleration>1.0</wheelAcceleration>
    <torque>20</torque>
    <commandTopic>/nefive/cmd_vel</commandTopic>
    <odometryTopic>odom</odometryTopic>
    <odometryFrame>odom</odometryFrame>
    <robotBaseFrame>base_link</robotBaseFrame>
    <robotNamespace>nefive</robotNamespace>
  </plugin>
edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2021-09-21 13:07:10 -0500

Seen: 327 times

Last updated: Sep 21 '21