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

Revision history [back]

Here is a launch file I use to record data on our robot:

<!-- -*- xml -*- -->
<!--
   Record HRP-2 data automatically in three separate rosbags:
   - cameras images
   - hrpsys information (IMU, force sensors, robot position)
   - diagnostics (node output, diagnostics)
  -->

<launch>
  <arg name="record_cameras" default="true" />
  <arg name="record_hrpsys" default="true" />

 <!-- Are we on the robot (hrp2_14) or simulating (sim)? -->
 <arg name="robot_machine_profile" default="hrp2_14" />

 <!-- Load the robot model and machine description -->
 <include file="$(find hrp2_bringup)/launch/common.launch">
   <arg name="robot_machine_profile" value="$(arg robot_machine_profile)" />
 </include>

 <node pkg="rosbag" type="rosbag" name="rosbag_record_cam"
       args="record -o /tmp/hrp2-cameras /wide/left/image_raw /wide/left/camera_info    /wide/right/image_raw /wide/right/camera_info /narrow/left/image_raw /narrow/left/camera_info    /narrow/right/image_raw /narrow/right/camera_info"
       if="$(arg record_cameras)" />

 <node pkg="rosbag" type="rosbag" name="rosbag_record_hrpsys"
       args="record -o /tmp/hrp2-hrpsys /imu /joint_states /joint_command /force_0 /force_1 /force_2 /force_3 /base_link"
       if="$(arg record_hrpsys)" />

 <node pkg="rosbag" type="rosbag" name="rosbag_record_diag"
       args="record -o /tmp/hrp2-diag /diagnostics /rosout"/>   
</launch>

Please note that if you pass "-o" instead of "-O" then it becomes only a prefix and not the full bag filename. In this case, the timestamp is then used as a suffix to build the full filename.

You can write into a package directory using "$(find mypkg)" BUT if you will not be able to release your stack. I.e. if your stack get, at some point, installed through a Debian package, the directory will be owned by root and be read-only for you so your launch file will not work.

Even if rosbuild and others ROS tools behaves badly w.r.t this issue, the source directory of any package should always be considered as read-only.

Here is a launch file I use to record data on our robot:

<!-- -*- xml -*- -->
<!--
   Record HRP-2 data automatically in three separate rosbags:
   - cameras images
   - hrpsys information (IMU, force sensors, robot position)
   - diagnostics (node output, diagnostics)
  -->

<launch>
  <arg name="record_cameras" default="true" />
  <arg name="record_hrpsys" default="true" />

 <!-- Are we on the robot (hrp2_14) or simulating (sim)? -->
 <arg name="robot_machine_profile" default="hrp2_14" />

 <!-- Load the robot model and machine description -->
 <include file="$(find hrp2_bringup)/launch/common.launch">
   <arg name="robot_machine_profile" value="$(arg robot_machine_profile)" />
 </include>

 <node pkg="rosbag" type="rosbag" type="record" name="rosbag_record_cam"
       args="record -o /tmp/hrp2-cameras /wide/left/image_raw /wide/left/camera_info    /wide/right/image_raw /wide/right/camera_info /narrow/left/image_raw /narrow/left/camera_info    /narrow/right/image_raw /narrow/right/camera_info"
       if="$(arg record_cameras)" />

 <node pkg="rosbag" type="rosbag" name="rosbag_record_hrpsys"
       args="record -o /tmp/hrp2-hrpsys /imu /joint_states /joint_command /force_0 /force_1 /force_2 /force_3 /base_link"
       if="$(arg record_hrpsys)" />

 <node pkg="rosbag" type="rosbag" name="rosbag_record_diag"
       args="record -o /tmp/hrp2-diag /diagnostics /rosout"/>   
</launch>

Please note that if you pass "-o" instead of "-O" then it becomes only a prefix and not the full bag filename. In this case, the timestamp is then used as a suffix to build the full filename.

You can write into a package directory using "$(find mypkg)" BUT if you will not be able to release your stack. I.e. if your stack get, at some point, installed through a Debian package, the directory will be owned by root and be read-only for you so your launch file will not work.

Even if rosbuild and others ROS tools behaves badly w.r.t this issue, the source directory of any package should always be considered as read-only.

Here is a launch file I use to record data on our robot:

<!-- -*- xml -*- -->
<!--
   Record HRP-2 data automatically in three separate rosbags:
   - cameras images
   - hrpsys information (IMU, force sensors, robot position)
   - diagnostics (node output, diagnostics)
  -->

<launch>
  <arg name="record_cameras" default="true" />
  <arg name="record_hrpsys" default="true" />

 <!-- Are we on the robot (hrp2_14) or simulating (sim)? -->
 <arg name="robot_machine_profile" default="hrp2_14" />

 <!-- Load the robot model and machine description -->
 <include file="$(find hrp2_bringup)/launch/common.launch">
   <arg name="robot_machine_profile" value="$(arg robot_machine_profile)" />
 </include>

 <node pkg="rosbag" type="record" name="rosbag_record_cam"
       args="record -o /tmp/hrp2-cameras /wide/left/image_raw /wide/left/camera_info    /wide/right/image_raw /wide/right/camera_info /narrow/left/image_raw /narrow/left/camera_info    /narrow/right/image_raw /narrow/right/camera_info"
       if="$(arg record_cameras)" />

 <node pkg="rosbag" type="rosbag" type="record" name="rosbag_record_hrpsys"
       args="record -o /tmp/hrp2-hrpsys /imu /joint_states /joint_command /force_0 /force_1 /force_2 /force_3 /base_link"
       if="$(arg record_hrpsys)" />

 <node pkg="rosbag" type="rosbag" type="record" name="rosbag_record_diag"
       args="record -o /tmp/hrp2-diag /diagnostics /rosout"/>   
</launch>

Please note that if you pass "-o" instead of "-O" then it becomes only a prefix and not the full bag filename. In this case, the timestamp is then used as a suffix to build the full filename.

You can write into a package directory using "$(find mypkg)" BUT if you will not be able to release your stack. I.e. if your stack get, at some point, installed through a Debian package, the directory will be owned by root and be read-only for you so your launch file will not work.

Even if rosbuild and others ROS tools behaves badly w.r.t this issue, the source directory of any package should always be considered as read-only.