Class SimpleNegotiator

Nested Relationships

Nested Types

Inheritance Relationships

Base Type

Class Documentation

class SimpleNegotiator : public rmf_traffic::schedule::Negotiator

A simple implementation of the schedule::Negotiator class. It uses an agv::Planner to try to find a solution that fits on the negotiation table.

Public Functions

SimpleNegotiator(schedule::Participant::AssignIDPtr assign_id, Planner::Start start, Planner::Goal goal, Planner::Configuration planner_configuration, Options options = Options())

Constructor

Parameters:
  • assign_id[in] The ID assignment tool for the participant

  • start[in] The desired start for the plan.

  • goal[in] The desired goal for the plan.

  • planner_configuration[in] The configuration that will be used by the planner underlying this Negotiator.

  • options[in] Additional options that will be used by the Negotiator.

SimpleNegotiator(schedule::Participant::AssignIDPtr assign_id, std::vector<Planner::Start> starts, Planner::Goal goal, Planner::Configuration planner_configuration, Options options = Options())

Constructor

Parameters:
  • assign_id[in] The ID assignment tool for the participant

  • start[in] A set of starts that can be used.

  • goal[in] The desired goal for the plan.

  • planner_configuration[in] The configuration that will be used by the planner underlying this Negotiator.

  • options[in] Additional options that will be used by the Negotiator.

SimpleNegotiator(schedule::Participant::AssignIDPtr assign_id, std::vector<Planner::Start> starts, Planner::Goal goal, std::shared_ptr<const Planner> planner, Options options = Options())

Constructor

Parameters:
  • assign_id[in] The ID assignment tool for the participant

  • starts[in] A set of starts that can be used.

  • goal[in] The desired goal for the plan.

  • planner[in] The planner to use

  • options[in] Additional options that will be used by the negotiator

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.

class Debug

Public Static Functions

static SimpleNegotiator &enable_debug_print(SimpleNegotiator &negotiator)
class Options

A class to specify user-defined options for the Negotiator.

Public Types

using ApprovalCallback = std::function<Responder::UpdateVersion(rmf_traffic::agv::Plan)>

Public Functions

Options(ApprovalCallback approval_cb = nullptr, std::shared_ptr<const bool> interrupt_flag = nullptr, std::optional<double> maximum_cost_leeway = DefaultMaxCostLeeway, std::optional<std::size_t> maximum_alts = std::nullopt, Duration min_hold_time = Planner::Options::DefaultMinHoldingTime)

Constructor

Parameters:
  • approval_cb[in] The callback that will be triggered if the proposal is approved.

  • maximum_cost_leeway[in] The initial cost estimate for each planning attempt will be multiplied by this factor to determine the maximum cost estimate that will be allowed for a plan before giving up.

  • maximum_alts[in] The maximum number of alternatives to produce when rejecting a proposal from another negotiator.

  • min_hold_time[in] The minimum amount of time that the planner should spend waiting at holding points. See Planner::Options for more information.

Options &approval_callback(ApprovalCallback cb)

Set the approval callback.

Options &interrupt_flag(std::shared_ptr<const bool> flag)

Set the interrupt flag.

const std::shared_ptr<const bool> &interrupt_flag() const

Get the interrupt flag.

Options &maximum_cost_leeway(std::optional<double> leeway)

Set the maximum cost leeway.

std::optional<double> maximum_cost_leeway() const

Get the maximum cost leeway.

Options &minimum_cost_threshold(std::optional<double> cost)

Set the minimum cost threshold. When this and maximum_cost_leeway are both set, the maximum cost estimate will be chosen by std::max( minimum_cost_threshold, initial_cost_estimate * maximum_cost_leeway )

By default, this is DefaultMinCostThreshold.

std::optional<double> minimum_cost_threshold() const

Get the minimum cost threshold.

Options &maximum_cost_threshold(std::optional<double> cost)

Set the maximum cost threshold. When this is set, the cost will not be allowed to exceed it, even if the maximum cost leeway would allow it. By default, this is nullopt.

std::optional<double> maximum_cost_threshold() const

Get the maximum cost threshold.

Options &maximum_alternatives(rmf_utils::optional<std::size_t> num)
std::optional<std::size_t> maximum_alternatives() const
Options &minimum_holding_time(Duration holding_time)

Set the minimum amount of time to spend waiting at holding points.

Duration minimum_holding_time() const

Get the minimum amount of time to spend waiting at holding points.

Public Static Attributes

static constexpr double DefaultMaxCostLeeway = 1.5
static constexpr double DefaultMinCostThreshold = 30.0