roboracing-software icon indicating copy to clipboard operation
roboracing-software copied to clipboard

rosbag post-processing

Open ebretl opened this issue 5 years ago • 2 comments

ROS bag files are logs of ROS messages. We often test our computer vision nodes by playing back bag files (using rosbag play) in simulated time so that our code thinks the robot is driving. We would like to test our mapping code in this way as well, once we collect bag files with GPS data.

Unfortunately, rosbags tend to be large files. We often wish to decrease the size of these files by limiting the number of topics and amount of time in the recording. We usually use rosbag filter to do this, but this tool has a clumsy interface. For example, beginning and ending times for trimming are specified in absolute time (e.g. 152982629.262) rather than relative to the start of the file. We would also like to have a list of topics in a text file and use this to select which topics should be in the new bag file.

We also want some new filtering features that rosbag filter does not support. We would like to filter to only include messages if the car is moving or if the car is not e-stopped (this information can be found in the /chassis_state topic).

Deliverable: rosbag_filter.py Arguments and effects:

  • --start-time T
    • Excludes all messages before this time (relative to the start time of the bag file). An exception to this should be the /tf_static topic which is a special "latched" topic that is usually only at the beginning of the bag file.
  • --end-time T
    • Excludes messages after this time, again relative to the start time
  • --exclude-estop
    • Exclude messages if /chassis_state says we're in emergency stop mode
  • --only-moving
    • Only include messages published when the wheels are spinning (according to /chassis_state or /speed)
  • --compress
    • Output file should be a compressed archive of a bag file, suitable for archive storage on the RJ server

Useful references:

  • rosbag API cookbook http://wiki.ros.org/rosbag/Cookbook
  • other Python scripts in our repo that contain the line "import rosbag"

ebretl avatar Sep 29 '19 22:09 ebretl

Ref to #160

Daniel-Martin576 avatar Oct 28 '19 23:10 Daniel-Martin576

@sriharis123 Dylan said there was some confusion on how to go about this which was holding up progress. Check out the bag_converter.py and rosbag_trajectory_csv.py under util. Those have examples of using the python rosbag library. If you need further specific help feel free to ask on here or slack.

btdubs avatar Feb 09 '20 23:02 btdubs