Class ScheduleRouteValidator

Inheritance Relationships

Base Type

Class Documentation

class ScheduleRouteValidator : public rmf_traffic::agv::RouteValidator

Public Functions

ScheduleRouteValidator(const schedule::Viewer &viewer, schedule::ParticipantId participant_id, Profile profile)

Constructor

Warning

You are expected to maintain the lifetime of the schedule viewer for as long as this ScheduleRouteValidator instance is alive. This object will only retain a reference to the viewer, not a copy of it.

Parameters:
  • viewer[in] The schedule viewer which will be used to check for conflicts

  • participant[in] The ID of the participant whose route is being validated. Any routes for this participant on the schedule will be ignored while validating.

  • profile[in] The profile for the participant. This is not inferred from the viewer because the viewer might not be synced with the schedule by the time this validator is being used.

ScheduleRouteValidator(std::shared_ptr<const schedule::Viewer> viewer, schedule::ParticipantId participant_id, Profile profile)

Constructor

This constructor will use the profile given to it for the participant that is being planned for. This is safe to use, even if the participant is not registered in the schedule yet.

Parameters:
  • viewer[in] The schedule viewer which will be used ot check for conflicts. The reference to the viewer will be kept alive.

  • participant_id[in] The ID for the participant that is being validated.

  • profile[in] The profile for the participant.

ScheduleRouteValidator &schedule_viewer(const schedule::Viewer &viewer)

Change the schedule viewer to use for planning.

Warning

The Options instance will store a reference to the viewer; it will not store a copy. Therefore you are responsible for keeping the schedule viewer alive while this Options class is being used.

const schedule::Viewer &schedule_viewer() const

Get a const reference to the schedule viewer that will be used for planning. It is undefined behavior to call this function is called after the schedule viewer has been destroyed.

ScheduleRouteValidator &participant(schedule::ParticipantId p)

Set the ID of the participant that is being validated.

schedule::ParticipantId participant() const

Get the ID of the participant that is being validated.

virtual std::optional<Conflict> find_conflict(const Route &route) const final

If the specified route has a conflict with another participant, this will return the participant ID for the first conflict that gets identified. Otherwise it will return a nullopt.

Parameters:

route[in] The route that is being checked.

virtual std::unique_ptr<RouteValidator> clone() const final

Create a clone of the underlying RouteValidator object.

Public Static Functions

template<typename ...Args>
static inline rmf_utils::clone_ptr<ScheduleRouteValidator> make(Args&&... args)

Make the ScheduleRouteValidator as a clone_ptr.