Class Planner::Options

Nested Relationships

This class is a nested type of Class Planner.

Class Documentation

class Options

The Options class contains planning parameters that can change between each planning attempt.

Public Functions

Options(rmf_utils::clone_ptr<RouteValidator> validator, Duration min_hold_time = DefaultMinHoldingTime, std::shared_ptr<const std::atomic_bool> interrupt_flag = nullptr, std::optional<double> maximum_cost_estimate = std::nullopt, std::optional<std::size_t> saturation_limit = std::nullopt)

Constructor

Parameters:
  • validator[in] A validator to check the validity of the planner’s branching options.

  • min_hold_time[in] The minimum amount of time that the planner should spend waiting at holding points. Smaller values will make the plan more aggressive about being time-optimal, but the plan may take longer to produce. Larger values will add some latency to the execution of the plan as the robot may wait at a holding point longer than necessary, but the plan will usually be generated more quickly.

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

  • maximum_cost_estimate[in] A cap on how high the best possible solution’s cost can be. If the cost of the best possible solution ever exceeds this value, then the planner will interrupt itself, no matter what the state of the interrupt_flag is. Set this to nullopt to specify that there should not be a cap.

  • saturation_limit[in] A cap on how many search nodes the planner is allowed to produce.

Options(rmf_utils::clone_ptr<RouteValidator> validator, Duration min_hold_time, std::function<bool()> interrupter, std::optional<double> maximum_cost_estimate = std::nullopt, std::optional<std::size_t> saturation_limit = std::nullopt)

Constructor

Parameters:
  • validator[in] A validator to check the validity of the planner’s branching options.

  • validator[in] A validator to check the validity of the planner’s branching options.

  • min_hold_time[in] The minimum amount of time that the planner should spend waiting at holding points. Smaller values will make the plan more aggressive about being time-optimal, but the plan may take longer to produce. Larger values will add some latency to the execution of the plan as the robot may wait at a holding point longer than necessary, but the plan will usually be generated more quickly.

  • interrupter[in] A function that can determine whether the planning should be interrupted. This is an alternative to using the interrupt_flag.

  • maximum_cost_estimate[in] A cap on how high the best possible solution’s cost can be. If the cost of the best possible solution ever exceeds this value, then the planner will interrupt itself, no matter what the state of the interrupt_flag is. Set this to nullopt to specify that there should not be a cap.

  • saturation_limit[in] A cap on how many search nodes the planner is allowed to produce.

Options &validator(rmf_utils::clone_ptr<RouteValidator> v)

Set the route validator.

const rmf_utils::clone_ptr<RouteValidator> &validator() const

Get the route validator.

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.

Options &interrupter(std::function<bool()> cb)

Set an interrupter callback that can indicate to the planner if it should stop trying to plan.

Warning

Using this function will replace anything that was given to interrupt_flag, and it will nullify the interrupt_flag() field.

const std::function<bool()> &interrupter() const

Get the interrupter that will be used in these Options.

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

Set an interrupt flag to stop this planner if it has run for too long.

Warning

Using this function will replace anything that was given to interrupter.

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

Get the interrupt flag that will stop this planner if it has run for too long.

Options &maximum_cost_estimate(std::optional<double> value)

Set the maximum cost estimate that the planner should allow. If the cost estimate of the best possible plan that the planner could produce ever exceeds this value, the planner will pause itself (but this will not be considered an interruption).

std::optional<double> maximum_cost_estimate() const

Get the maximum cost estimate that the planner will allow.

Options &saturation_limit(std::optional<std::size_t> value)

Set the saturation limit for the planner. If the planner produces more search nodes than this limit, then the planning will stop.

std::optional<std::size_t> saturation_limit() const

Get the saturation limit.

Options &dependency_window(std::optional<Duration> value)

Set the dependency window for generated plans. Any potential conflicts with the generated plan that happen within this window will be added as dependencies to the plan waypoints. If set to a nullopt, the plan will not have any dependencies.

std::optional<Duration> dependency_window() const

Dependency window for the planner.

Options &dependency_resolution(Duration value)

Set the dependency resolution for generated plans. To check for dependencies, the planner will step the generated routes back in time by this value and check for conflicts. Detected conflicts get added to the list of dependencies. This backstepping happens until dependency_window is reached. If dependency_window is nullopt, this value will not be used.

Duration dependency_resolution() const

Get the dependency resolution for generated plans.

Public Static Attributes

static constexpr Duration DefaultMinHoldingTime = std::chrono::seconds(1)