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

feat(autoware_pointcloud_preprocessor): reuse collectors to reduce creation of collector and timer #10074

Merged
merged 13 commits into from
Feb 19, 2025

Conversation

vividf
Copy link
Contributor

@vividf vividf commented Feb 5, 2025

Description

#8300 introduces a collector and initializes a timer in each collector with a 100 ms interval, which leads to infinite object creation and deletion.

This PR reuses collectors that are no longer in use (i.e., those that have completed concatenation) by resetting their timers, effectively converting them into new collectors. This approach helps limit unnecessary collector creation and timer initialization.

Related links

Parent Issue:

  • Link

How was this PR tested?

Notes for reviewers

None.

Interface changes

None.

Effects on system behavior

None.

@vividf vividf added 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) labels Feb 5, 2025
@vividf vividf self-assigned this Feb 5, 2025
Copy link

github-actions bot commented Feb 5, 2025

Thank you for contributing to the Autoware project!

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

Please ensure:

@vividf vividf requested a review from mojomex February 5, 2025 12:23
Copy link

codecov bot commented Feb 5, 2025

Codecov Report

Attention: Patch coverage is 56.14035% with 25 lines in your changes missing coverage. Please review.

Project coverage is 26.76%. Comparing base (4a77f3d) to head (31e99b3).
Report is 4 commits behind head on main.

Files with missing lines Patch % Lines
...oncatenate_data/concatenate_and_time_sync_node.cpp 51.42% 12 Missing and 5 partials ⚠️
...processor/src/concatenate_data/cloud_collector.cpp 65.00% 2 Missing and 5 partials ⚠️
...sor/src/concatenate_data/combine_cloud_handler.cpp 50.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #10074      +/-   ##
==========================================
- Coverage   26.77%   26.76%   -0.01%     
==========================================
  Files        1416     1416              
  Lines      108468   108503      +35     
  Branches    41719    41730      +11     
==========================================
  Hits        29039    29039              
- Misses      76552    76587      +35     
  Partials     2877     2877              
Flag Coverage Δ *Carryforward flag
differential 21.15% <56.14%> (?)
differential-cuda 19.42% <56.14%> (?)
total 26.74% <ø> (-0.03%) ⬇️ Carriedforward from 887c6b7

*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.

Copy link
Contributor

@YoshiRi YoshiRi left a comment

Choose a reason for hiding this comment

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

LGTM in codespace, but I did not check with any rosbags.

Copy link
Contributor

@mojomex mojomex left a comment

Choose a reason for hiding this comment

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

Good stuff!
I've left a few comments in places I think could be simplified or where I'd like the more safety guarantees.

@vividf vividf requested a review from mojomex February 7, 2025 06:59
Signed-off-by: vividf <[email protected]>
Copy link
Contributor

@mojomex mojomex left a comment

Choose a reason for hiding this comment

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

Probably hard-coding number of collectors to 2 or 3 would be okay. I don't see a use case with more collectors at the moment.
Also would allow us to allocate all of them once on startup instead of dynamically.

@vividf vividf requested review from drwnz and mojomex February 12, 2025 02:38
@vividf
Copy link
Contributor Author

vividf commented Feb 13, 2025

@mojomex @drwnz kindly ping

Copy link
Contributor

@drwnz drwnz left a comment

Choose a reason for hiding this comment

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

Please see the minor grammar comment, otherwise LGTM.

Copy link
Contributor

@mojomex mojomex left a comment

Choose a reason for hiding this comment

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

I've finally gotten around to test it! I used some gen1 taxi data and copied its concat parameters from one of our projects.

Looking good I think!
One question that might as well be me not understanding how to configure concat:
When deliberately messing up the params for one LiDAR, I would (intuitively) expect that there isn't a huge drop in concat output frequency, but rather that a group is dropped only sometimes, or every second time, etc.

I think this might be because we are always killing the oldest group, never giving it a chance to finish. It might also be because my timeouts are so long that almost all waiting collectors will be cleared because the inputs come at 10Hz.

Let me know your thoughts 🙇

Naive mode

small-compressed-naive.webm

Advanced mode, correct params

small-compressed-advanced_correct.webm

Advanced mode, incorrect params

small-compressed-advanced_incorrect.webm

@vividf vividf requested a review from mojomex February 19, 2025 05:08
Copy link
Contributor

@mojomex mojomex left a comment

Choose a reason for hiding this comment

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

After talking offline, it is clear that a user can always misconfigure concat enough to look like the bottom video - that's the user's fault, but the algorithm itself seems to work fine 👍
LGTM

@vividf vividf enabled auto-merge (squash) February 19, 2025 05:18
@vividf vividf disabled auto-merge February 19, 2025 05:31
@vividf vividf merged commit 59f2208 into autowarefoundation:main Feb 19, 2025
33 of 34 checks passed
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
Status: Done
Development

Successfully merging this pull request may close these issues.

4 participants