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

diff_drive_controller odometry issues

asked 2019-08-13 11:11:31 -0600

kurshakuz gravatar image

Hello everyone!

I have following issue with diff_drive_controller I really don't know how to solve. I have an sdf defined robot, which uses odometry published by the controller defined as follows:

<plugin name="differential_drive_controller" filename="libgazebo_ros_diff_drive.so">
     <robotNamespace />
     <alwaysOn>true</alwaysOn>
     <updateRate>10</updateRate>
     <legacyMode>true</legacyMode>
     <leftJoint>right_wheel_joint</leftJoint>
     <rightJoint>left_wheel_joint</rightJoint>
     <wheelSeparation>0.5380</wheelSeparation>
     <wheelDiameter>0.2410</wheelDiameter>
     <torque>20</torque>
     <commandTopic>cmd_vel</commandTopic>
     <odometryTopic>odom</odometryTopic>
     <odometryFrame>odom</odometryFrame>
     <robotBaseFrame>chassis</robotBaseFrame>
     <publishWheelTF>false</publishWheelTF>
     <publishWheelJointState>false</publishWheelJointState>
     <rosDebugLevel>na</rosDebugLevel>
     <wheelAcceleration>0</wheelAcceleration>
     <wheelTorque>5</wheelTorque>
     <odometrySource>world</odometrySource>
     <publishTf>1</publishTf>
  </plugin>

The problem is that when robot starts navigating from the origin of the world, everything is fine, but when I slightly shift it away, the robot's odometry jumps and shows incorrect values. Video of shifted and properly placed robots is attached below: https://www.youtube.com/watch?v=vvPnN...

I really need the robot to be placed somewhere not in the origin. I would really appreciate any help and suggestions.

Here's the full .sdf configuration of my robot, if necessary:

<?xml version="1.0" encoding="UTF-8"?>

<sdf version="1.4"> <model name="amazon_warehouse_robot"> <static>false</static>

  <link name="chassis">
     <pose>3 0 .05 0 0 0</pose>
     <inertial>
        <inertia>
           <ixx>0</ixx>
           <iyy>0</iyy>
           <izz>0</izz>
           <ixy>0</ixy>
           <ixz>0</ixz>
           <iyz>0</iyz>
        </inertia>
        <mass>4.5</mass>
     </inertial>
     <collision name="collision">
        <geometry>
           <box>
              <size>.9 .675 .15</size>
           </box>
        </geometry>
     </collision>
     <visual name="visual">
        <geometry>
           <box>
              <size>.9 .675 .15</size>
           </box>
        </geometry>
        <material>
           <ambient>1 0.5 0 1</ambient>
           <diffuse>1 0.5 0 1</diffuse>
           <specular>0.1 0.1 0.1 1</specular>
           <emissive>0 0 0 0</emissive>
        </material>
     </visual>
     <collision name="caster_collision_front">
        <pose>0.40 0 -0.05 0 0 0</pose>
        <geometry>
           <sphere>
              <radius>.05</radius>
           </sphere>
        </geometry>
        <surface>
           <friction>
              <ode>
                 <mu>0.0</mu>
                 <mu2>0.0</mu2>
                 <slip1>0.0</slip1>
                 <slip2>0.0</slip2>
              </ode>
           </friction>
        </surface>
     </collision>
     <visual name="caster_visual_front">
        <pose>0.40 0 -0.05 0 0 0</pose>
        <geometry>
           <sphere>
              <radius>.05</radius>
           </sphere>
        </geometry>
     </visual>
     <collision name="caster_collision_back">
        <pose>-0.40 0 -0.05 0 0 0</pose>
        <geometry>
           <sphere>
              <radius>.05</radius>
           </sphere>
        </geometry>
        <surface>
           <friction>
              <ode>
                 <mu>0.0</mu>
                 <mu2>0.0</mu2>
                 <slip1>0.0</slip1>
                 <slip2>0.0</slip2>
              </ode>
           </friction>
        </surface>
     </collision>
     <visual name="caster_visual_back">
        <pose>-0.40 0 -0.05 0 0 0</pose>
        <geometry>
           <sphere>
              <radius>.05</radius>
           </sphere>
        </geometry>
     </visual>
  </link>

  <link name="left_wheel">
     <pose>3 0.30 0.05 0 1.5707 1.5707</pose>
     <collision name="collision">
        <geometry>
           <cylinder>
              <radius>.1</radius>
              <length>.05</length>
           </cylinder>
        </geometry>
     </collision>
     <visual name="visual">
        <geometry>
           <cylinder>
              <radius>.1</radius>
              <length>.05</length>
           </cylinder>
        </geometry>
     </visual>
  </link>

  <link name="right_wheel">
     <pose>3 -0.30 0.05 0 1.5707 1.5707</pose>
     <collision name="collision">
        <geometry>
           <cylinder>
              <radius>.1</radius>
              <length>.05</length> ...
(more)
edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
1

answered 2019-08-14 01:59:56 -0600

You are using a static transform between /map and /amazon_warehouse_robot/odom and "world" as the odometrySource for the libgazebo_ros_diff_drive plugin.

Using "world" as the source for the odometry of your simulated robot will give you the perfect location of the robot in the simulated world. So when you set the static transform between /map and /amazon_warehouse_robot/odom to be 0 0 0 0 0 0 everything works. But if you shift the static transform, then nothing makes sense any more.

If you want to shit the starting pose of the robot you should do it by moving the robot inside the gazebo world, not by modifying the static transform.

Any way, in the Real World™ this will not work because the odometry is far (faaaaar, faaaaaaaaaaar, very faaaaaaaaaaaaaaaaar) from perfect. You should take a look at amcl to handle the transform between /map and /amazon_warehouse_robot/odom instead of using a static transform.

edit flag offensive delete link more

Comments

Hi, thanks for these comments. I have actually tried spawning shifted robot with static transform between /amp and /amazon_warehouse_robot/odom at 0 0 0 0 0 0, but the problem was that the rViz was showing location of the robot at the origin while it was not the case. Additionally, I have previously used AMCL, and performance was almost the same. The configurations for it were as follows:

kurshakuz gravatar image kurshakuz  ( 2019-08-14 02:25:11 -0600 )edit

<arg name="use_map_topic" default="true"/> <arg name="scan_topic" default="amazon_warehouse_robot/laser/scan"/> <arg name="odom_frame_id" default="amazon_warehouse_robot/odom"/> <arg name="base_frame_id" default="amazon_warehouse_robot/base"/> <arg name="global_frame_id" default="map"/>

  <node pkg="amcl" type="amcl" name="amcl"  output="screen">
    <param name="use_map_topic" value="$(arg use_map_topic)"/>
    <param name="odom_model_type" value="diff"/>
    <param name="gui_publish_rate" value="10.0"/>
    <param name="laser_max_beams" value="60"/>
    <param name="laser_max_range" value="10.0"/>
    <param name="odom_frame_id" value="$(arg odom_frame_id)"/>
    <param name="base_frame_id" value="$(arg base_frame_id)"/>
    <remap from="scan" to="$(arg scan_topic)"/>
    <param name="global_frame_id" value="$(arg global_frame_id)"/>
  </node>
kurshakuz gravatar image kurshakuz  ( 2019-08-14 02:25:37 -0600 )edit

Question Tools

2 followers

Stats

Asked: 2019-08-13 11:11:31 -0600

Seen: 784 times

Last updated: Aug 14 '19