MoveIt Pro API
Core Behaviors for MoveIt Pro
Loading...
Searching...
No Matches
moveit_pro::behavior Namespace Reference

Classes

class  LoggerBase
 Base class to allow Behaviors to report messages with detailed explanations to MoveIt Studio UI. More...
 
class  LoggerROS
 A ROS-specialized implementation of LoggerBase that publishes the error message on a topic and logs it through an rclcpp Logger. More...
 
class  ParameterOverrideRegistry
 Thread-safe registry mapping a port C++ type to a parser that turns a YAML string into a typed BehaviorTree.CPP blackboard entry. More...
 
struct  TransparentStringHash
 

Functions

std::string normalizeTypeName (std::string_view type_name)
 Normalize a C++ type spelling so the demangled form and a user-written form compare equal.
 
template<typename T >
tl::expected< BT::Any, std::string > parseParameterFromYaml (std::string_view yaml_string)
 Parse yaml_string into a value of type T wrapped in BT::Any.
 
template<typename T >
void registerParameterParser ()
 Register a YAML parser for type T without touching the blackboard-viewer JSON exporter.
 
template<typename Element >
tl::expected< BT::Any, std::string > parseVectorParameterFromYaml (std::string_view yaml_string)
 Parse yaml_string as a YAML sequence of Element into a type-erased std::vector<BT::Any> wrapped in BT::Any.
 
template<typename Element >
void registerVectorParameterParser ()
 Register a parser for std::vector<Element> that deposits a type-erased std::vector<BT::Any>.
 
template<typename T >
void registerParameterType ()
 Register a parser for ROS message type T AND register the JSON converter so the override value displays as structured JSON in the blackboard viewer.
 
void seedBuiltinParameterOverrideParsers ()
 Seed the registry with parsers for primitives (string, double, int, bool, YAML::Node) and every ROS message type covered by ROS_MESSAGE_YAML_PARSER in moveit_pro_common/utils/yaml_parsing_tools.hpp.
 

Function Documentation

◆ normalizeTypeName()

std::string moveit_pro::behavior::normalizeTypeName ( std::string_view  type_name)

Normalize a C++ type spelling so the demangled form and a user-written form compare equal.

Strips defaulted std::allocator<...> template arguments and removes all whitespace. This converges the libstdc++ demangled spelling std::vector<geometry_msgs::msg::PoseStamped, std::allocator<...> > and the user-written std::vector<geometry_msgs::msg::PoseStamped> onto the same key. Whitespace is never semantically meaningful inside a C++ type-id, so removing it is safe. No-ops gracefully on inputs with no allocator argument.

◆ parseParameterFromYaml()

template<typename T >
tl::expected< BT::Any, std::string > moveit_pro::behavior::parseParameterFromYaml ( std::string_view  yaml_string)

Parse yaml_string into a value of type T wrapped in BT::Any.

Implements the ParseFn contract for registerParameterParser<T>. Requires YAML::convert<T> to be specialized for T.

◆ parseVectorParameterFromYaml()

template<typename Element >
tl::expected< BT::Any, std::string > moveit_pro::behavior::parseVectorParameterFromYaml ( std::string_view  yaml_string)

Parse yaml_string as a YAML sequence of Element into a type-erased std::vector<BT::Any> wrapped in BT::Any.

Implements the ParseFn contract for registerVectorParameterParser<Element>. Requires YAML::convert<Element> to be specialized for Element.

◆ registerParameterParser()

template<typename T >
void moveit_pro::behavior::registerParameterParser ( )

Register a YAML parser for type T without touching the blackboard-viewer JSON exporter.

Use this for non-ROS-message types like primitives, YAML::Node, or std::vector<RosMsg>. Requires that YAML::convert<T> is specialized for T.

◆ registerParameterType()

template<typename T >
void moveit_pro::behavior::registerParameterType ( )

Register a parser for ROS message type T AND register the JSON converter so the override value displays as structured JSON in the blackboard viewer.

Equivalent to registerParameterParser<T>() plus register_ros_msg<T>(). Use this for ROS message types (custom or built-in). Requires ROS_MESSAGE_YAML_PARSER(pkg, Msg) to have been invoked for T to specialize YAML::convert<T>.

◆ registerVectorParameterParser()

template<typename Element >
void moveit_pro::behavior::registerVectorParameterParser ( )

Register a parser for std::vector<Element> that deposits a type-erased std::vector<BT::Any>.

Mirrors what BT::TreeNode::setOutput does for vector ports: it element-wise wraps the parsed std::vector<Element> into a std::vector<BT::Any> before the value reaches the blackboard. This is what makes the deposited value readable by both type-erased consumers (ForEach, whose port is std::vector<BT::Any> — exact match) and strongly-typed consumers (getInput<std::vector<Element>> unwraps a std::vector<BT::Any> entry element-wise). A raw std::vector<Element> written via blackboard->set is NOT convertible to std::vector<BT::Any> at read time, which is the bug this avoids. The parser is keyed under std::type_index(typeid(std::vector<Element>)) and the matching normalized name — the declared vector type — even though the stored value is std::vector<BT::Any>. Requires YAML::convert<Element> to be specialized for Element.

◆ seedBuiltinParameterOverrideParsers()

void moveit_pro::behavior::seedBuiltinParameterOverrideParsers ( )

Seed the registry with parsers for primitives (string, double, int, bool, YAML::Node) and every ROS message type covered by ROS_MESSAGE_YAML_PARSER in moveit_pro_common/utils/yaml_parsing_tools.hpp.

Idempotent — safe to call multiple times across multiple ObjectiveServer instances. Guarded by std::call_once.