ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | Q&A answers.ros.org

# What is the unit of the commands from the diff_drive_controller?

Hi,

I'm trying to get a differential drive robot running with ros_control and the diff_drive_controller. I have a working setup except for knowing exactly what the commands written to the command variable in the diff_drive_controller actually means (the ones I'm supposed to convert to motor commands in my RobotHW-instance). I've gone through the code for the diff_drive_controller to actually understand what's happening and I've tried to trace down how a vel_cmd is being translated to something else in the controller.

This is the move robot code from the diff_drive_controller:

// Compute wheels velocities:
const double vel_left  = (curr_cmd.lin - curr_cmd.ang * ws / 2.0)/wr;
const double vel_right = (curr_cmd.lin + curr_cmd.ang * ws / 2.0)/wr;


My configuration file for the controller specifies the wheel separation to 0.341 meters and the wheel radius to 0.05 meters. When I'm sending a cmd_vel with a linear velocity of 0.5m/s and no angular velocity (hence, the robot should move straight ahead..) the calculations will translate to:

vel_left = (0.5 - 0.0 * 0.341 / 2.0) / 0.05; // Equals 10
vel_right = (0.5 + 0.0 * 0.341 / 2.0) 0.05; // Equals 10


So what unit is the value 10 in? S.I m/s? Can't be! I want to go with 0.5m/s straight ahead.

Trying to wrap my head around this but right now I'm just feeling stupid.. x-(

Thanks!

edit retag close merge delete

Could you please tell me how you interfaced diff_drive_controller with ros_control? What is the output of diff_drive_controller that is used by the ros_control?

Sort by » oldest newest most voted It's linear speed (m/s) divided by radius (m), so final units are 1/s.

EDIT

I think this is best interpreted as radians per second.

more

Tnks! So in my case with a return value of 10, the wheels should turn 10 times per second? That's 3.14 m/s (0.1pi10). Far from the 0.5 m/s I had as an input. It works by just multiplying with the wheel radius on the RobotHW-side again but the division by wheel radius in diff control is unnecessary

Now, that makes perfectly sense. Of course! Thank you! :)