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

Revision history [back]

Well, only for changing the file to play, this seems pretty overkill to me. And still limits you to have the file located at my_ros_package/bags/, which again isn't very generic...

A few points to consider:

  1. wrapping the whole thing in a shell script, when all you do is export the environment variable and then call the launch file is not required. You could simply export the variable manually. I see no benefit in adding the additional step there.
  2. You could also use a launch arg, instead of the environment variable substitution. Basically change the launch file to

    <launch>
         <arg name="file" default="this_bag01.bag"/>
         <node name="rosbag" type="play" pkg="rosbag" args="--pause $(find my_ros_package)/bags/($arg file)"/> 
    </launch>
    

    and call it with roslaunch my_ros_package thelaunch_file.launch file:=otherfile.bag.

Check out the docs about the various posibilities.

Personally, I'd definitely go for option two (actually, I'll manually launch the rosbag executable, but then again, you might need the filename somewhere else). Option one seems to me to try to accomplish the same thing, at the expense of adding another file that you'd have to change every time (which is not good for any VCS)...