Turtlebot3 and diff_drive_controller

asked 2020-03-23 13:53:21 -0500

mattewthep gravatar image

Hi, I'm learning ROS and I need to control a turtebot3 in a gazebo simulation launched with roslaunch turtlebot3_gazebo turtlebot3_world.launch. The problem is I need to do that using the diff_drive package, any help or any tutorial?

edit retag flag offensive close merge delete


Hi mattewthep,

The turtlebot, as any robot in Gazebo, needs to be described with URDF, generally speaking, using Xacro. In the launch file this line is loading the Robot description in the ROS parameter server and this one is lauching a script to spawn the robot in a Gazebo world.

If you look at any of the Xacro files you will see that they are already loading a Diff drive plugin to control the robot base.This plugin is reading from the /cmd_vel topic to command twist msgs.

Weasfas gravatar image Weasfas  ( 2020-03-24 07:54:34 -0500 )edit

Thank you, but in order to control the two turtlebot wheels separately is it possible to send the message to /cmd_vel, catched by driff_drive_controller that split it into two messages for the two wheels and then let the turtlebot node subscribe to these two topic and hence receive the messagese for both the wheels but separately?

mattewthep gravatar image mattewthep  ( 2020-03-24 11:18:25 -0500 )edit

Hi @mattewthep,

Why you would want to do that?

The plugin itself is already implementing the diff drive kinematics, thus when you publish a twist on the topic the plugin will apply the kinematic equations to split the command between the two robot wheels. If you want to have two control topics, one for each wheel you may need to implement your own controllers since in the driff_drive_controller the command is used for both wheels at the same time programatically.

Weasfas gravatar image Weasfas  ( 2020-03-24 13:01:49 -0500 )edit