Skip to content

Make bagfiles

Stacy edited this page Jan 4, 2023 · 5 revisions

Make bagfiles

  1. If not already, setup ROS across machines

  2. Launch donkeycar on the car

roslaunch donkeycar teleop.launch
  1. On PC go to the folder robocar_ws/src/path_from_image/bagfiles/ and record messages
rosbag record -a
# to record only image topic
rosbag record -O subset /raspicam/image/compressed
  1. If bag file has several topics , but you need only one, just filter rosbag with
rosbag filter subset.bag <NEW_NAME>.bag 'topic == "<YOUR_TOPIC>"'
  1. to extract image files from bag
# create launch file with
<launch>
  <node pkg="rosbag" type="play" name="rosbag" required="true" args="$(find path_from_image)/bagfiles/subset.bag"/>
  <node name="extract" pkg="image_view" type="extract_images" respawn="false" required="true" output="screen" cwd="<FOLDER_TO_SAVE_IMAGES>">
    <remap from="image" to="raspicam/image_raw"/>
  </node>
</launch>

#to decompress images also run in terminal
rosrun image_transport republish compressed in:=raspicam/image raw out:=raspicam/image_raw