Parameter Management¶
Parameters allow you to configure ROS 2 nodes dynamically. rclgd provides a seamless interface for declaring, updating, and monitoring parameters from GDScript.
Working with Parameters¶
Parameters must be declared before use. You can then get or set their values using standard Godot types.
func manage_params():
# Declare with default value
ros_node.declare_parameter("max_speed", 2.0)
# Get and Set
var speed = ros_node.get_parameter("max_speed")
ros_node.set_parameter("max_speed", speed * 1.5)
Dynamic Updates via Signals¶
The parameter_changed signal allows your node to react to parameter updates from external ROS 2 tools (e.g., ros2 param set).
func _init():
ros_node.parameter_changed.connect(_on_param_changed)
func _on_param_changed(name: String, value: Variant):
print("Parameter %s updated: %s" % [name, str(value)])
Type Mapping Reference¶
rclgd automatically converts between Godot Variant and ROS 2 parameter types.
Godot Type |
ROS 2 Parameter Type |
|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|