Skip to content

Commit a7b8a10

Browse files
vividfdrwnz
andauthored
feat(pointcloud_preprocessor): support for 3d distortion correction algorithm and refactor distortion correction node (autowarefoundation#7137)
* add support for 3d distortion correction Signed-off-by: vividf <yihsiang.fang@tier4.jp> * change parameter back to default and do small refactor Signed-off-by: vividf <yihsiang.fang@tier4.jp> * init version, need to double check Signed-off-by: vividf <yihsiang.fang@tier4.jp> * fix the logic error Signed-off-by: vividf <yihsiang.fang@tier4.jp> * temporary save, need to delete some code * init done, need to check for 3d as time is high Signed-off-by: vividf <yihsiang.fang@tier4.jp> * fix error Signed-off-by: vividf <yihsiang.fang@tier4.jp> * temporaily save * clean code Signed-off-by: vividf <yihsiang.fang@tier4.jp> * remove unused parameters Signed-off-by: vividf <yihsiang.fang@tier4.jp> * fix constructor error Signed-off-by: vividf <yihsiang.fang@tier4.jp> * fix spell errors Signed-off-by: vividf <yihsiang.fang@tier4.jp> * fix more spell errors Signed-off-by: vividf <yihsiang.fang@tier4.jp> * add undistorter to library Signed-off-by: vividf <yihsiang.fang@tier4.jp> * fix: fix cmake and change class name Signed-off-by: vividf <yihsiang.fang@tier4.jp> * Update sensing/pointcloud_preprocessor/docs/distortion-corrector.md Co-authored-by: David Wong <33114676+drwnz@users.noreply.github.com> Signed-off-by: vividf <yihsiang.fang@tier4.jp> * chore: update sensing/pointcloud_preprocessor/docs/distortion-corrector.md Co-authored-by: David Wong <33114676+drwnz@users.noreply.github.com> Signed-off-by: vividf <yihsiang.fang@tier4.jp> * chore: update sensing/pointcloud_preprocessor/docs/distortion-corrector.md Co-authored-by: David Wong <33114676+drwnz@users.noreply.github.com> Signed-off-by: vividf <yihsiang.fang@tier4.jp> * chore: fix company name Co-authored-by: David Wong <33114676+drwnz@users.noreply.github.com> Signed-off-by: vividf <yihsiang.fang@tier4.jp> * chore: fix company name Co-authored-by: David Wong <33114676+drwnz@users.noreply.github.com> Signed-off-by: vividf <yihsiang.fang@tier4.jp> * chore: fix company name Co-authored-by: David Wong <33114676+drwnz@users.noreply.github.com> Signed-off-by: vividf <yihsiang.fang@tier4.jp> * chore: fix imu to IMU Co-authored-by: David Wong <33114676+drwnz@users.noreply.github.com> Signed-off-by: vividf <yihsiang.fang@tier4.jp> * chore: fix company name Co-authored-by: David Wong <33114676+drwnz@users.noreply.github.com> Signed-off-by: vividf <yihsiang.fang@tier4.jp> * chore: remove old naming Co-authored-by: David Wong <33114676+drwnz@users.noreply.github.com> Signed-off-by: vividf <yihsiang.fang@tier4.jp> * chore: change boolean variable naming Co-authored-by: David Wong <33114676+drwnz@users.noreply.github.com> Signed-off-by: vividf <yihsiang.fang@tier4.jp> * chore: change boolean variable naming Co-authored-by: David Wong <33114676+drwnz@users.noreply.github.com> Signed-off-by: vividf <yihsiang.fang@tier4.jp> * chore: change boolean variable naming Co-authored-by: David Wong <33114676+drwnz@users.noreply.github.com> Signed-off-by: vividf <yihsiang.fang@tier4.jp> * fix: fix file name and variable name Signed-off-by: vividf <yihsiang.fang@tier4.jp> * chore: fix invlaid virtual function definitions Signed-off-by: vividf <yihsiang.fang@tier4.jp> * fix: add sophus in package dependency Signed-off-by: vividf <yihsiang.fang@tier4.jp> * chore: remove brackets Signed-off-by: vividf <yihsiang.fang@tier4.jp> * chore: fix algorithm Signed-off-by: vividf <yihsiang.fang@tier4.jp> * chore: remove timestamp_field_name and add default parameter for 3d distortion Signed-off-by: vividf <yihsiang.fang@tier4.jp> * chore: fix known limits explanation Signed-off-by: vividf <yihsiang.fang@tier4.jp> * feat: add parameter schema and launch file for distortion correction node Signed-off-by: vividf <yihsiang.fang@tier4.jp> * chore: fix function name Signed-off-by: vividf <yihsiang.fang@tier4.jp> * chore: fix IMU function name Signed-off-by: vividf <yihsiang.fang@tier4.jp> * chore: fix twist and imu iterator function name Signed-off-by: vividf <yihsiang.fang@tier4.jp> * fix: add inline for undistortPointcloud function Signed-off-by: vividf <yihsiang.fang@tier4.jp> * chore: move varialbe to const Signed-off-by: vividf <yihsiang.fang@tier4.jp> * chore: fix grammar error Signed-off-by: vividf <yihsiang.fang@tier4.jp> * fix: fix inline function Signed-off-by: vividf <yihsiang.fang@tier4.jp> * chore: solve conflicts Signed-off-by: vividf <yihsiang.fang@tier4.jp> * fix: fix bug in previous code Signed-off-by: vividf <yihsiang.fang@tier4.jp> * fix: fix the template naming Signed-off-by: vividf <yihsiang.fang@tier4.jp> * fix: fix the component test Signed-off-by: vividf <yihsiang.fang@tier4.jp> * fix: solve conflicts Signed-off-by: vividf <yihsiang.fang@tier4.jp> --------- Signed-off-by: vividf <yihsiang.fang@tier4.jp> Co-authored-by: David Wong <33114676+drwnz@users.noreply.github.com>
1 parent f1e4a9e commit a7b8a10

12 files changed

+694
-269
lines changed

sensing/pointcloud_preprocessor/CMakeLists.txt

+4
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ set(CGAL_DATA_DIR ".")
99

1010
find_package(OpenCV REQUIRED)
1111
find_package(Eigen3 REQUIRED)
12+
find_package(Sophus REQUIRED)
1213
find_package(Boost REQUIRED)
1314
find_package(PCL REQUIRED)
1415
find_package(CGAL REQUIRED COMPONENTS Core)
@@ -19,6 +20,7 @@ include_directories(
1920
${Boost_INCLUDE_DIRS}
2021
${PCL_INCLUDE_DIRS}
2122
${EIGEN3_INCLUDE_DIRS}
23+
${Sophus_INCLUDE_DIRS}
2224
${OpenCV_INCLUDE_DIRS}
2325
)
2426

@@ -76,6 +78,7 @@ ament_auto_add_library(pointcloud_preprocessor_filter SHARED
7678
src/pointcloud_accumulator/pointcloud_accumulator_nodelet.cpp
7779
src/vector_map_filter/lanelet2_map_filter_nodelet.cpp
7880
src/distortion_corrector/distortion_corrector.cpp
81+
src/distortion_corrector/distortion_corrector_node.cpp
7982
src/blockage_diag/blockage_diag_nodelet.cpp
8083
src/polygon_remover/polygon_remover.cpp
8184
src/vector_map_filter/vector_map_inside_area_filter.cpp
@@ -86,6 +89,7 @@ target_link_libraries(pointcloud_preprocessor_filter
8689
faster_voxel_grid_downsample_filter
8790
${Boost_LIBRARIES}
8891
${OpenCV_LIBRARIES}
92+
${Sophus_LIBRARIES}
8993
${PCL_LIBRARIES}
9094
)
9195

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
/**:
2+
ros__parameters:
3+
base_frame: base_link
4+
use_imu: true
5+
use_3d_distortion_correction: false

sensing/pointcloud_preprocessor/docs/distortion-corrector.md

+23-20
Original file line numberDiff line numberDiff line change
@@ -2,46 +2,49 @@
22

33
## Purpose
44

5-
The `distortion_corrector` is a node that compensates pointcloud distortion caused by ego vehicle's movement during 1 scan.
5+
The `distortion_corrector` is a node that compensates for pointcloud distortion caused by the ego-vehicle's movement during one scan.
66

7-
Since the LiDAR sensor scans by rotating an internal laser, the resulting point cloud will be distorted if the ego-vehicle moves during a single scan (as shown by the figure below). The node corrects this by interpolating sensor data using odometry of ego-vehicle.
7+
Since the LiDAR sensor scans by rotating an internal laser, the resulting point cloud will be distorted if the ego-vehicle moves during a single scan (as shown by the figure below). The node corrects this by interpolating sensor data using the odometry of the ego-vehicle.
88

99
## Inner-workings / Algorithms
1010

11-
- Use the equations below (specific to the Velodyne 32C sensor) to obtain an accurate timestamp for each scan data point.
12-
- Use twist information to determine the distance the ego-vehicle has traveled between the time that the scan started and the corrected timestamp of each point, and then correct the position of the point.
11+
The node uses twist information (linear and angular velocity) from the `~/input/twist` topic to correct each point in the point cloud. If the user sets `use_imu` to true, the node will replace the twist's angular velocity with the angular velocity from IMU.
1312

14-
The offset equation is given by
15-
$ TimeOffset = (55.296 \mu s _SequenceIndex) + (2.304 \mu s_ DataPointIndex) $
13+
The node supports two different modes of distortion correction: 2D distortion correction and 3D distortion correction. The main difference is that the 2D distortion corrector only utilizes the x-axis of linear velocity and the z-axis of angular velocity to correct the point positions. On the other hand, the 3D distortion corrector utilizes all linear and angular velocity components to correct the point positions.
1614

17-
To calculate the exact point time, add the TimeOffset to the timestamp.
18-
$ ExactPointTime = TimeStamp + TimeOffset $
15+
Please note that the processing time difference between the two distortion methods is significant; the 3D corrector takes 50% more time than the 2D corrector. Therefore, it is recommended that in general cases, users should set `use_3d_distortion_correction` to `false`. However, in scenarios such as a vehicle going over speed bumps, using the 3D corrector can be beneficial.
1916

2017
![distortion corrector figure](./image/distortion_corrector.jpg)
2118

2219
## Inputs / Outputs
2320

2421
### Input
2522

26-
| Name | Type | Description |
27-
| ---------------- | ------------------------------------------------ | ---------------- |
28-
| `~/input/points` | `sensor_msgs::msg::PointCloud2` | reference points |
29-
| `~/input/twist` | `geometry_msgs::msg::TwistWithCovarianceStamped` | twist |
30-
| `~/input/imu` | `sensor_msgs::msg::Imu` | imu data |
23+
| Name | Type | Description |
24+
| -------------------- | ------------------------------------------------ | ---------------------------------- |
25+
| `~/input/pointcloud` | `sensor_msgs::msg::PointCloud2` | Topic of the distorted pointcloud. |
26+
| `~/input/twist` | `geometry_msgs::msg::TwistWithCovarianceStamped` | Topic of the twist information. |
27+
| `~/input/imu` | `sensor_msgs::msg::Imu` | Topic of the IMU data. |
3128

3229
### Output
3330

34-
| Name | Type | Description |
35-
| ----------------- | ------------------------------- | --------------- |
36-
| `~/output/points` | `sensor_msgs::msg::PointCloud2` | filtered points |
31+
| Name | Type | Description |
32+
| --------------------- | ------------------------------- | ----------------------------------- |
33+
| `~/output/pointcloud` | `sensor_msgs::msg::PointCloud2` | Topic of the undistorted pointcloud |
3734

3835
## Parameters
3936

4037
### Core Parameters
4138

42-
| Name | Type | Default Value | Description |
43-
| ---------------------- | ------ | ------------- | ----------------------------------------------------------- |
44-
| `timestamp_field_name` | string | "time_stamp" | time stamp field name |
45-
| `use_imu` | bool | true | use gyroscope for yaw rate if true, else use vehicle status |
39+
{{ json_to_markdown("sensing/pointcloud_preprocessor/schema/distortion_corrector.schema.json") }}
40+
41+
## Launch
42+
43+
```bash
44+
ros2 launch pointcloud_preprocessor distortion_corrector.launch.xml
45+
```
4646

4747
## Assumptions / Known limits
48+
49+
- The node requires time synchronization between the topics from lidars, twist, and IMU.
50+
- If you want to use a 3D distortion corrector without IMU, please check that the linear and angular velocity fields of your twist message are not empty.

sensing/pointcloud_preprocessor/include/pointcloud_preprocessor/distortion_corrector/distortion_corrector.hpp

+111-31
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2020 Tier IV, Inc.
1+
// Copyright 2024 TIER IV, Inc.
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.
@@ -15,7 +15,9 @@
1515
#ifndef POINTCLOUD_PREPROCESSOR__DISTORTION_CORRECTOR__DISTORTION_CORRECTOR_HPP_
1616
#define POINTCLOUD_PREPROCESSOR__DISTORTION_CORRECTOR__DISTORTION_CORRECTOR_HPP_
1717

18+
#include <Eigen/Core>
1819
#include <rclcpp/rclcpp.hpp>
20+
#include <sophus/se3.hpp>
1921

2022
#include <geometry_msgs/msg/twist_stamped.hpp>
2123
#include <geometry_msgs/msg/twist_with_covariance_stamped.hpp>
@@ -33,54 +35,132 @@
3335
#endif
3436

3537
#include <tf2_ros/buffer.h>
38+
#include <tf2_ros/buffer_interface.h>
3639
#include <tf2_ros/transform_listener.h>
3740

38-
// Include tier4 autoware utils
39-
#include <autoware/universe_utils/ros/debug_publisher.hpp>
40-
#include <autoware/universe_utils/system/stop_watch.hpp>
41-
4241
#include <deque>
4342
#include <memory>
4443
#include <string>
4544

4645
namespace pointcloud_preprocessor
4746
{
48-
using rcl_interfaces::msg::SetParametersResult;
49-
using sensor_msgs::msg::PointCloud2;
5047

51-
class DistortionCorrectorComponent : public rclcpp::Node
48+
class DistortionCorrectorBase
5249
{
5350
public:
54-
explicit DistortionCorrectorComponent(const rclcpp::NodeOptions & options);
51+
virtual void processTwistMessage(
52+
const geometry_msgs::msg::TwistWithCovarianceStamped::ConstSharedPtr twist_msg) = 0;
53+
virtual void processIMUMessage(
54+
const std::string & base_frame, const sensor_msgs::msg::Imu::ConstSharedPtr imu_msg) = 0;
55+
virtual void setPointCloudTransform(
56+
const std::string & base_frame, const std::string & lidar_frame) = 0;
57+
virtual void initialize() = 0;
58+
virtual void undistortPointCloud(bool use_imu, sensor_msgs::msg::PointCloud2 & pointcloud) = 0;
59+
};
5560

56-
private:
57-
void onPointCloud(PointCloud2::UniquePtr points_msg);
58-
void onTwistWithCovarianceStamped(
59-
const geometry_msgs::msg::TwistWithCovarianceStamped::ConstSharedPtr twist_msg);
60-
void onImu(const sensor_msgs::msg::Imu::ConstSharedPtr imu_msg);
61-
bool getTransform(
62-
const std::string & target_frame, const std::string & source_frame,
63-
tf2::Transform * tf2_transform_ptr);
61+
template <class T>
62+
class DistortionCorrector : public DistortionCorrectorBase
63+
{
64+
public:
65+
bool pointcloud_transform_needed_{false};
66+
bool pointcloud_transform_exists_{false};
67+
bool imu_transform_exists_{false};
68+
rclcpp::Node * node_;
69+
tf2_ros::Buffer tf_buffer_;
70+
tf2_ros::TransformListener tf_listener_;
6471

65-
bool undistortPointCloud(const tf2::Transform & tf2_base_link_to_sensor, PointCloud2 & points);
72+
std::deque<geometry_msgs::msg::TwistStamped> twist_queue_;
73+
std::deque<geometry_msgs::msg::Vector3Stamped> angular_velocity_queue_;
74+
75+
explicit DistortionCorrector(rclcpp::Node * node)
76+
: node_(node), tf_buffer_(node_->get_clock()), tf_listener_(tf_buffer_)
77+
{
78+
}
79+
void processTwistMessage(
80+
const geometry_msgs::msg::TwistWithCovarianceStamped::ConstSharedPtr twist_msg) override;
81+
82+
void processIMUMessage(
83+
const std::string & base_frame, const sensor_msgs::msg::Imu::ConstSharedPtr imu_msg) override;
84+
void getIMUTransformation(
85+
const std::string & base_frame, const std::string & imu_frame,
86+
geometry_msgs::msg::TransformStamped::SharedPtr geometry_imu_to_base_link_ptr);
87+
void enqueueIMU(
88+
const sensor_msgs::msg::Imu::ConstSharedPtr imu_msg,
89+
geometry_msgs::msg::TransformStamped::SharedPtr geometry_imu_to_base_link_ptr);
90+
91+
bool isInputValid(sensor_msgs::msg::PointCloud2 & pointcloud);
92+
void getTwistAndIMUIterator(
93+
bool use_imu, double first_point_time_stamp_sec,
94+
std::deque<geometry_msgs::msg::TwistStamped>::iterator & it_twist,
95+
std::deque<geometry_msgs::msg::Vector3Stamped>::iterator & it_imu);
96+
void undistortPointCloud(bool use_imu, sensor_msgs::msg::PointCloud2 & pointcloud) override;
97+
void warnIfTimestampIsTooLate(bool is_twist_time_stamp_too_late, bool is_imu_time_stamp_too_late);
98+
void undistortPoint(
99+
sensor_msgs::PointCloud2Iterator<float> & it_x, sensor_msgs::PointCloud2Iterator<float> & it_y,
100+
sensor_msgs::PointCloud2Iterator<float> & it_z,
101+
std::deque<geometry_msgs::msg::TwistStamped>::iterator & it_twist,
102+
std::deque<geometry_msgs::msg::Vector3Stamped>::iterator & it_imu, float const & time_offset,
103+
const bool & is_twist_valid, const bool & is_imu_valid)
104+
{
105+
static_cast<T *>(this)->undistortPointImplementation(
106+
it_x, it_y, it_z, it_twist, it_imu, time_offset, is_twist_valid, is_imu_valid);
107+
};
108+
};
66109

67-
rclcpp::Subscription<PointCloud2>::SharedPtr input_points_sub_;
68-
rclcpp::Subscription<sensor_msgs::msg::Imu>::SharedPtr imu_sub_;
69-
rclcpp::Subscription<geometry_msgs::msg::TwistWithCovarianceStamped>::SharedPtr twist_sub_;
70-
rclcpp::Publisher<PointCloud2>::SharedPtr undistorted_points_pub_;
110+
class DistortionCorrector2D : public DistortionCorrector<DistortionCorrector2D>
111+
{
112+
private:
113+
// defined outside of for loop for performance reasons.
114+
tf2::Quaternion baselink_quat_;
115+
tf2::Transform baselink_tf_odom_;
116+
tf2::Vector3 point_tf_;
117+
tf2::Vector3 undistorted_point_tf_;
118+
float theta_;
119+
float x_;
120+
float y_;
121+
122+
// TF
123+
tf2::Transform tf2_lidar_to_base_link_;
124+
tf2::Transform tf2_base_link_to_lidar_;
71125

72-
std::unique_ptr<autoware::universe_utils::StopWatch<std::chrono::milliseconds>> stop_watch_ptr_;
73-
std::unique_ptr<autoware::universe_utils::DebugPublisher> debug_publisher_;
126+
public:
127+
explicit DistortionCorrector2D(rclcpp::Node * node) : DistortionCorrector(node) {}
128+
void initialize() override;
129+
void undistortPointImplementation(
130+
sensor_msgs::PointCloud2Iterator<float> & it_x, sensor_msgs::PointCloud2Iterator<float> & it_y,
131+
sensor_msgs::PointCloud2Iterator<float> & it_z,
132+
std::deque<geometry_msgs::msg::TwistStamped>::iterator & it_twist,
133+
std::deque<geometry_msgs::msg::Vector3Stamped>::iterator & it_imu, const float & time_offset,
134+
const bool & is_twist_valid, const bool & is_imu_valid);
135+
136+
void setPointCloudTransform(
137+
const std::string & base_frame, const std::string & lidar_frame) override;
138+
};
74139

75-
tf2_ros::Buffer tf2_buffer_{get_clock()};
76-
tf2_ros::TransformListener tf2_listener_{tf2_buffer_};
140+
class DistortionCorrector3D : public DistortionCorrector<DistortionCorrector3D>
141+
{
142+
private:
143+
// defined outside of for loop for performance reasons.
144+
Eigen::Vector4f point_eigen_;
145+
Eigen::Vector4f undistorted_point_eigen_;
146+
Eigen::Matrix4f transformation_matrix_;
147+
Eigen::Matrix4f prev_transformation_matrix_;
77148

78-
std::deque<geometry_msgs::msg::TwistStamped> twist_queue_;
79-
std::deque<geometry_msgs::msg::Vector3Stamped> angular_velocity_queue_;
149+
// TF
150+
Eigen::Matrix4f eigen_lidar_to_base_link_;
151+
Eigen::Matrix4f eigen_base_link_to_lidar_;
80152

81-
std::string base_link_frame_ = "base_link";
82-
std::string time_stamp_field_name_;
83-
bool use_imu_;
153+
public:
154+
explicit DistortionCorrector3D(rclcpp::Node * node) : DistortionCorrector(node) {}
155+
void initialize() override;
156+
void undistortPointImplementation(
157+
sensor_msgs::PointCloud2Iterator<float> & it_x, sensor_msgs::PointCloud2Iterator<float> & it_y,
158+
sensor_msgs::PointCloud2Iterator<float> & it_z,
159+
std::deque<geometry_msgs::msg::TwistStamped>::iterator & it_twist,
160+
std::deque<geometry_msgs::msg::Vector3Stamped>::iterator & it_imu, const float & time_offset,
161+
const bool & is_twist_valid, const bool & is_imu_valid);
162+
void setPointCloudTransform(
163+
const std::string & base_frame, const std::string & lidar_frame) override;
84164
};
85165

86166
} // namespace pointcloud_preprocessor
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
// Copyright 2024 TIER IV, Inc.
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
#ifndef POINTCLOUD_PREPROCESSOR__DISTORTION_CORRECTOR__DISTORTION_CORRECTOR_NODE_HPP_
16+
#define POINTCLOUD_PREPROCESSOR__DISTORTION_CORRECTOR__DISTORTION_CORRECTOR_NODE_HPP_
17+
18+
#include "pointcloud_preprocessor/distortion_corrector/distortion_corrector.hpp"
19+
20+
#include <autoware/universe_utils/ros/debug_publisher.hpp>
21+
#include <autoware/universe_utils/system/stop_watch.hpp>
22+
#include <rclcpp/rclcpp.hpp>
23+
24+
#include <geometry_msgs/msg/twist_stamped.hpp>
25+
#include <geometry_msgs/msg/twist_with_covariance_stamped.hpp>
26+
#include <sensor_msgs/msg/imu.hpp>
27+
#include <sensor_msgs/msg/point_cloud2.hpp>
28+
29+
#include <memory>
30+
#include <string>
31+
32+
namespace pointcloud_preprocessor
33+
{
34+
using rcl_interfaces::msg::SetParametersResult;
35+
using sensor_msgs::msg::PointCloud2;
36+
37+
class DistortionCorrectorComponent : public rclcpp::Node
38+
{
39+
public:
40+
explicit DistortionCorrectorComponent(const rclcpp::NodeOptions & options);
41+
42+
private:
43+
rclcpp::Subscription<geometry_msgs::msg::TwistWithCovarianceStamped>::SharedPtr twist_sub_;
44+
rclcpp::Subscription<sensor_msgs::msg::Imu>::SharedPtr imu_sub_;
45+
rclcpp::Subscription<PointCloud2>::SharedPtr pointcloud_sub_;
46+
47+
rclcpp::Publisher<PointCloud2>::SharedPtr undistorted_pointcloud_pub_;
48+
49+
std::unique_ptr<autoware::universe_utils::StopWatch<std::chrono::milliseconds>> stop_watch_ptr_;
50+
std::unique_ptr<autoware::universe_utils::DebugPublisher> debug_publisher_;
51+
52+
std::string base_frame_;
53+
bool use_imu_;
54+
bool use_3d_distortion_correction_;
55+
56+
std::unique_ptr<DistortionCorrectorBase> distortion_corrector_;
57+
58+
void onPointCloud(PointCloud2::UniquePtr points_msg);
59+
void onTwist(const geometry_msgs::msg::TwistWithCovarianceStamped::ConstSharedPtr twist_msg);
60+
void onImu(const sensor_msgs::msg::Imu::ConstSharedPtr imu_msg);
61+
};
62+
63+
} // namespace pointcloud_preprocessor
64+
65+
#endif // POINTCLOUD_PREPROCESSOR__DISTORTION_CORRECTOR__DISTORTION_CORRECTOR_NODE_HPP_
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<launch>
2+
<arg name="input/pointcloud" default="/sensing/lidar/top/mirror_cropped/pointcloud_ex"/>
3+
<arg name="input/twist" default="/sensing/vehicle_velocity_converter/twist_with_covariance"/>
4+
<arg name="input/imu" default="/sensing/imu/imu_data"/>
5+
<arg name="output/pointcloud" default="/sensing/lidar/top/rectified/pointcloud_ex"/>
6+
7+
<!-- Parameter -->
8+
<arg name="param_file" default="$(find-pkg-share pointcloud_preprocessor)/config/distortion_corrector_node.param.yaml"/>
9+
<node pkg="pointcloud_preprocessor" exec="distortion_corrector_node" name="distortion_corrector_node" output="screen">
10+
<remap from="~/input/pointcloud" to="$(var input/pointcloud)"/>
11+
<remap from="~/input/twist" to="$(var input/twist)"/>
12+
<remap from="~/input/imu" to="$(var input/imu)"/>
13+
<remap from="~/output/pointcloud" to="$(var output/pointcloud)"/>
14+
<param from="$(var param_file)"/>
15+
</node>
16+
</launch>

sensing/pointcloud_preprocessor/package.xml

+1
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
<depend>rclcpp</depend>
4343
<depend>rclcpp_components</depend>
4444
<depend>sensor_msgs</depend>
45+
<depend>sophus</depend>
4546
<depend>std_msgs</depend>
4647
<depend>tf2</depend>
4748
<depend>tf2_eigen</depend>

0 commit comments

Comments
 (0)