|
MoveIt Pro API
Core Behaviors for MoveIt Pro
|
Thread-safe registry mapping a port C++ type to a parser that turns a YAML string into a typed BehaviorTree.CPP blackboard entry. More...
#include <parameter_override_registry.hpp>
Public Types | |
| using | ParseFn = std::function< tl::expected< BT::Any, std::string >(std::string_view)> |
Callback that parses a YAML string into a typed BT::Any value. | |
Public Member Functions | |
| void | registerParser (std::type_index type_index, ParseFn parser) |
Register a parser for the type identified by type_index. | |
| ParseFn | findParser (std::type_index type_index) const |
Look up the parser for type_index. Returns an empty ParseFn if no parser is registered. | |
| ParseFn | findParserByName (std::string_view declared_type_name) const |
Look up the parser for the C++ type whose spelling is declared_type_name. | |
Static Public Member Functions | |
| static ParameterOverrideRegistry & | get () |
| Access the process-global registry. | |
Thread-safe registry mapping a port C++ type to a parser that turns a YAML string into a typed BehaviorTree.CPP blackboard entry.
Used by the objective server to apply parameter_overrides from DoObjectiveSequence goals onto the tree's blackboards as typed values, so behaviors do not need a BT::convertFromString<T> specialization visible in every .cpp that calls getInput<T>(). Built-in ROS message types are seeded once at startup via seedBuiltinParameterOverrideParsers(). Customers register custom types by calling registerParameterType<T>() once per type from their behavior loader plugin's registerBehaviors().
| using moveit_pro::behavior::ParameterOverrideRegistry::ParseFn = std::function<tl::expected<BT::Any, std::string>(std::string_view)> |
Callback that parses a YAML string into a typed BT::Any value.
tl::expected wrapping the parsed value on success, or a human-readable error string on YAML parse failure. The parser does not touch any blackboard — that is the caller's responsibility so the apply step can be made transactional. | ParameterOverrideRegistry::ParseFn moveit_pro::behavior::ParameterOverrideRegistry::findParser | ( | std::type_index | type_index | ) | const |
Look up the parser for type_index. Returns an empty ParseFn if no parser is registered.
Returns by value (a copy of the std::function) so concurrent registerParser calls cannot dangle the pointer to a rehashed unordered_map entry between lookup and invocation.
| ParameterOverrideRegistry::ParseFn moveit_pro::behavior::ParameterOverrideRegistry::findParserByName | ( | std::string_view | declared_type_name | ) | const |
Look up the parser for the C++ type whose spelling is declared_type_name.
Used to resolve an override against an Objective's declared <input_port type="..."> when the consuming port is type-erased (e.g. a ForEach whose port is std::vector<BT::Any>), so port-based type_index resolution yields no usable parser. The query is normalized via normalizeTypeName to match the registered key, so the user-written spelling (std::vector<geometry_msgs::msg::PoseStamped>) resolves to the parser registered for the demangled spelling (which carries std::allocator<...> template args). Returns an empty ParseFn if none matches.
|
static |
Access the process-global registry.
| void moveit_pro::behavior::ParameterOverrideRegistry::registerParser | ( | std::type_index | type_index, |
| ParseFn | parser | ||
| ) |
Register a parser for the type identified by type_index.
Overwrites any prior registration for the same type. Also indexes the parser by the normalized demangled spelling of type_index so it can be resolved by name (see findParserByName). Thread-safe.