BehaviorContext Struct
The BehaviorContext struct contains shared resources that are common between all instances of Behaviors that inherit from moveit_pro::behaviors::SharedResourcesNode. More...
Declaration
Included Headers
Public Constructors Index
| BehaviorContext (const std::shared_ptr< rclcpp::Node > &node_in, bool tf2_spin_thread=true, bool load_robot_model=false, std::size_t mtc_introspection_retained_tasks=kMtcIntrospectionRetainedTaskLimit) | |
| BehaviorContext (const std::shared_ptr< rclcpp::Node > &node_in, std::unique_ptr< moveit_pro::behavior::LoggerBase > logger, bool tf2_spin_thread=true, bool load_robot_model=false, std::size_t mtc_introspection_retained_tasks=kMtcIntrospectionRetainedTaskLimit) | |
| BehaviorContext (const BehaviorContext &)=delete | |
| BehaviorContext (BehaviorContext &&)=delete | |
Public Operators Index
| BehaviorContext & | operator= (const BehaviorContext &)=delete |
| BehaviorContext & | operator= (BehaviorContext &&)=delete |
Public Member Functions Index
| std::string | getModelFrameOrDefault () const |
|
The robot model's root frame, or "world" when no robot model was loaded. More... | |
Public Member Attributes Index
| const std::shared_ptr< rclcpp::Node > | node |
|
A const shared pointer to a RCLCPP Node. This points to an instance of a Node provided when constructing the BehaviorContext. More... | |
| const std::shared_ptr< rclcpp::CallbackGroup > | callback_group_mutually_exclusive |
|
A const shared pointer mutually-exclusive callback group. More... | |
| const std::shared_ptr< rclcpp::CallbackGroup > | reentrant_callback_group |
|
A const shared pointer reentrant callback group. More... | |
| const std::unique_ptr< moveit_pro::behavior::LoggerBase > | logger |
|
A const unique pointer to a logger for reporting messages to the UI. More... | |
| std::shared_ptr< tf2_ros::Buffer > | transform_buffer_ptr |
|
Transform buffer, listener, and broadcaster to interface with TF. More... | |
| std::shared_ptr< tf2_ros::TransformListener > | transform_listener_ptr |
| std::shared_ptr< tf2_ros::TransformBroadcaster > | transform_broadcaster_ptr |
| std::shared_ptr< moveit_pro::base::RobotModel > | robot_model |
|
The robot model, may be nullptr if the BehaviorContext was created with load_robot_model=false. More... | |
| PersistentPublisherCache | persistent_publishers |
|
Cache of publishers (e.g. UI point-cloud snapshots) whose latched samples must outlive the Behavior instance that published them, so a UI that reconnects or reloads after the Objective still receives them. More... | |
| BoundedRetentionQueue | mtc_introspection_retention |
|
Bounds MTC introspection memory across the process: only the most recently planned MTC tasks keep their introspection data (solutions, failures, and per-candidate planning scenes); older tasks' data is released when a newer task is retained. Without this bound, every MTC planning Subtree's task retains that data until the Objective is unloaded, so Objectives with many planning Subtrees grow memory without limit (issue #22024). PlanMTCTask registers each introspection-enabled task here after planning. The limit is the mtc_introspection_retained_tasks constructor argument (default kMtcIntrospectionRetainedTaskLimit), which the objective server reads from the robot config's objectives.mtc_introspection_retained_tasks key. More... | |
Description
The BehaviorContext struct contains shared resources that are common between all instances of Behaviors that inherit from moveit_pro::behaviors::SharedResourcesNode.
The BehaviorContext struct won't load a robot model by default. This is to avoid the cost of loading the robot model when it's not actually needed (e.g. tests), or needing to consume a timeout waiting for the model to be available. If a robot model is needed (e.g. when running on an actual robot), set load_robot_model=true when constructing the BehaviorContext. If load_robot_model=true and the robot model fails to load, the BehaviorContext will throw an exception and the program will terminate.
Definition at line 98 of file behavior_context.hpp.
Public Constructors
BehaviorContext()
| explicit |
Declaration at line 104 of file behavior_context.hpp, definition at line 32 of file behavior_context.cpp.
BehaviorContext()
|
Declaration at line 108 of file behavior_context.hpp, definition at line 39 of file behavior_context.cpp.
BehaviorContext()
| delete |
Definition at line 113 of file behavior_context.hpp.
BehaviorContext()
| delete |
Definition at line 115 of file behavior_context.hpp.
Public Operators
operator=()
| delete |
Definition at line 117 of file behavior_context.hpp.
operator=()
| delete |
Definition at line 119 of file behavior_context.hpp.
Public Member Functions
getModelFrameOrDefault()
|
The robot model's root frame, or "world" when no robot model was loaded.
Behaviors default their visualization and IK frames to this so they stay correct on robots whose model is not rooted at "world" (e.g. mobile bases rooted at "odom").
Declaration at line 164 of file behavior_context.hpp, definition at line 60 of file behavior_context.cpp.
Public Member Attributes
callback_group_mutually_exclusive
|
A const shared pointer mutually-exclusive callback group.
Marked const to prevent Behaviors that can access BehaviorContext from changing it.
Definition at line 132 of file behavior_context.hpp.
logger
|
A const unique pointer to a logger for reporting messages to the UI.
Marked const to prevent Behaviors that can access BehaviorContext from changing it.
Definition at line 144 of file behavior_context.hpp.
mtc_introspection_retention
|
Bounds MTC introspection memory across the process: only the most recently planned MTC tasks keep their introspection data (solutions, failures, and per-candidate planning scenes); older tasks' data is released when a newer task is retained. Without this bound, every MTC planning Subtree's task retains that data until the Objective is unloaded, so Objectives with many planning Subtrees grow memory without limit (issue #22024). PlanMTCTask registers each introspection-enabled task here after planning. The limit is the mtc_introspection_retained_tasks constructor argument (default kMtcIntrospectionRetainedTaskLimit), which the objective server reads from the robot config's objectives.mtc_introspection_retained_tasks key.
Release callbacks run on whichever thread's retain() call evicted the entry, so a retained task's data can be released from a thread other than the one that planned it. retain() is a synchronization point (see BoundedRetentionQueue): a Behavior must retain a task (via mtc_utils::retainTaskIntrospection) before planning it or reading its retained data, after which no release of that task can run until the queue's full capacity of newer tasks is retained — the only residual race is that many retains completing while the use is still in progress.
Definition at line 186 of file behavior_context.hpp.
node
|
A const shared pointer to a RCLCPP Node. This points to an instance of a Node provided when constructing the BehaviorContext.
Marked const to prevent Behaviors that can access BehaviorContext from changing it.
Definition at line 126 of file behavior_context.hpp.
persistent_publishers
|
Cache of publishers (e.g. UI point-cloud snapshots) whose latched samples must outlive the Behavior instance that published them, so a UI that reconnects or reloads after the Objective still receives them.
Definition at line 170 of file behavior_context.hpp.
reentrant_callback_group
|
A const shared pointer reentrant callback group.
Marked const to prevent Behaviors that can access BehaviorContext from changing it.
Definition at line 138 of file behavior_context.hpp.
robot_model
|
The robot model, may be nullptr if the BehaviorContext was created with load_robot_model=false.
if load_robot_model=true, this is guaranteed to be a valid pointer.
Definition at line 157 of file behavior_context.hpp.
transform_broadcaster_ptr
|
Definition at line 151 of file behavior_context.hpp.
transform_buffer_ptr
|
Transform buffer, listener, and broadcaster to interface with TF.
Definition at line 149 of file behavior_context.hpp.
transform_listener_ptr
|
Definition at line 150 of file behavior_context.hpp.
The documentation for this struct was generated from the following files:
Generated via doxygen2docusaurus 2.2.2 by Doxygen 1.9.8.