Skip to content

Commit

Permalink
add example how to use wildcards in parameter yaml file.
Browse files Browse the repository at this point in the history
Signed-off-by: Tomoya.Fujita <[email protected]>
  • Loading branch information
fujitatomoya committed Jan 20, 2025
1 parent f7ce0af commit 4fa78e7
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions source/How-To-Guides/Node-arguments.rst
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,27 @@ As an example, save the following as ``demo_params.yaml``:
some_integers: [1, 2, 3, 4]
some_doubles : [3.14, 2.718]
/**:
ros__parameters:
wildcard_full: "Full wildcard for any namespaces and any node names"
/**/parameter_blackboard:
ros__parameters:
wildcard_namespace: "Wildcard for any namspaces, but node names"
/*:
ros__parameters:
wildcard_nodename_root_namespace: "Wildcard for any node names, but root namespace"
.. note::

Wildcards can be used for node names and namespaces
``*`` matches a single token delimeted by slashes (``/``).
``**`` matches zero or more tokens delimeted by slashes.
Partial matches are not allowed (e.g. ``foo*``).


Then either declare the parameters within your node with `declare_parameter <http://docs.ros.org/en/{DISTRO}/p/rclcpp/generated/classrclcpp_1_1Node.html#_CPPv4N6rclcpp4Node17declare_parameterERKNSt6stringERKN6rclcpp14ParameterValueERKN14rcl_interfaces3msg19ParameterDescriptorEb>`__ or `declare_parameters <http://docs.ros.org/en/{DISTRO}/p/rclcpp/generated/classrclcpp_1_1Node.html#_CPPv4I0EN6rclcpp4Node18declare_parametersENSt6vectorI10ParameterTEERKNSt6stringERKNSt3mapINSt6stringENSt4pairI10ParameterTN14rcl_interfaces3msg19ParameterDescriptorEEEEEb>`__, or `set the node to automatically declare parameters <http://docs.ros.org/en/{DISTRO}/p/rclcpp/generated/classrclcpp_1_1NodeOptions.html#_CPPv4NK6rclcpp11NodeOptions47automatically_declare_parameters_from_overridesEv>`__ if they were passed in via a command line override.

Then run the following:
Expand All @@ -148,3 +169,6 @@ Other nodes will be able to retrieve the parameter values, e.g.:
some_lists.some_doubles
some_lists.some_integers
use_sim_time
wildcard_full
wildcard_namespace
wildcard_nodename_root_namespace

0 comments on commit 4fa78e7

Please sign in to comment.