Pass an argument to a yaml configuration file
I have a configuration file that I am loading in my launch file using rosparam,
rosparam command="load" file="$(find my_pkg)/config/analyzer.yaml"
I want to pass namespace (an arg) arg name="name_space" value="my_robot"
into that yaml file when loading it so I don't have to hardcode it within yaml. Any suggestions on how to do it or if it's possible?
EDIT: Following is part of my analyzer.yaml,
analyzers:
robot:
type: diagnostic_aggregator/AnalyzerGroup
path: robot
analyzers:
power:
type: diagnostic_aggregator/GenericAnalyzer
path: Power
remove_prefix: namespace/diagnostics
timeout: 5
expected:
- "namespace/diagnostics: Voltage"
- "namespace/diagnostics: IMU"
- "namespace/diagnostics: Odom"
I want to read the namespace bit of this yaml file from launch file argument.
note: while
.yaml
files are used as configuration files in ROS, not all configuration files are.yaml
files.Your question is very specifically about how to do this with
.yaml
files. I would suggest to change the title of your question to reflect his.I modified my question, it was a bit confusing I guess