Skip to main content

parse_params_yaml

Function parse_params_yaml 

Source
pub fn parse_params_yaml<'t, F>(
    text: &'t str,
    on_param: F,
) -> Result<(), ParamsYamlError<'t>>
where F: for<'n> FnMut(ParamArg<'n>),
Expand description

Read a ROS 2 parameter file’s TEXT — the --params-file format — and report each value through on_param, in file order.

The subset rcl’s files use and nothing more:

/**:                     # every node; or `talker` / `/ns/talker`
  ros__parameters:
    rate_hz: 10
    gains:
      kp: 1.5            # reported as `gains.kp`
    frame: "base_link"

A node key matches by its last segment, the node NAME, as -p node: and -r node: do; its namespace is not compared. Comments, blank lines and --- are skipped. Refused, each with its line: tabs used as indentation, sequences and flow collections (array parameters are not read from a file yet), block scalars, anchors, wildcards other than /**, and any value not under <node>: ros__parameters:.

no_std and allocation-free: the dotted name is built in a fixed buffer and lent to on_param for the call.