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

What is the unit of the commands from the diff_drive_controller?

asked 2016-08-30 17:12:57 -0600

ErikHells gravatar image

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 flag offensive close merge delete

Comments

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?

hc gravatar image hc  ( 2018-03-30 11:20:55 -0600 )edit

1 Answer

Sort by » oldest newest most voted
2

answered 2016-08-30 18:02:40 -0600

ahendrix gravatar image

updated 2016-08-31 15:30:35 -0600

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.

edit flag offensive delete link more

Comments

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

ErikHells gravatar image ErikHells  ( 2016-08-31 13:23:01 -0600 )edit

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

ErikHells gravatar image ErikHells  ( 2016-09-01 01:45:30 -0600 )edit

Question Tools

2 followers

Stats

Asked: 2016-08-30 17:12:57 -0600

Seen: 1,914 times

Last updated: Aug 31 '16