-
Notifications
You must be signed in to change notification settings - Fork 663
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(pointcloud_preprocessor): update azimuth and distance in distortion_correction_node #5560
Conversation
@badai-nguyen @miursh Can you review this? |
sensing/pointcloud_preprocessor/src/distortion_corrector/distortion_corrector.cpp
Outdated
Show resolved
Hide resolved
sensing/pointcloud_preprocessor/src/distortion_corrector/distortion_corrector.cpp
Outdated
Show resolved
Hide resolved
@vividf Thank you for your PR. |
@@ -302,6 +307,10 @@ bool DistortionCorrectorComponent::undistortPointCloud( | |||
*it_y = static_cast<float>(undistorted_point.getY()); | |||
*it_z = static_cast<float>(undistorted_point.getZ()); | |||
|
|||
if (update_azimuth_and_distance_) { | |||
*it_distance = sqrt(*it_x * *it_x + *it_y * *it_y + *it_z * *it_z); | |||
*it_azimuth = cv::fastAtan2(*it_y, *it_x) * 100; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@vividf
As fastAtan2 function description, the accuracy is 0.3 deg which greater than VLS128 azimuth resolution (~0.2deg) so do you think some beams' order in a ring might be changed?
Anyway, IMO, even it's happened, it changes only 1 beam so it will not affect other filters result, such as Dual_return_filter which uses rertified topic as input. @miursh @drwnz Do you have any concern about this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it should be fine for now - if we run into issues we could optionally use a custom look up table implementation or use a method which has higher accuracy (at higher computational cost) but as you mention, I doubt that this will cause any problems for the modules which actually use azimuth.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Co-authored-by: badai nguyen <[email protected]>
Co-authored-by: badai nguyen <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please see the comments about README. Thanks!
…n_node_update_azimuth_and_distance
…n_node_update_azimuth_and_distance
This pull request has been automatically marked as stale because it has not had recent activity. |
…n_node_update_azimuth_and_distance
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #5560 +/- ##
==========================================
- Coverage 14.79% 14.78% -0.01%
==========================================
Files 1915 1917 +2
Lines 132361 132052 -309
Branches 39339 39228 -111
==========================================
- Hits 19580 19523 -57
+ Misses 90946 90740 -206
+ Partials 21835 21789 -46
*This pull request uses carry forward flags. Click here to find out more. ☔ View full report in Codecov by Sentry. |
…n_node_update_azimuth_and_distance
…n_node_update_azimuth_and_distance
Signed-off-by: vividf <[email protected]>
This pull request has been automatically marked as stale because it has not had recent activity. |
@vividf can you please update the status of this PR? Thanks! |
@drwnz |
Description
This PR solves issue #3896
This PR updates the azimuth and distance value based on the undistorted xyz value. The user can decide to use this feature by setting the parameter
update_azimuth_and_distance
to true.The distance is calculated with the undistorted xyz value.
The azimuth is calculated by using an undistorted xy value with the
cv::fastAtan2
. By usingcv::fastAtan2
instead ofatan2
, it can fasten the calculation 6 times faster with negligible error.For different frames:
base_link: If the frame of the input pointcloud is base_link, even the
update_azimuth_and_distance
is set to true, we won't update the azimuth and distance, as it didn't make sense to update these value when the frame is in base_link.sensor_frame: If the frame of the input pointcloud is sensor_frames, we will update the azimuth value and distance value for each point. However different sensors have different coordinate systems after the nebula driver. For example, Velodyne pointcloud defines the x-axis as 0 degrees, but the y-axis as 270 degrees. Hesai pointcloud defines the y-axis as 0 degrees and the x-axis as 90 degrees. Both of them are rotating clockwise.
To solve this problem, we update the azimuth value based on the Cartesian coordinate system, in which the x-axis is 0 degrees and the y-axis is 90 degrees. For instance, the below result is recorded when the input pointcloud of the distortion correction node is
/sensing/lidar/top/pointcloud_raw_ex
, and the frame_id is velodyne_top.Based on this situation, I write documentation in the readme to notify the user that they should be aware of the azimuth of the Lidar.
Tests performed
Testing rosbag is from the sample rosbag: https://autowarefoundation.github.io/autoware-documentation/main/tutorials/ad-hoc-simulation/rosbag-replay-simulation/
Test with launching
ros2 launch autoware_launch logging_simulator.launch.xml map_path:=$HOME/autoware_map/sample-map-rosbag vehicle_model:=sample_vehicle sensor_model:=sample_sensor_kit
Result of the updated azimuth and distance value:
Notes for reviewers
@drwnz
The user can only change the parameter via the console with this single PR.
I also set the parameter in the nebula_node_container.launch.py in this PR (autowarefoundation/sample_sensor_kit_launch#81), which can change the parameter more easily.
I also want to do the same thing for the https://github.com/RobotecAI/awsim_sensor_kit_launch/blob/main/common_awsim_sensor_launch/launch/velodyne_node_container.launch.py#L132C1-L140C64
Interface changes
Added a new parameter
update_azimuth_and_distance
for the user to decide whether they want to update the azimuth and distance value.Effects on system behavior
The default value of the
update_azimuth_and_distance
is False, which won't cause any change to the system. If the user wants to update the azimuth and distance, then they can set the parameter to True via launch file or consoleros2 param set /distortion_corrector_node update_azimuth_and_distance True
.Once the
update_azimuth_and_distance
is set to True, the time cost will increase by around 13% for the distortion correction node (around 1 ms on my laptop).Performance analysis:
Below testing runs the rosbag with a total of 81 frames of pointcloud.
Pre-review checklist for the PR author
The PR author must check the checkboxes below when creating the PR.
In-review checklist for the PR reviewers
The PR reviewers must check the checkboxes below before approval.
Post-review checklist for the PR author
The PR author must check the checkboxes below before merging.
After all checkboxes are checked, anyone who has write access can merge the PR.