Skip to content

Collision Avoider

Sebastian Buck edited this page May 14, 2017 · 4 revisions

What is an 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).

Implement new Collision Avoiders

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 parameterstate` 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.

Selecting an active Collision Avoider

There are multiple ways to select the active collision avoider:

  1. The path_msgs/Goal message contains a field called follower_options. Within these options, the field collision_avoider can be set to the name of an existing collision avoider.
  2. If the specified FollowerOption does not set a collision avoider, the parameter path_follower/collision_avoider is used.
  3. 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 to CollisionAvoiderAckermann, whereas OmnidriveOrthexp defaults to CollisionAvoiderOmnidrive.
Clone this wiki locally