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

Revision history [back]

I don't think you are using the -O flag the right way and you don't need record in the args. Try this:

<launch>
    <node pkg="rosbag" type="record" name="robot_bag"
              args="/odom /diagnostics /tf"
    />

  <node pkg="rosbag" type="record" name="harness_bag"
            args="/cmd_vel /mobile_base/commands/velocity /move_base_simple/goal"
    />
</launch>

If you want to have a prefix before the date/time in the bag filename add -o robot_bag and -o harness_bag as the first element of the args.

The error you are seeing is because the capital -O flag says to make the next element the bag file name. Since there is a leading slash to the next element (since you intend it to be a topic) it is trying to write a file in the root of your filesystem. You very likely do not have permissions to write files to the root of your filesystem (which is expected and encouraged) so there is an error. By using the lowercase -o flag it says to use the next element as a prefix for the date/time. Doing those things results in:

<launch>
    <node pkg="rosbag" type="record" name="robot_bag"
              args="-o robot_bag /odom /diagnostics /tf"
    />

  <node pkg="rosbag" type="record" name="harness_bag"
            args="-o harness_bag /cmd_vel /mobile_base/commands/velocity /move_base_simple/goal"
    />
</launch>

After running that launch file you should find that there are two bag files that end up in ~/.ros/.

I don't think you are using the -O flag the right way and you don't need record in the args. Try this:

<launch>
    <node pkg="rosbag" type="record" name="robot_bag"
              args="/odom /diagnostics /tf"
    />

  <node pkg="rosbag" type="record" name="harness_bag"
            args="/cmd_vel /mobile_base/commands/velocity /move_base_simple/goal"
    />
</launch>

If you want to have a prefix before the date/time in the bag filename add -o robot_bag and -o harness_bag as the first element of the args.

The error you are seeing is because the capital -O flag says to make the next element the bag file name. Since there is a leading slash to the next element (since you intend it to be a topic) it is trying to write a file in the root of your filesystem. You very likely do not have permissions to write files to the root of your filesystem (which is expected and encouraged) so there is an error. By using the lowercase -o flag it says to use the next element as a prefix for the date/time. Doing those things results in:

<launch>
    <node pkg="rosbag" type="record" name="robot_bag"
              args="-o robot_bag /odom /diagnostics /tf"
    />

  <node pkg="rosbag" type="record" name="harness_bag"
            args="-o harness_bag /cmd_vel /mobile_base/commands/velocity /move_base_simple/goal"
    />
</launch>

After running that launch file you should find that there are two bag files that end up in ~/.ros/.

See the rosbag command line usage page for more details.