cmd_vel handle max speed of robot [closed]

asked 2020-12-17 12:02:05 -0600

PaddyCube gravatar image

updated 2021-01-06 12:57:18 -0600

Hi folks,

I'm new to ROS and have written a driver for my robot base. I also implemented a base controller which subscribe to cmd_vel and translate it to motor commands.

The max speed of my robot is 0.5m/s

Imagine some node sends a velocity command of 5m/s which is way beyond robots limit.

What is the common way do handle this?

  1. Ignore the command and stop robot as value is invalid
  2. Ignore speed and set to max possible speed

In case of 2, of I set cmd_vel x to 0.5 and add angular velocity of any value, the result will also be larger than max velocity of the wheel. Should I then ignore angular velocity and drive straight ahead with vmax or should I decrease the speed of one wheel to meet the angular velocity?

I'm not sure what is the common behavior.

EDIT: I follow mgruhler 's suggestion. If velocity command is faster than robots max speed, I'll continue to drive with max speed. Also I'll ensure to drive angular velocity with higher priority which means I'll slow down opposite wheel until it matches the given relation between left and right wheel.

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by PaddyCube
close date 2021-01-06 12:54:06.991798

Comments

2

I'd say this depends on your use case, actually. What I've seen most of the time is to do another sanity check about the magnitude of the values in the driver, and keep going with the maximum speed possible, if the command allows it. And always react to angular velocity! (Imagine, you've set up your remote control incorrect, sending to high values, are running straight ahead at a wall, you panic and try to steer but the robot doesn't react...)

Also, I've mostly seen drivers implement maximum velocities that are below the physical possible maximum, so that you have some slack there...

mgruhler gravatar image mgruhler  ( 2020-12-18 01:20:24 -0600 )edit

Thanks for your input. I wasn't sure if nav package or others gets confused if velocity is lower than expected. I'll give it a try by set it to max if set too high and also to reduce one wheel if angular and linear vel is set but too fast in total

PaddyCube gravatar image PaddyCube  ( 2020-12-19 01:43:21 -0600 )edit
1

They shouldn't be confused, but depending on the local planner they might stop driving if the expected/commanded velocity cannot be reached (though I don't know of any standard planners that do that...).

Anyways I suggest to properly set the min/max values for all planners.

If you consider this question answered, please close it. If not, please elaborate where you'd expect more input. Thank you.

mgruhler gravatar image mgruhler  ( 2021-01-04 04:27:00 -0600 )edit