Skip to content

diff_drive_controller

F Pucher edited this page Mar 12, 2020 · 17 revisions

Differential Drive Controller

The diff_drive_controller package for a differential drive mobile base. See also the corresponding controller's ROS wiki page and the C++ API documentation.

Overview

The controller works with a velocity twist (subscribes to cmd_vel of type geometry_msgs/Twist) from which it extracts the x component of the linear velocity and the z component of the angular velocity. Velocities on other components are ignored.

The data of the received velocity twist message is split and then sent on the two wheels of a differential drive wheel base using the hardware_interface::JointHandle::setCommand method of the hardware_interface::VelocityJointInterface. Odometry is computed from the feedback from the hardware (also via hardware_interface::VelocityJointInterface using pointers and not relying on ROS interfaces (e.g. topics, services, actions)), and published over the odom topic of type nav_msgs/Odometry.

Note that hardware_interface::VelocityJointInterface inherits from hardware_interface::CommandJointInterface which allows both reading joint state and commanding [effort|velocity|position]-based joints (see this answer).

Setup for Gazebo

Refer to this gazebo tutorial. Although this tutorial is helpful you should be aware that it was written for gazebo version 1.9 some parts are not up to date.

Setup using real Hardware

Requires you to write your own robot class inheriting from hardware_interface::RobotHW and implement the read() and write() methods. For an example see ros_control_boilerplate.

Clone this wiki locally