Skip to content

Commit

Permalink
add example how to use wildcards in parameter yaml file. (#4950) (#4955)
Browse files Browse the repository at this point in the history
* add example how to use wildcards in parameter yaml file.

Signed-off-by: Tomoya.Fujita <[email protected]>

* adjust explanation a bit and typo fixes.

Signed-off-by: Tomoya.Fujita <[email protected]>

---------

Signed-off-by: Tomoya.Fujita <[email protected]>
Signed-off-by: Tomoya.Fujita <[email protected]>
(cherry picked from commit c717d69)

Co-authored-by: Tomoya Fujita <[email protected]>
  • Loading branch information
mergify[bot] and fujitatomoya authored Jan 21, 2025
1 parent 2aa80b1 commit ee5ca93
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 a specific node name under any namespace"
/*:
ros__parameters:
wildcard_nodename_root_namespace: "Wildcard for any node names, but only in root namespace"
.. note::

Wildcards can be used for node names and namespaces.
``*`` matches a single token delimited by slashes (``/``).
``**`` matches zero or more tokens delimited 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 ee5ca93

Please sign in to comment.