How to Convert PCAP to ROS Bag for Ouster Sensors

This article describes the method for converting a network capture file (pcap) into a rosbag file that can be played back in the /ouster_example/ouster_ros ROS node.

Installing Dependencies

Install libpcap-dev libtins-dev

  1. $ sudo apt update

  2. $ sudo apt install libpcap-dev libtins-dev

Installing pcap-to-bag

  1. Clone the pcap-to-bag repository

    1. $ git clone git@github.com:Krishtof-Korda/pcap-to-bag.git

  2. Make a catkin_workspace

    1. $ mkdir -p myworkspace/src && cd myworkspace

  3. Symlink the pcap-to-bag folder into your ouster_example catkin_workspace

    1. $ ln -s /path/to/ouster_example ./src/ && ln -s /path/to/pcap-to-bag ./src/

  4. Build the catkin_workspace which includes ouster_example and pcap-to-bag

    1. $ catkin_make -DCMAKE_BUILD_TYPE=Release

Converting a PCAP

  1. After building, the pcap_to_bag executable will be in this folder:myworkspace/devel/lib/pcap_to_bag/

  2. You can run the executable using

    1.  $ ./pcap_to_bag name_of_pcap.pcap name_of_bag.bag number_of_laser_channels

  3. e.g. for a 128 channel sensor 

    1. $ ./pcap_to_bag my.pcap my.bag 128