Class ConfigurationManager

Class Documentation

class ConfigurationManager

Application service for ROS 2 node parameters.

Pure C++; ROS-side I/O is performed by the injected ParameterTransport adapter (typically Ros2ParameterTransport). All rclcpp::SyncParametersClient usage, the rclcpp::Parameter defaults cache, the negative-cache for unreachable nodes, the spin_mutex serialising parameter-client spins, and the JSON <-> rclcpp::ParameterValue conversion helpers live in the adapter.

The manager retains the high-level orchestration:

  • shutdown ordering contract (idempotent shutdown forwards to transport)

  • reset orchestration (compose set_parameter with cached default values)

  • the public CRUD surface consumed by handler_context handlers

Self-node short-circuiting (avoiding IPC for the gateway’s own parameters) is delegated to the transport because identifying the gateway’s own FQN requires the rclcpp node handle.

Public Functions

explicit ConfigurationManager(std::shared_ptr<ParameterTransport> transport)
Parameters:

transport – Concrete ParameterTransport adapter. Manager takes shared ownership.

~ConfigurationManager()
ConfigurationManager(const ConfigurationManager&) = delete
ConfigurationManager &operator=(const ConfigurationManager&) = delete
ConfigurationManager(ConfigurationManager&&) = delete
ConfigurationManager &operator=(ConfigurationManager&&) = delete
void shutdown()

Idempotent teardown. Forwards to the transport’s shutdown so cached parameter clients drop their references before rclcpp::shutdown() runs. Must be called before rclcpp::shutdown() to prevent use-after-free of the parameter-client internal node held by the transport.

ParameterResult list_parameters(const std::string &node_name)

List all parameters for a node.

Parameters:

node_name – Fully qualified node name (e.g., “/powertrain/engine/engine_temp_sensor”).

Returns:

ParameterResult with array of {name, value, type} objects.

ParameterResult get_parameter(const std::string &node_name, const std::string &param_name)

Get a specific parameter value.

Parameters:
  • node_name – Fully qualified node name.

  • param_name – Parameter name.

Returns:

ParameterResult with {name, value, type, description, read_only}.

ParameterResult set_parameter(const std::string &node_name, const std::string &param_name, const json &value)

Set a parameter value.

Parameters:
  • node_name – Fully qualified node name.

  • param_name – Parameter name.

  • value – New value (JSON type will be converted to the appropriate ROS 2 type by the transport).

Returns:

ParameterResult with {name, value, type}.

ParameterResult reset_parameter(const std::string &node_name, const std::string &param_name)

Reset a specific parameter to its default (initial) value.

Parameters:
  • node_name – Fully qualified node name.

  • param_name – Parameter name.

Returns:

ParameterResult with reset parameter info.

ParameterResult reset_all_parameters(const std::string &node_name)

Reset all parameters of a node to their default (initial) values.

Parameters:

node_name – Fully qualified node name.

Returns:

ParameterResult with count of reset parameters.