Class StubbornNegotiator

Inheritance Relationships

Base Type

Class Documentation

class StubbornNegotiator : public rmf_traffic::schedule::Negotiator

A StubbornNegotiator will only accept plans that accommodate the current itinerary of the

Public Types

using UpdateVersion = rmf_utils::optional<ItineraryVersion>

Public Functions

StubbornNegotiator(const Participant &participant)

Constructor

StubbornNegotiator(participant).respond(table_view, responder);

Note

We take a const-reference to the Participant with the expectation that the Participant instance will outlive this StubbornNegotiator instance. The StubbornNegotiator costs very little to construct, so it is okay to use a pattern like

Parameters:

participant[in] The Participant who wants to be stubborn.

StubbornNegotiator(std::shared_ptr<const Participant> participant)

Owning Constructor

The StubbornNegotiator instance will now hold a shared reference to the participant to ensure it maintains its lifetime. This constructor should be used in cases where the StubbornNegotiator instance has a prolonged lifecycle.

Parameters:

participant[in] The Participant who wants to be stubborn.

StubbornNegotiator &acceptable_waits(std::vector<Duration> wait_times, std::function<UpdateVersion(Duration wait_time)> approval_cb = nullptr)

Add a set of acceptable wait times.

Parameters:
  • wait_times[in] A list of the wait times that would be accepted for negotiation

  • approval_cb[in] A callback that will be triggered when the negotiator decides that you need to wait for another participant. The callback will receive the chosen wait duration, and is expected to return the schedule version that will incorporate the given wait time.

StubbornNegotiator &additional_margins(std::vector<rmf_traffic::Duration> margins)

Add some timing margins that will be put into the negotiation submission. This effectively asks other robots to back off somewhat.

Parameters:

margins[in] The margins to put into the proposal.

virtual void respond(const schedule::Negotiation::Table::ViewerPtr &table_viewer, const ResponderPtr &responder) final

Have the Negotiator respond to an attempt to negotiate.

Parameters:
  • table[in] The Negotiation::Table that is being used for the negotiation.

  • responder[in] The Responder instance that the negotiator should use when a response is ready.

  • interrupt_flag[in] A pointer to a flag that can be used to interrupt the negotiator if it has been running for too long. If the planner should run indefinitely, then pass a nullptr.