Rclex.ParameterHelpers (Rclex (Experimental) v0.12.0)

Copy Markdown View Source

Helper functions for working with ROS 2 parameter types that may not be known at compile time. Provides functions to generate parameter structs, convert between Elixir values and ROS 2 parameter types.

Summary

Functions

Generate a ParameterDescriptor struct with default values.

Generate a ParameterEventDescriptors struct for parameter changes.

Generate a Parameter struct with the given name and value. The type is automatically inferred from the value.

Generate a ParameterValue struct from an Elixir value. The type is automatically inferred.

Generate a ParameterValue struct with explicit type specification.

Generate a SetParametersResult struct.

Extract the Elixir value from a Parameter struct.

Convert a parameter type atom to the corresponding ROS 2 parameter type constant.

Extract the Elixir value from a ParameterValue struct.

Check if two ParameterValue structs are equivalent.

Check if two Parameter structs are equivalent.

Convert a ROS 2 parameter type constant to the corresponding atom.

Validate parameter name according to ROS 2 naming conventions.

Functions

gen_describe_parameters_response_struct(descriptors)

gen_get_parameter_types_response_struct(types)

gen_get_parameters_response_struct(parameter_values)

gen_list_parameters_response_struct(names, prefixes)

gen_parameter_descriptor_struct(name, type \\ :not_set, opts \\ [])

Generate a ParameterDescriptor struct with default values.

gen_parameter_event_descriptors_struct(new_parameters, changed_parameters, deleted_parameters)

Generate a ParameterEventDescriptors struct for parameter changes.

gen_parameter_event_struct(full_node_name, timestamp, new_parameters, changed_parameters, deleted_parameters)

Generate a ParameterEvent struct for parameter changes.

gen_parameter_struct(name, parameter_value)

Generate a Parameter struct with the given name and value. The type is automatically inferred from the value.

gen_parameter_value_struct(value)

Generate a ParameterValue struct from an Elixir value. The type is automatically inferred.

gen_parameter_value_struct(value, type)

Generate a ParameterValue struct with explicit type specification.

gen_set_parameters_atomically_response_struct(successful, reason \\ "")

gen_set_parameters_response_struct(results)

gen_set_parameters_result_struct(successful, reason \\ "")

Generate a SetParametersResult struct.

parameter_to_elixir(parameter)

Extract the Elixir value from a Parameter struct.

parameter_type_to_ros2(type)

@spec parameter_type_to_ros2(atom()) :: integer()

Convert a parameter type atom to the corresponding ROS 2 parameter type constant.

parameter_value_to_elixir(param_value)

Extract the Elixir value from a ParameterValue struct.

parameter_values_equal?(val1, val2)

Check if two ParameterValue structs are equivalent.

parameters_equal?(map1, map2)

Check if two Parameter structs are equivalent.

ros2_to_parameter_type(type)

@spec ros2_to_parameter_type(integer()) :: atom()

Convert a ROS 2 parameter type constant to the corresponding atom.

valid_parameter_name?(name)

@spec valid_parameter_name?(String.t()) :: boolean()

Validate parameter name according to ROS 2 naming conventions.