Class Activity

Nested Relationships

Nested Types

Class Documentation

class Activity

The Activity namespace class provides abstract interfaces that are shared between the Event and Phase namespace classes.

Public Types

using ConstDescriptionPtr = std::shared_ptr<const Description>
using ConstModelPtr = std::shared_ptr<const Model>
class Active

The interface for an active activity. This interface deals with backing up the current state, interrupting the activity, and cancelling or killing it.

Subclassed by rmf_task_sequence::Event::Active, rmf_task_sequence::Phase::Active

Public Types

using Backup = detail::Backup
using Resume = rmf_task::detail::Resume

The Resume class keeps track of when the phase is allowed to Resume. You can either call the Resume object’s operator() or let the object expire to tell the phase that it may resume.

Public Functions

virtual Backup backup() const = 0

Get a backup for this Phase.

virtual Resume interrupt(std::function<void()> task_is_interrupted) = 0

Tell this phase that it needs to be interrupted. An interruption means the robot may be commanded to do other tasks before this phase resumes.

Interruptions may occur to allow operators to take manual control of the robot, or to engage automatic behaviors in response to emergencies, e.g. fire alarms or code blues.

virtual void cancel() = 0

Tell the phase that it has been canceled. The behavior that follows a cancellation will vary between different phases, but generally it means that the robot should no longer try to complete its Task and should instead try to return itself to an unencumbered state as quickly as possible.

The phase may continue to perform some actions after being canceled.

The phase should continue to be tracked as normal. When its finished callback is triggered, the cancellation is complete.

virtual void kill() = 0

Kill this phase. The behavior that follows a kill will vary between different phases, but generally it means that the robot should be returned to a safe idle state as soon as possible, even if it remains encumbered by something related to this Task.

The phase should continue to be tracked as normal. When its finished callback is triggered, the killing is complete.

The kill() command supersedes the cancel() command. Calling cancel() after calling kill() will have no effect.

virtual ~Active() = default
class Description

Subclassed by rmf_task_sequence::Phase::Description, rmf_task_sequence::events::Bundle::Description, rmf_task_sequence::events::DropOff::Description, rmf_task_sequence::events::GoToPlace::Description, rmf_task_sequence::events::PerformAction::Description, rmf_task_sequence::events::PickUp::Description, rmf_task_sequence::events::Placeholder::Description, rmf_task_sequence::events::WaitFor::Description

Public Functions

virtual ConstModelPtr make_model(State invariant_initial_state, const Parameters &parameters) const = 0

Generate a Model for this Activity based on its description, parameters, and the invariants of its initial state.

Parameters:
  • invariant_initial_state[in] A partial state that represents the state components which will definitely be true when this Activity begins.

  • parameters[in] The parameters for the robot.

Returns:

a model based on the given start state and parameters.

virtual Header generate_header(const State &initial_state, const Parameters &parameters) const = 0

Generate human-friendly header information for this Activity.

Parameters:
  • initial_state[in] The expected initial state when the activity begins

  • parameters[in] Parameters of the robot during the Activity

virtual ~Description() = default
class Model

Subclassed by rmf_task_sequence::Activity::SequenceModel

Public Functions

virtual std::optional<Estimate> estimate_finish(State initial_state, rmf_traffic::Time earliest_arrival_time, const Constraints &constraints, const TravelEstimator &travel_estimator) const = 0

Estimate the state that the robot will have when the phase is finished.

Parameters:
  • initial_state[in] The expected initial state when the phase begins

  • constraints[in] Constraints on the robot during the phase

Param :

Returns:

an estimated state for the robot when the phase is finished.

virtual rmf_traffic::Duration invariant_duration() const = 0

Estimate the invariant component of the request’s duration.

virtual State invariant_finish_state() const = 0

Get the components of the finish state that this phase is guaranteed to result in once the phase is finished.

virtual ~Model() = default
class SequenceModel : public rmf_task_sequence::Activity::Model

Public Functions

virtual std::optional<rmf_task::Estimate> estimate_finish(State initial_state, rmf_traffic::Time earliest_arrival_time, const Constraints &constraints, const TravelEstimator &travel_estimator) const final

Estimate the state that the robot will have when the phase is finished.

Parameters:
  • initial_state[in] The expected initial state when the phase begins

  • constraints[in] Constraints on the robot during the phase

Param :

Returns:

an estimated state for the robot when the phase is finished.

virtual rmf_traffic::Duration invariant_duration() const final

Estimate the invariant component of the request’s duration.

virtual State invariant_finish_state() const final

Get the components of the finish state that this phase is guaranteed to result in once the phase is finished.

Public Static Functions

static ConstModelPtr make(const std::vector<ConstDescriptionPtr> &descriptions, State invariant_initial_state, const Parameters &parameters)

Make a SequenceModel by providing a vector of descriptions and the arguments that are given to Phase::Description::make_model(~).

Parameters:
  • descriptions[in] The Phase descriptions that are being modeled. The ordering of the descriptions may impact model outcomes. The order of the descriptions in the vector should reflect the actual order that the phases would occur in.

  • invariant_initial_state[in] A partial state that represents the state components which will definitely be true when this phase begins.

  • parameters[in] The parameters for the robot

Returns:

A Phase::Model implemented as a SequenceModel.