leofansq / Tools_RosBag2KITTI

Conversion from ROSBAG (.bag) to image (.png) and points cloud (.bin), including ROSBAG decoding, pcd2bin and file directory extraction.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

About

2D images and 3D points cloud are the two most commonly used data of intelligent vehicles, which are usually recorded in ROSBAG format via the ROS system in actual engineering practice. However, the visual and LiDAR data in the public dataset (e.g. KITTI) for research are saved as .png and .bin files respectively. To bridge the gap between engineering and research, this repository provides a tool to get .png and .bin from .bag.

How to use

(1) Decode ROSABG

The recorded ROSBAG are firstly decoded into .png for image and .pcd for points cloud.

  • Build the project in the ROS workspace

     cd catkin_ws
     catkin_make
  • [Optional] Setup the parameters in map_generation_node.cpp to achieve the rotation and translation of the coordinate system.

    All parameters for the rotation are angular and the clockwise is positive.

  • Decode ROSBAG to .png and .pcd, the results are saved in output.

     # 1st terminal for ROS core
     roscore
     # 2nd terminal for decoding node
     ./devel/lib/obstacle_detection/map_generate
     # 3rd terminal for ROSBAG playing, 0.1 means 0.1 times speed
     rosbag play xxx.bag -r 0.1

    The actual play speed of ROSBAG is determined by the IO performance. Please adjust the speed to ensure the timestamps are within +/- 50 ms.

(2) Convert .pcd to .bin

The points cloud is further converted from .pcd to .bin.

  • Build the project

     mkdir CMakeFile
     cd CMakeFile
     cmake ..
     make
  • Setup: Move the .pcd files to pcd, and set the path in pcd2bin.cpp.

  • Convertion

     cd CMakeFile
     ./pcd2bin

    The results are saved in bin.

(3) Create file list

Generate the list of the subset files for training or validation, e.g. train.txt and val.txt in KITTI.

  • Get the file list
     cd bin
     ls -1 | grep ".bin$" > list.txt
     python get_list.py

    The results are saved in bin named files_list.txt.

About

Conversion from ROSBAG (.bag) to image (.png) and points cloud (.bin), including ROSBAG decoding, pcd2bin and file directory extraction.

License:MIT License


Languages

Language:CMake 53.0%Language:C++ 45.0%Language:Python 2.0%