ethz-asl / wavemap

Fast, efficient and accurate multi-resolution, multi-sensor 3D occupancy mapping
https://ethz-asl.github.io/wavemap/
BSD 3-Clause "New" or "Revised" License
457 stars 42 forks source link

Generalize on-the-fly pointcloud undistortion to support different LiDAR types #11

Closed victorreijgwart closed 1 year ago

victorreijgwart commented 1 year ago

Before this PR, wavemap had two InputHandlers for point clouds. One for standard PointCloud2 msgs (called PointcloudInputHandler) and one for Livox's CustomMsg (LivoxInputHandler). The main difference between the two was that the LivoxInputHandler would also automatically undistort the input point clouds. This PR generalizes the undistortion to handle pointclouds from both Ouster and Livox, and makes it very easy to add support for additional LiDAR brands. The PR also includes some minor refactoring to increase consistency and make the library easier to use.

On a technical level, the undistortion is an improved, optimized version of the lidar_undistortion I wrote for SubT. It works by sampling the odometry TF at a high rate (400Hz), transforming all pointcloud points into world frame using their individual time stamps, and then transforming them back into the LiDAR frame. The motivation to undistort directly in wavemap is that it adds no noticeable overhead and makes it very easy to set up (1 ros param). The cost of running the undistortion in a separate package, like lidar_undistortion, is that it spends around 80% of its CPU time on serialization/deserialization and adds latency. Wavemap offers the option to republish its (undistorted) input point clouds, so other packages can also use them.

In terms of installation, support for PointCloud2 msgs (which also includes Ouster) is always available. Support for Livox's CustomMsg is automatically compiled in when the Livox ROS driver is available. If the user configures wavemap to use a pointcloud topic of Livox type, a warning msg is shown at startup explaining which package to install before recompiling wavemap.

victorreijgwart commented 1 year ago

Thanks a lot for your review @helenol!