Class Task

Nested Relationships

Nested Types

Inheritance Relationships

Base Type

  • public rmf_task::Task

Class Documentation

class Task : public rmf_task::Task

Public Types

using DescriptionPtr = std::shared_ptr<Description>
using ConstDescriptionPtr = std::shared_ptr<const Description>
using Update = std::function<void(Phase::ConstSnapshotPtr snapshot)>
using PhaseFinished = std::function<void(Phase::ConstCompletedPtr)>
using TaskFinished = std::function<void()>

Public Static Functions

static rmf_task::Activator::Activate<Description> make_activator(Phase::ConstActivatorPtr phase_activator, std::function<rmf_traffic::Time()> clock)

Make an activator for a phase sequence task. This activator can be given to the rmf_task::Activator class to activate phase sequence tasks from phase sequence descriptions.

Parameters:
  • phase_activator[in] A phase activator. It is recommended to fully initialize this phase activator (add all supported phases) before passing it to this function. The task activator will keep a reference to this phase activator, so modifying it while a task is activating a phase could cause data races and therefore undefined behavior.

  • clock[in] A callback that gives the current time when called.

static void add(rmf_task::Activator &activator, Phase::ConstActivatorPtr phase_activator, std::function<rmf_traffic::Time()> clock)

Add this task type to an Activator. This is an alternative to using make_activator(~).

Parameters:
  • activator[in] The task activator to add this task type to.

  • phase_activator[in] A phase activator. It is recommended to fully initialize this phase activator (add all supported phases) before passing it to this function. The task activator will keep a reference to this phase activator, so modifying it while a task is activating a phase could cause data races and therefore undefined behavior.

  • clock[in] A callback that gives the current time when called.

template<typename OtherDesc>
static void unfold(std::function<Description(const OtherDesc&)> unfold_description, rmf_task::Activator &activator, Phase::ConstActivatorPtr phase_activator, std::function<rmf_traffic::Time()> clock)

Give an initializer the ability to build a sequence task for some other task description.

This is useful when the described task is best implemented as a sequence of phases.

Parameters:
  • unfold_description[in] This will be used to unfold the other description into a task sequence Description.

  • activator[in] This activator will be given the ability to unfold and activate the OtherDesc type.

  • phase_activator[in] This phase activator will be used to activate the task

  • clock[in] A callback that gives the current time when called

class Builder

Public Functions

Builder()

Get the builder ready.

Builder &add_phase(Phase::ConstDescriptionPtr description, std::vector<Phase::ConstDescriptionPtr> cancellation_sequence)

Add a phase to the sequence.

Parameters:
  • description[in] A description of the phase

  • cancellation_sequence[in] This phase sequence will be run if the task is cancelled during this phase.

std::shared_ptr<Description> build(std::string category, std::string detail)

Generate a TaskDescription instance from the phases that have been given to the builder.

Parameters:
  • category[in] Task category information that will go into the Task::Tag

  • detail[in] Any detailed information that will go into the Task::Tag

class Description : public rmf_task::Task::Description

Public Functions

virtual Task::ConstModelPtr make_model(rmf_traffic::Time earliest_start_time, const Parameters &parameters) const final
virtual Info generate_info(const State &initial_state, const Parameters &parameters) const final
const std::string &category() const

Get the category for this task.

Description &category(std::string new_category)

Change the category for this task.

const std::string &detail() const

Get the details for this task.

Description &detail(std::string new_detail)

Change the details for this task.

Header generate_header(const State &initial_state, const Parameters &parameters) const