Correct way to use arguments
I have a launch file that plays rosbag files among other things. Right now it is something like this
<launch>
<node name="rosbag" type="play" pkg="rosbag" args="--pause $(find my_ros_package)/bags/this_bag01.bag" >
</node>
....
</launch>
So, when launched it plays the rosbag file this_bag01.bag
I want to make it more flexible so that I can call it with any rosbag file. What is the most appropriate way to do this?
The way I am thinking is
1. Create a shell script file that I can call with an argument
2. In this shell I can put
export LAUNCH_FILE= (and here the argument)
roslaunch my_ros_package thelauch_file.launch
Inside the launch file put
$(env LAUNCH_FILE)
<launch> <node name="rosbag" type="play" pkg="rosbag" args="--pause $(find my_ros_package)/bags/($ env LAUNCH_FILE)" ></node> </launch>