Skip to content

Instantly share code, notes, and snippets.

@nerovalerius
Last active November 26, 2023 07:04
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nerovalerius/80133f409f9ed0573522432244298195 to your computer and use it in GitHub Desktop.
Save nerovalerius/80133f409f9ed0573522432244298195 to your computer and use it in GitHub Desktop.
Instructions on how to create a LIDAR dataset with semantic labels in "semantic KITTI" Format

Prerequisites

Tested on Ubuntu 22.04 with an Nvidia RTX 3090

  1. Install ROS2 Humble: LINK

  2. Set up a ROS2 workspace: LINK
    2a. prepare automatic sourcing of the ROS2 installation and workspace:

    echo "source /opt/ros/humble/setup.bash" >> ~/.bashrc
    echo "source /home/user/ros2_ws/install/setup.bash" >> ~/.bashrc  
    

    where the second line must be adapted to your ros2 workspace. Afterwards, source the bashrc file (source ~/.bashrc) or simply close your terminal and open an new one (thus bashrc is loaded).

  3. Clone the pointcloud merge node: LINK

  4. Set up a Second workspace for Point Labeler and SuMa -> See Instructions at: LINK

  5. Install Point Labeler: LINK

  6. Install Surfel Based Mapping (SuMa): LINK 5a. One dependency of SuMa is GTSAM. On Ubuntu 22.04 there is currently no pre-built package for GTSAM. After installing GTSAM's dependencies, build GTSAM with:

    cd ~
    git clone https://github.com/borglab/gtsam.git
    cd gtsam
    mkdir build
    cd build
    cmake ..
    sudo make install
    
  7. Install pcd2bin: LINK

Usage

  1. Create a folder structure which meets the KITTI standard LINK:

    mkdir -p ~/dataset/pointclouds
    cd ~/dataset
    mkdir rosbags
    mkdir -p sequences/00/velodyne
    cd sequences/00
    mkdir labels
    
  2. Record ROSBAG of your LiDAR Data. In our case, this data is made out of 5 x Livox Horizon LiDARs:
    ros2 bag record <params>

  3. Start the pointcloud merge node inside ~/dataset/pointclouds. (the pcd files are stored in the folder in which the node is started):
    https://github.com/nerovalerius/pointcloud_merge_and_kitti.

  4. Start playback of the ROSBAG within 5 seconds. Otherwise the pointcloud merge node quits.
    ros2 bag play rosbag2_2022_06_21-12_56_43_0.db3 -s sqlite3 --rate 0.5.

  5. Convert the .pcd files with the pcd2bin node and store the .bin files inside ~/dataset/sequences/00/velodyne:
    ros2 run pcd2bin_kitti pcd2bin.

  6. create a dummy calibration file inside your created sequence: nano ~/dataset/sequences/00/calib.txt and fill it with:

    P0: 1 0 0 0 0 1 0 0 0 0 1 0
    P1: 1 0 0 0 0 1 0 0 0 0 1 0
    P2: 1 0 0 0 0 1 0 0 0 0 1 0
    P3: 1 0 0 0 0 1 0 0 0 0 1 0
    Tr: 1 0 0 0 0 1 0 0 0 0 1 0
    
  7. Run SuMa with: ~/catkin_ws/src/SuMa/bin/visualizer and open the first binary pointcloud of the sequence, e.g.: ~/dataset/sequences/00/full_cloud_00001.bin

    Run SuMa to get a poses.txt file for your sequence by pressing the PLAY button and then save poses.txt to the ~/dataset/sequences/00/ folder. SuMa creates a posegraph for your pointcloud sequence.

    Each pointcloud then gets a absolute position in a world_frame, which is used to load a complete sequence of pointclouds into the Point Labeler. This means that a large number of pointclouds can be labelled at once.

  8. Open ~/dataset/sequences/00/ with Point Labeler. Run Point Labeler with:
    ~/catkin_ws/src/point_labeler/bin/labeler
    Point Labeler generates then generates the labes in the correct semantic KITTI format.

@opedromartins
Copy link

Hey Armin,

I'm currently trying to follow your instructions to set up the Pointcloud Merge Node, and I've run into a obstacle while attempting to set up a workspace for Point Labeler in ROS2. I'm having trouble adapting the workspace setup accordingly, since it was written to work with catkin on ROS1.

I was wondering if you could provide some guidance on how to modify the setup for Point Labeler to be compatible with ROS2. Do you have any suggestions or a workaround for this? I'd really appreciate your help in getting this sorted out.

Thanks a bunch!

@nerovalerius
Copy link
Author

Hi! You dont need point labeler inside a ros2 workspace. Simply follow the instructions on the kitti page for the point labeler setup.
Basically you set up a separate catking workspace for point labeler. Build it and then run the point labeler binary. Is there a specific reason why you want to build point labeler in a ros2 workspace?

Best,
Armin

@opedromartins
Copy link

Thanks for the quick response!
I misunderstood the instructions and thought it needed to be in a ROS2 workspace. I am indeed having trouble building the Point Labeler package in Ubuntu 22, which uses colcon instead of catkin. Since the original instructions were tailored for ROS1 and Ubuntu 18 with catkin, I'm encountering difficulties adapting them to the new environment.

I tried following this tutorial: https://github.com/jbehley/point_labeler#build

Best,
Pedro

@nerovalerius
Copy link
Author

catkin and colcon are both part of ros 1/2 and not ubuntu.

Simply make a second workspace only for point labeler and keep your ros2 workspace separated.
If you then follow the instructions of point labeler in ubuntu 22, what are the problems/error messages you encounter?

@opedromartins
Copy link

I figured out what was going wrong and got it all sorted. Thanks a bunch for your help - it worked like a charm!

I had a little trouble in step 6 (SuMa) because of a GTSAM error, probably some version thing. But fixed it by changing step 5a and installing GTSAM pre-built package like so:

sudo add-apt-repository ppa:borglab/gtsam-release-4.2 -y
sudo apt install libgtsam-dev libgtsam-unstable-dev -y

Then everything worked fine. Appreciate your help once again.

Best,
Pedro

@nerovalerius
Copy link
Author

Perfect. Let me know if you need any help.

Best,
Armin

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment