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

test(autoware_universe_utils): make opencv_fast_atan2 test reproducible #9728

Conversation

mojomex
Copy link
Contributor

@mojomex mojomex commented Dec 23, 2024

Description

PR #9710 made the random numbers used in the trigonometry_opencv_fast_atan2 test random, but introduced made the test non-reproducible.
The common wisdom is to initialize all random number generators used in unit tests with a fixed seed, so the same numbers are generated across test runs.

This PR does that for the abovementioned test.

Related links

How was this PR tested?

Printing x/y similar to #9710. Note how before this PR, the values change across runs, whereas with this PR they stay constant (reproducible).

Before:

# Run 1
x=-7.54321    y=1.59532
x=-1.60106    y=-9.32045
x=2.97877     y=-3.35861
# Run 2
x=-1.19224    y=8.64908
x=-0.808514   y=-0.856808
x=5.27276     y=5.93498

After:

# Run 1
x=6.29447     y=-7.29046
x=8.11584     y=6.70017
x=-7.46026    y=9.37736
# Run 2
x=6.29447     y=-7.29046
x=8.11584     y=6.70017
x=-7.46026    y=9.37736

Effects on system behavior

None.

@mojomex mojomex requested a review from veqcc December 23, 2024 08:09
@github-actions github-actions bot added the component:common Common packages from the autoware-common repository. (auto-assigned) label Dec 23, 2024
Copy link

github-actions bot commented Dec 23, 2024

Thank you for contributing to the Autoware project!

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

Please ensure:

@mojomex mojomex added the run:build-and-test-differential Mark to enable build-and-test-differential workflow. (used-by-ci) label Dec 23, 2024
Copy link

codecov bot commented Dec 23, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 28.37%. Comparing base (b3c69b4) to head (b17d7ee).
Report is 7 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #9728      +/-   ##
==========================================
+ Coverage   28.33%   28.37%   +0.03%     
==========================================
  Files        1485     1485              
  Lines      111092   111091       -1     
  Branches    43152    43151       -1     
==========================================
+ Hits        31483    31520      +37     
+ Misses      76588    76544      -44     
- Partials     3021     3027       +6     
Flag Coverage Δ *Carryforward flag
differential 31.17% <ø> (?)
total 28.30% <ø> (-0.04%) ⬇️ Carriedforward from b3c69b4

*This pull request uses carry forward flags. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@xmfcx xmfcx force-pushed the fix/make-trigonometry-tests-reproducible branch from 4b4a316 to b17d7ee Compare February 4, 2025 16:33
@xmfcx
Copy link
Contributor

xmfcx commented Feb 4, 2025

@soblin @takayuki5168 @TakaHoribe @veqcc can you review?

Copy link
Contributor

@veqcc veqcc left a comment

Choose a reason for hiding this comment

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

Thank you for correcting my mistake 👍
It needs approvals from code owners

@xmfcx xmfcx merged commit b191eb1 into autowarefoundation:main Feb 5, 2025
34 checks passed
@mojomex mojomex self-assigned this Feb 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component:common Common packages from the autoware-common repository. (auto-assigned) run:build-and-test-differential Mark to enable build-and-test-differential workflow. (used-by-ci)
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants