Ask Your Question
1

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

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

And if I use gazebo:

<gazebo reference="wheel_left_link">
    <mu1>0.1</mu1>
    <mu2>0.1</mu2>
    <kp>500000.0</kp>
    <kd>10.0</kd>
    <minDepth>0.001</minDepth>
    <maxVel>0.1</maxVel>
    <fdir1>1 0 0</fdir1>
    <material>Gazebo/FlatBlack</material>
  </gazebo>

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
0

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

Comments

@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 imagestevemartin ( 2019-01-14 13:57:04 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

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

Seen: 147 times

Last updated: Jan 14