Skip to main content

PlanMTCTask Class

Takes a shared pointer to an existing MTC Task object via an input data port, plans the Task, and sets the solution with the lowest overall cost as an output data port. A service client sends over all the solutions to the MTC Solution Manager node which can be used for debugging. More...

Declaration

class moveit_pro::behaviors::PlanMTCTask { ... }

Included Headers

#include <plan_mtc_task.hpp>

Base class

classAsyncBehaviorBase

A base class for behaviors which need to asynchronously run a function that might take a long time to complete. More...

Public Constructors Index

PlanMTCTask (const std::string &name, const BT::NodeConfiguration &config, const std::shared_ptr< BehaviorContext > &shared_resources)

Private Member Functions Index

tl::expected< bool, std::string >doWork () override

Plan the task and set the lowest-cost solution to the "solution" output data port. Also, send the list of solutions to the MTC solution manager node for debugging purposes. More...

tl::expected< void, std::string >doHalt () override

Halts an in-progress planning process by preempting the stored MTC task, if one is stored. More...

std::shared_future< tl::expected< bool, std::string > > &getFuture () override

Classes derived from AsyncBehaviorBase must implement getFuture() so that it returns a shared_future class member. More...

Private Member Attributes Index

moveit_pro::task_constructor::TaskPtrtask_

Stores the MTC task so it can be asynchronously preempted. More...

std::shared_ptr< rclcpp::Client< StoreUidMap > >store_uid_map_client_

Service Client to send map between behavior ID and MTC task ID to be stored in MTC Solution Manager node. More...

std::shared_future< tl::expected< bool, std::string > >future_

Classes derived from AsyncBehaviorBase must have this shared_future as a class member. More...

uint16_tbehavior_uid_

Public Static Functions Index

static BT::PortsListprovidedPorts ()
static BT::KeyValueVectormetadata ()

Description

Takes a shared pointer to an existing MTC Task object via an input data port, plans the Task, and sets the solution with the lowest overall cost as an output data port. A service client sends over all the solutions to the MTC Solution Manager node which can be used for debugging.

Data Port NamePort TypeObject Type
taskInputstd::shared_ptr<moveit_pro::task_constructor::Task>
max_solutionsInputstd::size_t (0 to search all solutions)
solutionOutputmoveit_task_constructor_msgs::msg::Solution

Definition at line 31 of file plan_mtc_task.hpp.

Public Constructors

PlanMTCTask()

moveit_pro::behaviors::PlanMTCTask::PlanMTCTask (const std::string & name, const BT::NodeConfiguration & config, const std::shared_ptr< BehaviorContext > & shared_resources)

Declaration at line 34 of file plan_mtc_task.hpp, definition at line 74 of file plan_mtc_task.cpp.

Private Member Functions

doHalt()

tl::expected< void, std::string > moveit_pro::behaviors::PlanMTCTask::doHalt ()
virtual

Halts an in-progress planning process by preempting the stored MTC task, if one is stored.

Returns

Always succeeds; preempting is a no-op when no task is stored, and cannot fail otherwise.

Declaration at line 66 of file plan_mtc_task.hpp, definition at line 201 of file plan_mtc_task.cpp.

doWork()

tl::expected< bool, std::string > moveit_pro::behaviors::PlanMTCTask::doWork ()
virtual

Plan the task and set the lowest-cost solution to the "solution" output data port. Also, send the list of solutions to the MTC solution manager node for debugging purposes.

This function calls moveit_pro::task_constructor::Task::plan() on the MTC task stored in the task_ class member variable.

  • If the task fails to initialize, for example if there was an error in the composition of the task's stages, we report a failure reason and set process_status_ to BT::NodeStatus::FAILURE.
  • If the task correctly initializes but fails to plan, for example if no solution exists that satisfies all the goals and constraints within the tasks' stages, we report a failure reason and set process_status_ to BT::NodeStatus::FAILURE.
  • If we successfully find one or more solutions to the task, we set the value of the "solution" output data port to the lowest-cost solution that was found and set process_status_ to BT::NodeStatus::RUNNING.

A function to send all MTC solutions to the MTC Solution Manager node is invoked at the end.

Declaration at line 60 of file plan_mtc_task.hpp, definition at line 106 of file plan_mtc_task.cpp.

getFuture()

std::shared_future< tl::expected< bool, std::string > > & moveit_pro::behaviors::PlanMTCTask::getFuture ()
inline virtual

Classes derived from AsyncBehaviorBase must implement getFuture() so that it returns a shared_future class member.

Definition at line 75 of file plan_mtc_task.hpp.

Private Member Attributes

behavior_uid_

uint16_t moveit_pro::behaviors::PlanMTCTask::behavior_uid_

Behavior UID to store its corresponding MTC task data

Definition at line 84 of file plan_mtc_task.hpp.

future_

std::shared_future<tl::expected<bool, std::string> > moveit_pro::behaviors::PlanMTCTask::future_

Classes derived from AsyncBehaviorBase must have this shared_future as a class member.

Definition at line 81 of file plan_mtc_task.hpp.

store_uid_map_client_

std::shared_ptr<rclcpp::Client<StoreUidMap> > moveit_pro::behaviors::PlanMTCTask::store_uid_map_client_

Service Client to send map between behavior ID and MTC task ID to be stored in MTC Solution Manager node.

Definition at line 72 of file plan_mtc_task.hpp.

task_

moveit_pro::task_constructor::TaskPtr moveit_pro::behaviors::PlanMTCTask::task_

Stores the MTC task so it can be asynchronously preempted.

Definition at line 69 of file plan_mtc_task.hpp.

Public Static Functions

metadata()

BT::KeyValueVector moveit_pro::behaviors::PlanMTCTask::metadata ()
static

Declaration at line 39 of file plan_mtc_task.hpp, definition at line 101 of file plan_mtc_task.cpp.

providedPorts()

BT::PortsList moveit_pro::behaviors::PlanMTCTask::providedPorts ()
static

Declaration at line 37 of file plan_mtc_task.hpp, definition at line 85 of file plan_mtc_task.cpp.


The documentation for this class was generated from the following files:


Generated via doxygen2docusaurus 2.2.2 by Doxygen 1.9.8.