-
Notifications
You must be signed in to change notification settings - Fork 127
Collision Avoider
The collision avoider is called after the robot controller, but before the move command is published. Thus the collision avoider is able to modify the command of the controller to avoid the collision with an obstacle. By default, the robot is halted and does not change course.
In contrast to the supervisors there can only be one active collision avoider at a time.
Currently there are two collision avoiders implemented (CollisisonDetector) that simply stop the robot, if there is an obstacle right in front of it, by setting the velocity to zero. In general the collision avoider can be much more sophisticated and navigate the robot around the obstacle in some way.
Important: The supervisors are still working, while the collision avoider is changing the move commands. Therefore some collision avoiders may not be compatible with all supervisors. For example the DistanceToPath supervisor, that stops the robot, if it moves too far away from the path, can interrupt an collision avoider that tries to drive around an obstacle (and leaves the blocked path while doing so).
To implement a new collision avoider simply create a class that inherits from the abstract class CollisionAvoider
. It has only one method
avoid(MoveCommand* const cmd, const State &state)
cmd
is the move command that was generated by the robot controller. The collision avoider is allowed to modify this command, if (and only if) there is an obstacle ahead. The second parameter
state` contains additional information that might be necessary. Currently it contains the current path and the settings of the path follower. It can be extended as needed for new collision avoiders, but please make sure, that all data is passed as reference or pointer to avoid unnecessary copying of data.
There are multiple ways to select the active collision avoider:
- The
path_msgs/Goal
message contains a field calledfollower_options
. Within these options, the fieldcollision_avoider
can be set to the name of an existing collision avoider. - If the specified
FollowerOption
does not set a collision avoider, the parameterpath_follower/collision_avoider
is used. - If the parameter
path_follower/collision_avoider
is not set, a default avoider is used, depending on the selected robot controller. For example:AckermannPurepursuit
defaults toCollisionAvoiderAckermann
, whereasOmnidriveOrthexp
defaults toCollisionAvoiderOmnidrive
.