cmd_vel handle max speed of robot [closed]
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?
- Ignore the command and stop robot as value is invalid
- 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.
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...
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
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.