Class Bundle

Nested Relationships

Nested Types

Inheritance Relationships

Base Type

Class Documentation

class Bundle : public rmf_task_sequence::Event

Public Types

enum Type

Values:

enumerator Sequence

The bundle’s dependencies will be executed one-by-one in sequence. The bundle will finished when the last of its events reaches a finished status.

template<typename OtherDesc>
using UnfoldDescription = std::function<Bundle::Description(const OtherDesc&)>

Given an event description, return a vector of other event descriptions.

using UpdateFn = std::function<void()>
using DependencySpecifiers = std::vector<std::function<StandbyPtr(UpdateFn)>>

Public Static Functions

static void add(const Event::InitializerPtr &initializer)

Give an initializer the ability to initialize event bundles

Parameters:

initializer[in] The Initializer that should be used to initialize other events, and also will be given the ability to initialize event sequences. This is equivalent to the overload of this function, but where add_to and initialize_from are the same initializer.

static void add(Event::Initializer &add_to, const Event::ConstInitializerPtr &initialize_from)

Give an initializer the ability to initialize event sequences

Parameters:
  • add_to[in] This Initializer will be given the ability to initialize event sequences

  • initialize_from[in] This Initializer will be used by the Bundle to initialize the events that it depends on. This may be a different initializer than the one that the event sequence is added to.

template<typename OtherDesc>
static void unfold(const UnfoldDescription<OtherDesc> &unfold_description, Event::Initializer &add_to, const Event::ConstInitializerPtr &initialize_from)

Give an initializer the ability to initialize an event bundle for some other event description. This is useful when you want a certain event to be implemented as a bundle of other events without requiring users to explicitly specify an event bundle.

This is also useful if there is an event type that is safe to initialize when bundled in a specific way with other events but should not be run on its own. You can keep the Description type of that event private to the downstream user but load it into the initializer for this bundle.

Parameters:
  • unfold_description[in] This will be used to produce the bundle to create

  • add_to[in] This Initializer will be given the ability to initialize this type of event bundle.

  • initialize_from[in] This Initializer will be used to initialize the dependencies of this Bundle.

static StandbyPtr standby(Type type, const DependencySpecifiers &dependencies, rmf_task::events::SimpleEventStatePtr state, std::function<void()> update)

Create a Bundle on standby by directly providing the standby dependencies and the state object.

Parameters:
  • type[in] The type of bundle to activate

  • dependencies[in] Factories for the dependencies that are being bundled together. Each factory should take in an update callback and then give back the StandbyPtr for the dependency.

  • state[in] The state to modify as the bundle progresses. This class will not modify the name or detail of the state.

  • update[in] The callback that will be triggered when the bundle has an update.

static Event::StandbyPtr initiate(const Event::Initializer &initializer, const Event::AssignIDPtr &id, const std::function<rmf_task::State()> &get_state, const ConstParametersPtr &parameters, const Bundle::Description &description, std::function<void()> update)

Initiate a Bundle in Standby mode. For advanced use only.

Warning

It is not recommended to use this function directly. You should consider using add(~) or unfold(~) with an initializer instead.

static Event::ActivePtr restore(const Event::Initializer &initializer, const Event::AssignIDPtr &id, const std::function<rmf_task::State()> &get_state, const ConstParametersPtr &parameters, const Bundle::Description &description, const std::string &backup, std::function<void()> update, std::function<void()> checkpoint, std::function<void()> finished)

Restore a Bundle into Active mode. For advanced use only.

Warning

It is not recommended to use this function directly. You should consider using add(~) or unfold(~) with an initializer instead.

class Description : public rmf_task_sequence::Activity::Description

Public Types

using Dependencies = std::vector<Event::ConstDescriptionPtr>

Public Functions

Description(Dependencies dependencies, Type type, std::optional<std::string> category = std::nullopt, std::optional<std::string> detail = std::nullopt)

Construct a Sequence Description

Parameters:
  • dependencies[in] These are the events that the bundle will depend on.

  • type[in] The type of the bundle, which determines its behavior.

  • category[in] Optionally give a category to this bundle. If left unspecified, the category will be based on its type.

  • detail[in] Optionally give some detail to this bundle. If left unspecified, the detail will simply aggregate the details of the dependencies.

const Dependencies &dependencies() const

Get the elements of the sequence.

Description &dependencies(Dependencies new_elements)

Change the elements of the sequence.

Type type() const

Get the type of bundle this is.

Description &type(Type new_type)

Change the type of bundle that this is.

const std::optional<std::string> &category() const

Get the category settings.

Description &category(std::optional<std::string> new_category)

Change the category settings.

const std::optional<std::string> &detail() const

Get the detail settings.

Description &detail(std::optional<std::string> new_detail)

Change the detail settings.

virtual Activity::ConstModelPtr make_model(rmf_task::State invariant_initial_state, const Parameters &parameters) const final

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 rmf_task::State &initial_state, const Parameters &parameters) const final

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