Skip to content

ROS package for limiting cmd_vel given a signal, e.g. from an obstacle detector

License

Notifications You must be signed in to change notification settings

ori-goals/cmd_vel_limiter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

cmd_vel_limiter

ROS package for limiting cmd_vel given thresholded distance from a laser scan.

Topics

Input

  • scan - the LaserScan topic to listen to to compare to a distance threshold
  • cmd_vel - the Twist topic to limit Output:
  • cmd_vel_limited- the Twist topic with the limit applied

Parameters

  • distance_threshold - The distance threshold to apply to the laser scan, default 1m.
  • scale_range - Within this range above distance_threshold the velocity is limited according to a linear scale between the input value and max_x_vel.
  • max_x_vel - The max x velocity to be allowed under the threshold, default 0.1 m/s.
  • limit_in_reverse - Whether the limit should be applied to negative x velocities, default false.
  • lower_bound_angle - lower bound of angular range in rads, default -PI/2
  • upper_bound_angle - upper bound of angular range in rads, default PI/2

Notes

The threshold is checked at the rate the laser topic publishes at. This is likely to yield frequent changes in threshold application when noise is present near the threshold value. The simplest approach to deal with this is to use topic_tools to create a throttled version of the laser topic, and use that in place of the scan input (via topic remapping).

Demo for Husky

If you are testing this with the default Husky launch files, the command velocity from teleop is sent to /joy_teleop/cmd_vel where it is read by a command multiplexor. I struggled a little to get the topics to line up using topic remapping, therefore I had to clone husky_control into my workspace and edit the config file for the multiplexor (rosed husky_control twist_mux.yaml) to replace topic : joy_teleop/cmd_vel with topic : joy_teleop/cmd_vel_limited. This makes the mutliplexor igore the original topic and listen to the limited one instead.

With this in place the limiter can run with the following command:

ROS_NAMESPACE=/joy_teleop rosrun cmd_vel_limiter laser_threshold _distance_threshold:=1.2 scan:=/scan

Note I push the node into the joy_teleop so that the command vel topics line up, but this requires that the relative topic name scan be made absolute.

To test that this is working, use rqt with a Plot visualisation plugin subscribing to /joy_teleop/cmd_vel_limited/linear/x. If you drive towards a wall you should see the x value drop to the limited value. If you want to see the commands sent to the robot you can add a second plot for /husky_velocity_controller/odom/twist/twist/linear/x.

RQT plot of limited x vel

About

ROS package for limiting cmd_vel given a signal, e.g. from an obstacle detector

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published