-
Notifications
You must be signed in to change notification settings - Fork 662
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(pointcloud_preprocessor): support for 3d distortion correction a…
…lgorithm and refactor distortion correction node (#7137) * add support for 3d distortion correction Signed-off-by: vividf <[email protected]> * change parameter back to default and do small refactor Signed-off-by: vividf <[email protected]> * init version, need to double check Signed-off-by: vividf <[email protected]> * fix the logic error Signed-off-by: vividf <[email protected]> * temporary save, need to delete some code * init done, need to check for 3d as time is high Signed-off-by: vividf <[email protected]> * fix error Signed-off-by: vividf <[email protected]> * temporaily save * clean code Signed-off-by: vividf <[email protected]> * remove unused parameters Signed-off-by: vividf <[email protected]> * fix constructor error Signed-off-by: vividf <[email protected]> * fix spell errors Signed-off-by: vividf <[email protected]> * fix more spell errors Signed-off-by: vividf <[email protected]> * add undistorter to library Signed-off-by: vividf <[email protected]> * fix: fix cmake and change class name Signed-off-by: vividf <[email protected]> * Update sensing/pointcloud_preprocessor/docs/distortion-corrector.md Co-authored-by: David Wong <[email protected]> Signed-off-by: vividf <[email protected]> * chore: update sensing/pointcloud_preprocessor/docs/distortion-corrector.md Co-authored-by: David Wong <[email protected]> Signed-off-by: vividf <[email protected]> * chore: update sensing/pointcloud_preprocessor/docs/distortion-corrector.md Co-authored-by: David Wong <[email protected]> Signed-off-by: vividf <[email protected]> * chore: fix company name Co-authored-by: David Wong <[email protected]> Signed-off-by: vividf <[email protected]> * chore: fix company name Co-authored-by: David Wong <[email protected]> Signed-off-by: vividf <[email protected]> * chore: fix company name Co-authored-by: David Wong <[email protected]> Signed-off-by: vividf <[email protected]> * chore: fix imu to IMU Co-authored-by: David Wong <[email protected]> Signed-off-by: vividf <[email protected]> * chore: fix company name Co-authored-by: David Wong <[email protected]> Signed-off-by: vividf <[email protected]> * chore: remove old naming Co-authored-by: David Wong <[email protected]> Signed-off-by: vividf <[email protected]> * chore: change boolean variable naming Co-authored-by: David Wong <[email protected]> Signed-off-by: vividf <[email protected]> * chore: change boolean variable naming Co-authored-by: David Wong <[email protected]> Signed-off-by: vividf <[email protected]> * chore: change boolean variable naming Co-authored-by: David Wong <[email protected]> Signed-off-by: vividf <[email protected]> * fix: fix file name and variable name Signed-off-by: vividf <[email protected]> * chore: fix invlaid virtual function definitions Signed-off-by: vividf <[email protected]> * fix: add sophus in package dependency Signed-off-by: vividf <[email protected]> * chore: remove brackets Signed-off-by: vividf <[email protected]> * chore: fix algorithm Signed-off-by: vividf <[email protected]> * chore: remove timestamp_field_name and add default parameter for 3d distortion Signed-off-by: vividf <[email protected]> * chore: fix known limits explanation Signed-off-by: vividf <[email protected]> * feat: add parameter schema and launch file for distortion correction node Signed-off-by: vividf <[email protected]> * chore: fix function name Signed-off-by: vividf <[email protected]> * chore: fix IMU function name Signed-off-by: vividf <[email protected]> * chore: fix twist and imu iterator function name Signed-off-by: vividf <[email protected]> * fix: add inline for undistortPointcloud function Signed-off-by: vividf <[email protected]> * chore: move varialbe to const Signed-off-by: vividf <[email protected]> * chore: fix grammar error Signed-off-by: vividf <[email protected]> * fix: fix inline function Signed-off-by: vividf <[email protected]> * chore: solve conflicts Signed-off-by: vividf <[email protected]> * fix: fix bug in previous code Signed-off-by: vividf <[email protected]> * fix: fix the template naming Signed-off-by: vividf <[email protected]> * fix: fix the component test Signed-off-by: vividf <[email protected]> * fix: solve conflicts Signed-off-by: vividf <[email protected]> --------- Signed-off-by: vividf <[email protected]> Co-authored-by: David Wong <[email protected]>
- Loading branch information
1 parent
7ea124f
commit f354a5a
Showing
12 changed files
with
694 additions
and
269 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
sensing/pointcloud_preprocessor/config/distortion_corrector_node.param.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
/**: | ||
ros__parameters: | ||
base_frame: base_link | ||
use_imu: true | ||
use_3d_distortion_correction: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
65 changes: 65 additions & 0 deletions
65
...cessor/include/pointcloud_preprocessor/distortion_corrector/distortion_corrector_node.hpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
// Copyright 2024 TIER IV, Inc. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
#ifndef POINTCLOUD_PREPROCESSOR__DISTORTION_CORRECTOR__DISTORTION_CORRECTOR_NODE_HPP_ | ||
#define POINTCLOUD_PREPROCESSOR__DISTORTION_CORRECTOR__DISTORTION_CORRECTOR_NODE_HPP_ | ||
|
||
#include "pointcloud_preprocessor/distortion_corrector/distortion_corrector.hpp" | ||
|
||
#include <autoware/universe_utils/ros/debug_publisher.hpp> | ||
#include <autoware/universe_utils/system/stop_watch.hpp> | ||
#include <rclcpp/rclcpp.hpp> | ||
|
||
#include <geometry_msgs/msg/twist_stamped.hpp> | ||
#include <geometry_msgs/msg/twist_with_covariance_stamped.hpp> | ||
#include <sensor_msgs/msg/imu.hpp> | ||
#include <sensor_msgs/msg/point_cloud2.hpp> | ||
|
||
#include <memory> | ||
#include <string> | ||
|
||
namespace pointcloud_preprocessor | ||
{ | ||
using rcl_interfaces::msg::SetParametersResult; | ||
using sensor_msgs::msg::PointCloud2; | ||
|
||
class DistortionCorrectorComponent : public rclcpp::Node | ||
{ | ||
public: | ||
explicit DistortionCorrectorComponent(const rclcpp::NodeOptions & options); | ||
|
||
private: | ||
rclcpp::Subscription<geometry_msgs::msg::TwistWithCovarianceStamped>::SharedPtr twist_sub_; | ||
rclcpp::Subscription<sensor_msgs::msg::Imu>::SharedPtr imu_sub_; | ||
rclcpp::Subscription<PointCloud2>::SharedPtr pointcloud_sub_; | ||
|
||
rclcpp::Publisher<PointCloud2>::SharedPtr undistorted_pointcloud_pub_; | ||
|
||
std::unique_ptr<autoware::universe_utils::StopWatch<std::chrono::milliseconds>> stop_watch_ptr_; | ||
std::unique_ptr<autoware::universe_utils::DebugPublisher> debug_publisher_; | ||
|
||
std::string base_frame_; | ||
bool use_imu_; | ||
bool use_3d_distortion_correction_; | ||
|
||
std::unique_ptr<DistortionCorrectorBase> distortion_corrector_; | ||
|
||
void onPointCloud(PointCloud2::UniquePtr points_msg); | ||
void onTwist(const geometry_msgs::msg::TwistWithCovarianceStamped::ConstSharedPtr twist_msg); | ||
void onImu(const sensor_msgs::msg::Imu::ConstSharedPtr imu_msg); | ||
}; | ||
|
||
} // namespace pointcloud_preprocessor | ||
|
||
#endif // POINTCLOUD_PREPROCESSOR__DISTORTION_CORRECTOR__DISTORTION_CORRECTOR_NODE_HPP_ |
16 changes: 16 additions & 0 deletions
16
sensing/pointcloud_preprocessor/launch/distortion_corrector_node.launch.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<launch> | ||
<arg name="input/pointcloud" default="/sensing/lidar/top/mirror_cropped/pointcloud_ex"/> | ||
<arg name="input/twist" default="/sensing/vehicle_velocity_converter/twist_with_covariance"/> | ||
<arg name="input/imu" default="/sensing/imu/imu_data"/> | ||
<arg name="output/pointcloud" default="/sensing/lidar/top/rectified/pointcloud_ex"/> | ||
|
||
<!-- Parameter --> | ||
<arg name="param_file" default="$(find-pkg-share pointcloud_preprocessor)/config/distortion_corrector_node.param.yaml"/> | ||
<node pkg="pointcloud_preprocessor" exec="distortion_corrector_node" name="distortion_corrector_node" output="screen"> | ||
<remap from="~/input/pointcloud" to="$(var input/pointcloud)"/> | ||
<remap from="~/input/twist" to="$(var input/twist)"/> | ||
<remap from="~/input/imu" to="$(var input/imu)"/> | ||
<remap from="~/output/pointcloud" to="$(var output/pointcloud)"/> | ||
<param from="$(var param_file)"/> | ||
</node> | ||
</launch> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.