Skip to content
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

fix(pointcloud_preprocessor): fix distortion corrector unit test #7833

Merged

Conversation

vividf
Copy link
Contributor

@vividf vividf commented Jul 4, 2024

Description

@knzo25 gave some feedback on the distortion corrector unit test.
TIER4_INTERNAL_LINK

Original PR #7801
Due to the jitter of the timestamp, the threshold is a bit too strict.

6: The difference between data_ptr[i * 5] and expected_pointcloud[i][0] is 5.340576171875e-05, which exceeds 5e-5, where
6: data_ptr[i * 5] evaluates to 20.010353088378906,
6: expected_pointcloud[i][0] evaluates to 20.010299682617188, and
6: 5e-5 evaluates to 5.0000000000000002e-05.
6: [ FAILED ] DistortionCorrectorTest.TestUndistortPointCloud3dWithImuInLidarFrame (1036 ms)

More information is in the description of this PR #7879

Main changes from the previous unit test:

  • Provide a debugging parameter to print the Ground truth value.
  • Remove memcpy and use pointcloud iterator
  • Remove reinterpret_cast
  • Use the self-defined timestamp instead of node_->get_clock()->now() to prevent some jitter between points' stamp.
  • Add tests for pure linear motion and pure rotation motion.

The 2D algorithm in the distortion corrector uses tier4::cos/sin and quat.setvalue(0, 0, 0.5 * angle, 0.5 * angle), both of which can speed up the process. However, the values produced by these methods differ from those obtained using std::cos/sin, quat.setRPY(0, 0, angle) and exponential map. As a result, the 2D and 3D algorithms will not yield equivalent outcomes when comparing pure rotational motions.

Build & Test

colcon build --symlink-install --cmake-args -DCMAKE_BUILD_TYPE=Release --packages-select pointcloud_preprocessor

Test

colcon test --packages-select pointcloud_preprocessor --event-handlers console_cohesion+

Related links

Parent Issue:

  • Link

How was this PR tested?

Notes for reviewers

None.

Interface changes

None.

Effects on system behavior

None.

vividf added 2 commits July 4, 2024 14:46
Signed-off-by: vividf <yihsiang.fang@tier4.jp>
Signed-off-by: vividf <yihsiang.fang@tier4.jp>
@vividf vividf self-assigned this Jul 4, 2024
@github-actions github-actions bot added the component:sensing Data acquisition from sensors, drivers, preprocessing. (auto-assigned) label Jul 4, 2024
Copy link

github-actions bot commented Jul 4, 2024

Thank you for contributing to the Autoware project!

🚧 If your pull request is in progress, switch it to draft mode.

Please ensure:

@vividf vividf changed the title Fix/distortion correction node unit test fix(pointcloud_preprocessor): fix distortion corrector unit test Jul 4, 2024
@vividf vividf added the run:build-and-test-differential Mark to enable build-and-test-differential workflow. (used-by-ci) label Jul 4, 2024
pre-commit-ci bot and others added 2 commits July 4, 2024 05:58
Signed-off-by: vividf <yihsiang.fang@tier4.jp>
@vividf
Copy link
Contributor Author

vividf commented Jul 4, 2024

I just cleaned my whole repository and forgot to install pre-commit again.
I installed it again so the auto fix won't show again

Copy link
Contributor

@knzo25 knzo25 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left some minor comments and questions

@knzo25
Copy link
Contributor

knzo25 commented Jul 4, 2024

@vividf
Ok, no. I remembered that I had asked for proper tests rather than comparing to a GT.
I.e., input pointcloud vs theoretical expected pointcloud (for simple cases like pure linear movement and pure rotational movement)

@knzo25
Copy link
Contributor

knzo25 commented Jul 4, 2024

I can not make it into a code suggestion, but Tier IV -> TIER IV

vividf added 5 commits July 5, 2024 10:12
Signed-off-by: vividf <yihsiang.fang@tier4.jp>
Signed-off-by: vividf <yihsiang.fang@tier4.jp>
Signed-off-by: vividf <yihsiang.fang@tier4.jp>
Signed-off-by: vividf <yihsiang.fang@tier4.jp>
Signed-off-by: vividf <yihsiang.fang@tier4.jp>
vividf and others added 9 commits July 9, 2024 11:19
Signed-off-by: vividf <yihsiang.fang@tier4.jp>
Signed-off-by: vividf <yihsiang.fang@tier4.jp>
Signed-off-by: vividf <yihsiang.fang@tier4.jp>
Signed-off-by: vividf <yihsiang.fang@tier4.jp>
Signed-off-by: vividf <yihsiang.fang@tier4.jp>
Signed-off-by: vividf <yihsiang.fang@tier4.jp>
Signed-off-by: vividf <yihsiang.fang@tier4.jp>
Signed-off-by: vividf <yihsiang.fang@tier4.jp>
@vividf vividf requested a review from knzo25 July 9, 2024 05:59
Copy link
Contributor

@knzo25 knzo25 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still some comments that need addressing

vividf added 2 commits July 9, 2024 17:08
Signed-off-by: vividf <yihsiang.fang@tier4.jp>
…:vividf/autoware.universe into fix/distortion_correction_node_unit_test
@vividf vividf requested a review from knzo25 July 9, 2024 08:15
Signed-off-by: vividf <yihsiang.fang@tier4.jp>
Copy link
Contributor

@knzo25 knzo25 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vividf
If it was not clear, there are comments left unattended

Signed-off-by: vividf <yihsiang.fang@tier4.jp>
@vividf vividf requested a review from knzo25 July 9, 2024 10:38
Copy link
Contributor

@knzo25 knzo25 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🎉

@knzo25 knzo25 enabled auto-merge (squash) July 9, 2024 11:48
@knzo25
Copy link
Contributor

knzo25 commented Jul 9, 2024

@vividf
I will auto-merge this since I want to finish the point types ASAP (and at night, when there are less merges)

@vividf
Copy link
Contributor Author

vividf commented Jul 9, 2024

Sure, thanks for the reviews!

@knzo25 knzo25 merged commit 9b20ced into autowarefoundation:main Jul 9, 2024
22 of 23 checks passed
@vividf vividf deleted the fix/distortion_correction_node_unit_test branch July 17, 2024 02:26
KhalilSelyan pushed a commit that referenced this pull request Jul 22, 2024
* fix: use pointcloud iterator instead of memcpy, remove reinterpret cast

Signed-off-by: vividf <yihsiang.fang@tier4.jp>

* chore: set default debugging parameter to false

Signed-off-by: vividf <yihsiang.fang@tier4.jp>

* style(pre-commit): autofix

* chore: run precommit

Signed-off-by: vividf <yihsiang.fang@tier4.jp>

* chore: fix TIER IV name

Signed-off-by: vividf <yihsiang.fang@tier4.jp>

* chore: changed public variables to protected and add getters

Signed-off-by: vividf <yihsiang.fang@tier4.jp>

* chore: add tolerance

Signed-off-by: vividf <yihsiang.fang@tier4.jp>

* feat: add two tests for pure linear and rotation

Signed-off-by: vividf <yihsiang.fang@tier4.jp>

* chore: change naming, fix tolerance value

Signed-off-by: vividf <yihsiang.fang@tier4.jp>

* chore: add comment for quat

Signed-off-by: vividf <yihsiang.fang@tier4.jp>

* fix: remove node_->get_clock() and use self-defined timestamp

Signed-off-by: vividf <yihsiang.fang@tier4.jp>

* chore: remove redundant parameters

Signed-off-by: vividf <yihsiang.fang@tier4.jp>

* chore: fix spell error and add tests in cmake

Signed-off-by: vividf <yihsiang.fang@tier4.jp>

* chore: move all clock->now() to self-defined time

Signed-off-by: vividf <yihsiang.fang@tier4.jp>

* chore: change function names

Signed-off-by: vividf <yihsiang.fang@tier4.jp>

* chore: remove irrelevant variable

Signed-off-by: vividf <yihsiang.fang@tier4.jp>

* chore: fix variables naming

Signed-off-by: vividf <yihsiang.fang@tier4.jp>

* chore: change boolen naming: generate_points

Signed-off-by: vividf <yihsiang.fang@tier4.jp>

* chore: add assert to make sure ms is not larger than a second

Signed-off-by: vividf <yihsiang.fang@tier4.jp>

* chore: add note

Signed-off-by: vividf <yihsiang.fang@tier4.jp>

* chore: add unifore initialization and semantic meaning for magic number

Signed-off-by: vividf <yihsiang.fang@tier4.jp>

* chore: change vector to Eigen

Signed-off-by: vividf <yihsiang.fang@tier4.jp>

* chore: fix explanation

Signed-off-by: vividf <yihsiang.fang@tier4.jp>

* chore: fix more eigen

Signed-off-by: vividf <yihsiang.fang@tier4.jp>

* chore: fix more magic numbers

Signed-off-by: vividf <yihsiang.fang@tier4.jp>

* chore: add unit

Signed-off-by: vividf <yihsiang.fang@tier4.jp>

* fix: use assert from gtest

Signed-off-by: vividf <yihsiang.fang@tier4.jp>

---------

Signed-off-by: vividf <yihsiang.fang@tier4.jp>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Kenzo Lobos Tsunekawa <kenzo.lobos@tier4.jp>
Ariiees pushed a commit to Ariiees/autoware.universe that referenced this pull request Jul 22, 2024
…owarefoundation#7833)

* fix: use pointcloud iterator instead of memcpy, remove reinterpret cast

Signed-off-by: vividf <yihsiang.fang@tier4.jp>

* chore: set default debugging parameter to false

Signed-off-by: vividf <yihsiang.fang@tier4.jp>

* style(pre-commit): autofix

* chore: run precommit

Signed-off-by: vividf <yihsiang.fang@tier4.jp>

* chore: fix TIER IV name

Signed-off-by: vividf <yihsiang.fang@tier4.jp>

* chore: changed public variables to protected and add getters

Signed-off-by: vividf <yihsiang.fang@tier4.jp>

* chore: add tolerance

Signed-off-by: vividf <yihsiang.fang@tier4.jp>

* feat: add two tests for pure linear and rotation

Signed-off-by: vividf <yihsiang.fang@tier4.jp>

* chore: change naming, fix tolerance value

Signed-off-by: vividf <yihsiang.fang@tier4.jp>

* chore: add comment for quat

Signed-off-by: vividf <yihsiang.fang@tier4.jp>

* fix: remove node_->get_clock() and use self-defined timestamp

Signed-off-by: vividf <yihsiang.fang@tier4.jp>

* chore: remove redundant parameters

Signed-off-by: vividf <yihsiang.fang@tier4.jp>

* chore: fix spell error and add tests in cmake

Signed-off-by: vividf <yihsiang.fang@tier4.jp>

* chore: move all clock->now() to self-defined time

Signed-off-by: vividf <yihsiang.fang@tier4.jp>

* chore: change function names

Signed-off-by: vividf <yihsiang.fang@tier4.jp>

* chore: remove irrelevant variable

Signed-off-by: vividf <yihsiang.fang@tier4.jp>

* chore: fix variables naming

Signed-off-by: vividf <yihsiang.fang@tier4.jp>

* chore: change boolen naming: generate_points

Signed-off-by: vividf <yihsiang.fang@tier4.jp>

* chore: add assert to make sure ms is not larger than a second

Signed-off-by: vividf <yihsiang.fang@tier4.jp>

* chore: add note

Signed-off-by: vividf <yihsiang.fang@tier4.jp>

* chore: add unifore initialization and semantic meaning for magic number

Signed-off-by: vividf <yihsiang.fang@tier4.jp>

* chore: change vector to Eigen

Signed-off-by: vividf <yihsiang.fang@tier4.jp>

* chore: fix explanation

Signed-off-by: vividf <yihsiang.fang@tier4.jp>

* chore: fix more eigen

Signed-off-by: vividf <yihsiang.fang@tier4.jp>

* chore: fix more magic numbers

Signed-off-by: vividf <yihsiang.fang@tier4.jp>

* chore: add unit

Signed-off-by: vividf <yihsiang.fang@tier4.jp>

* fix: use assert from gtest

Signed-off-by: vividf <yihsiang.fang@tier4.jp>

---------

Signed-off-by: vividf <yihsiang.fang@tier4.jp>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Kenzo Lobos Tsunekawa <kenzo.lobos@tier4.jp>
TomohitoAndo pushed a commit to tier4/autoware.universe that referenced this pull request Sep 10, 2024
…owarefoundation#7833)

* fix: use pointcloud iterator instead of memcpy, remove reinterpret cast

Signed-off-by: vividf <yihsiang.fang@tier4.jp>

* chore: set default debugging parameter to false

Signed-off-by: vividf <yihsiang.fang@tier4.jp>

* style(pre-commit): autofix

* chore: run precommit

Signed-off-by: vividf <yihsiang.fang@tier4.jp>

* chore: fix TIER IV name

Signed-off-by: vividf <yihsiang.fang@tier4.jp>

* chore: changed public variables to protected and add getters

Signed-off-by: vividf <yihsiang.fang@tier4.jp>

* chore: add tolerance

Signed-off-by: vividf <yihsiang.fang@tier4.jp>

* feat: add two tests for pure linear and rotation

Signed-off-by: vividf <yihsiang.fang@tier4.jp>

* chore: change naming, fix tolerance value

Signed-off-by: vividf <yihsiang.fang@tier4.jp>

* chore: add comment for quat

Signed-off-by: vividf <yihsiang.fang@tier4.jp>

* fix: remove node_->get_clock() and use self-defined timestamp

Signed-off-by: vividf <yihsiang.fang@tier4.jp>

* chore: remove redundant parameters

Signed-off-by: vividf <yihsiang.fang@tier4.jp>

* chore: fix spell error and add tests in cmake

Signed-off-by: vividf <yihsiang.fang@tier4.jp>

* chore: move all clock->now() to self-defined time

Signed-off-by: vividf <yihsiang.fang@tier4.jp>

* chore: change function names

Signed-off-by: vividf <yihsiang.fang@tier4.jp>

* chore: remove irrelevant variable

Signed-off-by: vividf <yihsiang.fang@tier4.jp>

* chore: fix variables naming

Signed-off-by: vividf <yihsiang.fang@tier4.jp>

* chore: change boolen naming: generate_points

Signed-off-by: vividf <yihsiang.fang@tier4.jp>

* chore: add assert to make sure ms is not larger than a second

Signed-off-by: vividf <yihsiang.fang@tier4.jp>

* chore: add note

Signed-off-by: vividf <yihsiang.fang@tier4.jp>

* chore: add unifore initialization and semantic meaning for magic number

Signed-off-by: vividf <yihsiang.fang@tier4.jp>

* chore: change vector to Eigen

Signed-off-by: vividf <yihsiang.fang@tier4.jp>

* chore: fix explanation

Signed-off-by: vividf <yihsiang.fang@tier4.jp>

* chore: fix more eigen

Signed-off-by: vividf <yihsiang.fang@tier4.jp>

* chore: fix more magic numbers

Signed-off-by: vividf <yihsiang.fang@tier4.jp>

* chore: add unit

Signed-off-by: vividf <yihsiang.fang@tier4.jp>

* fix: use assert from gtest

Signed-off-by: vividf <yihsiang.fang@tier4.jp>

---------

Signed-off-by: vividf <yihsiang.fang@tier4.jp>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Kenzo Lobos Tsunekawa <kenzo.lobos@tier4.jp>
TetsuKawa pushed a commit to tier4/autoware.universe that referenced this pull request Jan 23, 2025
…owarefoundation#7833)

* fix: use pointcloud iterator instead of memcpy, remove reinterpret cast

Signed-off-by: vividf <yihsiang.fang@tier4.jp>

* chore: set default debugging parameter to false

Signed-off-by: vividf <yihsiang.fang@tier4.jp>

* style(pre-commit): autofix

* chore: run precommit

Signed-off-by: vividf <yihsiang.fang@tier4.jp>

* chore: fix TIER IV name

Signed-off-by: vividf <yihsiang.fang@tier4.jp>

* chore: changed public variables to protected and add getters

Signed-off-by: vividf <yihsiang.fang@tier4.jp>

* chore: add tolerance

Signed-off-by: vividf <yihsiang.fang@tier4.jp>

* feat: add two tests for pure linear and rotation

Signed-off-by: vividf <yihsiang.fang@tier4.jp>

* chore: change naming, fix tolerance value

Signed-off-by: vividf <yihsiang.fang@tier4.jp>

* chore: add comment for quat

Signed-off-by: vividf <yihsiang.fang@tier4.jp>

* fix: remove node_->get_clock() and use self-defined timestamp

Signed-off-by: vividf <yihsiang.fang@tier4.jp>

* chore: remove redundant parameters

Signed-off-by: vividf <yihsiang.fang@tier4.jp>

* chore: fix spell error and add tests in cmake

Signed-off-by: vividf <yihsiang.fang@tier4.jp>

* chore: move all clock->now() to self-defined time

Signed-off-by: vividf <yihsiang.fang@tier4.jp>

* chore: change function names

Signed-off-by: vividf <yihsiang.fang@tier4.jp>

* chore: remove irrelevant variable

Signed-off-by: vividf <yihsiang.fang@tier4.jp>

* chore: fix variables naming

Signed-off-by: vividf <yihsiang.fang@tier4.jp>

* chore: change boolen naming: generate_points

Signed-off-by: vividf <yihsiang.fang@tier4.jp>

* chore: add assert to make sure ms is not larger than a second

Signed-off-by: vividf <yihsiang.fang@tier4.jp>

* chore: add note

Signed-off-by: vividf <yihsiang.fang@tier4.jp>

* chore: add unifore initialization and semantic meaning for magic number

Signed-off-by: vividf <yihsiang.fang@tier4.jp>

* chore: change vector to Eigen

Signed-off-by: vividf <yihsiang.fang@tier4.jp>

* chore: fix explanation

Signed-off-by: vividf <yihsiang.fang@tier4.jp>

* chore: fix more eigen

Signed-off-by: vividf <yihsiang.fang@tier4.jp>

* chore: fix more magic numbers

Signed-off-by: vividf <yihsiang.fang@tier4.jp>

* chore: add unit

Signed-off-by: vividf <yihsiang.fang@tier4.jp>

* fix: use assert from gtest

Signed-off-by: vividf <yihsiang.fang@tier4.jp>

---------

Signed-off-by: vividf <yihsiang.fang@tier4.jp>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Kenzo Lobos Tsunekawa <kenzo.lobos@tier4.jp>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component:sensing Data acquisition from sensors, drivers, preprocessing. (auto-assigned) run:build-and-test-differential Mark to enable build-and-test-differential workflow. (used-by-ci)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants