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
Included Headers
Base class
| class | AsyncBehaviorBase |
|
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::TaskPtr | task_ |
|
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_t | behavior_uid_ |
Public Static Functions Index
| static BT::PortsList | providedPorts () |
| static BT::KeyValueVector | metadata () |
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 Name | Port Type | Object Type |
|---|---|---|
| task | Input | std::shared_ptr<moveit_pro::task_constructor::Task> |
| max_solutions | Input | std::size_t (0 to search all solutions) |
| solution | Output | moveit_task_constructor_msgs::msg::Solution |
Definition at line 31 of file plan_mtc_task.hpp.
Public Constructors
PlanMTCTask()
|
Declaration at line 34 of file plan_mtc_task.hpp, definition at line 74 of file plan_mtc_task.cpp.
Private Member Functions
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()
| 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()
| 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_
|
Behavior UID to store its corresponding MTC task data
Definition at line 84 of file plan_mtc_task.hpp.
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_
|
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_
|
Stores the MTC task so it can be asynchronously preempted.
Definition at line 69 of file plan_mtc_task.hpp.
Public Static Functions
metadata()
| static |
Declaration at line 39 of file plan_mtc_task.hpp, definition at line 101 of file plan_mtc_task.cpp.
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.