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

How to set up diff_drive_controller?

asked 2019-01-13 08:01:20 -0600

stevemartin gravatar image

I want to properly set the odometry for my 2W robot and decided to use diff_drive_controller for that. I got a bit confused by reading the wiki page. It says that the package subscribes to cmd_vel and publishes odometry based on that. Does it mean that I do not need any encoders to send?

Also, a quick question regarding the wheels. The package also asks for the wheel joints and I have descrbied them in my xacro file:

<joint name="wheel_left_joint" type="continuous">
    <parent link="base_link"/>
    <child link="wheel_left_link"/>
    <origin xyz="0.0 0.08 0.023" rpy="-1.57 0 0"/>
    <axis xyz="0 0 1"/>

  <link name="wheel_left_link">
      <origin xyz="0 0 0" rpy="1.57 0 0"/>
        <mesh filename="package://turtlebot3_description/meshes/wheels/left_tire.stl" scale="0.001 0.001 0.001"/>
      <material name="dark"/>

And if I use gazebo:

<gazebo reference="wheel_left_link">
    <fdir1>1 0 0</fdir1>

The wheels get their TF but how can I enable TF when I use a real robot? For some reason they are missing.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2019-01-14 02:41:30 -0600

juanlu gravatar image

"The package subscribes to cmd_vel and publishes odometry based on that"

From the wiki of diff drive controller:

Odometry is computed from the feedback from the hardware

that means the encoder feedback you have to be providing through the Hardware Interfaces of ROS Control. Not the cmd vel

"How can I enable TF when I use a real robot?"

Using the robot state publisher node. You can add this line to your hardware launch file to use it:

  <node name="robot_state_publisher" pkg="robot_state_publisher" type="robot_state_publisher" />
edit flag offensive delete link more


@juanlu I do have static state publisher and I also tried to use robot_state_publisher but it does not produce tf to the wheels for some reason

stevemartin gravatar image stevemartin  ( 2019-01-14 13:57:04 -0600 )edit

Question Tools


Asked: 2019-01-13 08:01:20 -0600

Seen: 574 times

Last updated: Jan 14 '19