ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

I'm not sure that I fully understand your use case, but you might try roslaunch args. Here's a launch file that sets two params from arguments:

<launch>
  <arg name="my_integer_param" default="1"/>
  <arg name="my_string_param" default="foobar"/>
  <param name="my_integer_param" value="$(arg my_integer_param)"/>
  <param name="my_string_param" value="$(arg my_string_param)"/>
  <node name="rosplay" pkg="rosbag" type="rosbag" args="play /tmp/mybag.bag"/>
</launch>

Defaults for the args are give, so you can launch it normally:

roslaunch foo.launch

But you can override them on the command-line, e.g.:

roslaunch foo.launch my_integer_param:=42 my_string_param:=barfoo

I'm not sure that I fully understand your use case, but you might try roslaunch args. Here's a launch file that sets two params from arguments:

<launch>
  <arg name="my_integer_param" default="1"/>
  <arg name="my_string_param" default="foobar"/>
  <param name="my_integer_param" value="$(arg my_integer_param)"/>
  <param name="my_string_param" value="$(arg my_string_param)"/>
  <node name="rosplay" pkg="rosbag" type="rosbag" args="play /tmp/mybag.bag"/>
</launch>

Defaults for the args are give, given, so you can launch it normally:

roslaunch foo.launch

But you can override them on the command-line, e.g.:

roslaunch foo.launch my_integer_param:=42 my_string_param:=barfoo