Class Moderator

Nested Relationships

Nested Types

Inheritance Relationships

Base Type

Class Documentation

class Moderator : public rmf_traffic::blockade::Writer

Public Functions

virtual void set(ParticipantId participant_id, ReservationId reservation_id, const Reservation &reservation) final

Set the path reservation of a participant.

If reservation_id is (modularly) less than or equal to the last reservation_id value given for this participant_id, then this function call will be ignored.

Any previous path reservation will be considered canceled.

virtual void ready(ParticipantId participant_id, ReservationId reservation_id, CheckpointId checkpoint) final

Indicate when a participant is ready at a checkpoint.

If reservation_id is not equal to the last reservation_id value given to set() for this participant_id, then this function call will be ignored.

virtual void release(ParticipantId participant_id, ReservationId reservation_id, CheckpointId checkpoint) final

Release a checkpoint (and all checkpoints that come after it) from ready status if the participant has not departed from it yet.

virtual void reached(ParticipantId participant_id, ReservationId reservation_id, CheckpointId checkpoint) final

Indicate when a participant has reached a checkpoint.

If reservation_id is not equal to the last reservation_id value given to set() for this participant_id, then this function call will be ignored.

virtual void cancel(ParticipantId participant_id, ReservationId reservation_id) final

Indicate that a path reservation is canceled if reservation_id is (modularly) greater than or equal to the last reservation_id value given to set() for this participant_id.

virtual void cancel(ParticipantId participant_id) final

Indicate that all path reservations for this participant_id are canceled.

Moderator(std::function<void(std::string)> info_logger = nullptr, std::function<void(std::string)> debug_logger = nullptr, double min_conflict_angle = 5.0 * M_PI / 180.0)

Default constructor

Parameters:
  • info_logger[in] Provide a callback for logging informational updates about changes in the blockades, e.g. when a new path arrives, when a checkpoint is reached, or when one is ready.

  • debug_logger[in] Provide a callback for logging debugging information, e.g. which constraints are blocking a participant from advancing.

  • min_conflict_angle[in] If the angle between two path segments is greater than this value (radians), then the segments are considered to be in conflict. The default value for this parameter is 5-degrees. Something larger than 0 is recommended to help deal with numerical precision concerns.

double minimum_conflict_angle() const

Get the minimum angle that will trigger a conflict.

Moderator &minimum_conflict_angle(double new_value)

Set the minimum angle that will trigger a conflict.

Moderator &info_logger(std::function<void(std::string)> info)

Set the information logger for this Moderator. Pass in a nullptr to disable any information logging.

Moderator &debug_logger(std::function<void(std::string)> debug)

Set the debug logger for this Moderator. Pass in a nullptr to disable any debug logging.

const Assignments &assignments() const

Get the current set of assignments.

const std::unordered_map<ParticipantId, Status> &statuses() const

Get the current known statuses of each participant.

bool has_gridlock() const

Return true if the system is experiencing a gridlock.

class Assignments

This class indicates the range of each reservation that the blockade moderator has assigned as active. Each robot is allowed to move at will from the begin checkpoint to the end checkpoint in the range assigned for it.

Public Functions

std::size_t version() const

Get the version of the current assignment sets. The version number will increase by at least 1 each time the assignments change. This can be used to identify when new assignment notifications are necessary.

const std::unordered_map<ParticipantId, ReservedRange> &ranges() const

Get the ranges that are assigned to each participant.