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

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.
 

Static Public Member Functions

static ParameterOverrideRegistryget ()
 Access the process-global registry.
 

Detailed Description

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

Member Typedef Documentation

◆ ParseFn

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.

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

Member Function Documentation

◆ findParser()

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.

◆ get()

ParameterOverrideRegistry & moveit_pro::behavior::ParameterOverrideRegistry::get ( )
static

Access the process-global registry.

◆ registerParser()

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. Thread-safe.


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