MoveIt Pro API
Core Behaviors for MoveIt Pro
Loading...
Searching...
No Matches
moveit_pro::behaviors::BehaviorContext Struct Reference

The BehaviorContext struct contains shared resources that are common between all instances of Behaviors that inherit from moveit_pro::behaviors::SharedResourcesNode. More...

#include <behavior_context.hpp>

Collaboration diagram for moveit_pro::behaviors::BehaviorContext:

Public Member Functions

 BehaviorContext (const std::shared_ptr< rclcpp::Node > &node_in, bool tf2_spin_thread=true, bool load_robot_model=false)
 
 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)
 
 BehaviorContext (const BehaviorContext &)=delete
 
 BehaviorContext (BehaviorContext &&)=delete
 
BehaviorContextoperator= (const BehaviorContext &)=delete
 
BehaviorContextoperator= (BehaviorContext &&)=delete
 
std::string getModelFrameOrDefault () const
 The robot model's root frame, or "world" when no robot model was loaded.
 

Public Attributes

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.
 
const std::shared_ptr< rclcpp::CallbackGroup > callback_group_mutually_exclusive
 A const shared pointer mutually-exclusive callback group.
 
const std::shared_ptr< rclcpp::CallbackGroup > reentrant_callback_group
 A const shared pointer reentrant callback group.
 
const std::unique_ptr< moveit_pro::behavior::LoggerBaselogger
 A const unique pointer to a logger for reporting messages to the UI.
 
std::shared_ptr< tf2_ros::Buffer > transform_buffer_ptr
 Transform buffer, listener, and broadcaster to interface with TF.
 
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.
 
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.
 

Detailed 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.

Constructor & Destructor Documentation

◆ BehaviorContext() [1/4]

moveit_pro::behaviors::BehaviorContext::BehaviorContext ( const std::shared_ptr< rclcpp::Node > &  node_in,
bool  tf2_spin_thread = true,
bool  load_robot_model = false 
)
explicit

◆ BehaviorContext() [2/4]

moveit_pro::behaviors::BehaviorContext::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 
)

◆ BehaviorContext() [3/4]

moveit_pro::behaviors::BehaviorContext::BehaviorContext ( const BehaviorContext )
delete

◆ BehaviorContext() [4/4]

moveit_pro::behaviors::BehaviorContext::BehaviorContext ( BehaviorContext &&  )
delete

Member Function Documentation

◆ getModelFrameOrDefault()

std::string moveit_pro::behaviors::BehaviorContext::getModelFrameOrDefault ( ) const

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").

◆ operator=() [1/2]

BehaviorContext & moveit_pro::behaviors::BehaviorContext::operator= ( BehaviorContext &&  )
delete

◆ operator=() [2/2]

BehaviorContext & moveit_pro::behaviors::BehaviorContext::operator= ( const BehaviorContext )
delete

Member Data Documentation

◆ callback_group_mutually_exclusive

const std::shared_ptr<rclcpp::CallbackGroup> moveit_pro::behaviors::BehaviorContext::callback_group_mutually_exclusive

A const shared pointer mutually-exclusive callback group.

Marked const to prevent Behaviors that can access BehaviorContext from changing it.

◆ logger

const std::unique_ptr<moveit_pro::behavior::LoggerBase> moveit_pro::behaviors::BehaviorContext::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.

◆ node

const std::shared_ptr<rclcpp::Node> moveit_pro::behaviors::BehaviorContext::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.

◆ persistent_publishers

PersistentPublisherCache moveit_pro::behaviors::BehaviorContext::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.

◆ reentrant_callback_group

const std::shared_ptr<rclcpp::CallbackGroup> moveit_pro::behaviors::BehaviorContext::reentrant_callback_group

A const shared pointer reentrant callback group.

Marked const to prevent Behaviors that can access BehaviorContext from changing it.

◆ robot_model

std::shared_ptr<moveit_pro::base::RobotModel> moveit_pro::behaviors::BehaviorContext::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.

◆ transform_broadcaster_ptr

std::shared_ptr<tf2_ros::TransformBroadcaster> moveit_pro::behaviors::BehaviorContext::transform_broadcaster_ptr

◆ transform_buffer_ptr

std::shared_ptr<tf2_ros::Buffer> moveit_pro::behaviors::BehaviorContext::transform_buffer_ptr

Transform buffer, listener, and broadcaster to interface with TF.

◆ transform_listener_ptr

std::shared_ptr<tf2_ros::TransformListener> moveit_pro::behaviors::BehaviorContext::transform_listener_ptr

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