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(map_based_prediction): add time_keeper #8176

Conversation

soblin
Copy link
Contributor

@soblin soblin commented Jul 24, 2024

Description

image

Related links

Parent Issue:

How was this PR tested?

see the pic

Notes for reviewers

None.

Interface changes

None.

Effects on system behavior

None.

@github-actions github-actions bot added the component:perception Advanced sensor data processing and environment understanding. (auto-assigned) label Jul 24, 2024
Copy link

github-actions bot commented Jul 24, 2024

Thank you for contributing to the Autoware project!

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

Please ensure:

Signed-off-by: Mamoru Sobue <mamoru.sobue@tier4.jp>
@soblin soblin force-pushed the feat/map_based_prediction/add-detail-proc-time branch from ebdf5cc to 824ea47 Compare July 24, 2024 11:54
@soblin soblin added the run:build-and-test-differential Mark to enable build-and-test-differential workflow. (used-by-ci) label Jul 24, 2024
Copy link

codecov bot commented Jul 24, 2024

Codecov Report

Attention: Patch coverage is 0% with 30 lines in your changes missing coverage. Please review.

Project coverage is 29.22%. Comparing base (28f9e7e) to head (95ec2e6).
Report is 4 commits behind head on main.

Files Patch % Lines
...based_prediction/src/map_based_prediction_node.cpp 0.00% 30 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8176      +/-   ##
==========================================
- Coverage   29.24%   29.22%   -0.02%     
==========================================
  Files        1596     1598       +2     
  Lines      117660   117725      +65     
  Branches    50653    50711      +58     
==========================================
  Hits        34409    34409              
- Misses      74053    74117      +64     
- Partials     9198     9199       +1     
Flag Coverage Δ *Carryforward flag
differential 1.12% <0.00%> (?)
total 29.24% <ø> (ø) Carriedforward from 824ea47

*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 added the tag:pr-agent Mark to enable PR-Agent for automated reviews. (used-by-ci) label Jul 24, 2024
@xmfcx
Copy link
Contributor

xmfcx commented Jul 24, 2024

Sorry, testing for:

@xmfcx
Copy link
Contributor

xmfcx commented Jul 24, 2024

/review

Copy link

PR Reviewer Guide 🔍

⏱️ Estimated effort to review: 2 🔵🔵⚪⚪⚪
🧪 No relevant tests
🔒 No security concerns identified
⚡ Key issues to review

Code Smell
The autoware::universe_utils::ScopedTimeTrack is added to many functions. Ensure that this does not introduce significant overhead or affect the performance of the system.

@xmfcx
Copy link
Contributor

xmfcx commented Jul 24, 2024

/improve

@@ -922,6 +928,8 @@

void MapBasedPredictionNode::mapCallback(const LaneletMapBin::ConstSharedPtr msg)
{
autoware::universe_utils::ScopedTimeTrack st(__func__, *time_keeper_);

Choose a reason for hiding this comment

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

Suggestion: Consider checking if time_keeper_ is not null before dereferencing it in the ScopedTimeTrack constructor to avoid potential null pointer dereference. [possible issue, importance: 9]

Suggested change
autoware::universe_utils::ScopedTimeTrack st(__func__, *time_keeper_);
if (time_keeper_) {
autoware::universe_utils::ScopedTimeTrack st(__func__, *time_keeper_);
}

@@ -922,6 +928,8 @@

void MapBasedPredictionNode::mapCallback(const LaneletMapBin::ConstSharedPtr msg)
{
autoware::universe_utils::ScopedTimeTrack st(__func__, *time_keeper_);

Choose a reason for hiding this comment

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

Suggestion: To improve readability and maintainability, consider creating a helper function for the repeated pattern of creating a ScopedTimeTrack object. [maintainability, importance: 7]

Suggested change
autoware::universe_utils::ScopedTimeTrack st(__func__, *time_keeper_);
auto createScopedTimeTrack = [this](const char* func_name) {
if (time_keeper_) {
return autoware::universe_utils::ScopedTimeTrack(func_name, *time_keeper_);
}
return std::optional<autoware::universe_utils::ScopedTimeTrack>{};
};
auto st = createScopedTimeTrack(__func__);

@@ -222,6 +223,9 @@ class MapBasedPredictionNode : public rclcpp::Node
bool remember_lost_crosswalk_users_;

std::unique_ptr<autoware::universe_utils::PublishedTimePublisher> published_time_publisher_;
rclcpp::Publisher<autoware::universe_utils::ProcessingTimeDetail>::SharedPtr
detailed_processing_time_publisher_;
mutable std::shared_ptr<autoware::universe_utils::TimeKeeper> time_keeper_{nullptr};

Choose a reason for hiding this comment

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

Suggestion: Consider initializing time_keeper_ directly in the member initializer list to ensure it is properly initialized when the object is created. [best practice, importance: 6]

Suggested change
mutable std::shared_ptr<autoware::universe_utils::TimeKeeper> time_keeper_{nullptr};
mutable std::shared_ptr<autoware::universe_utils::TimeKeeper> time_keeper_;

@xmfcx
Copy link
Contributor

xmfcx commented Jul 24, 2024

@soblin -san, you can use or ignore the suggestions, I hope they were useful.

My test is finished.

You can check https://autowarefoundation.github.io/autoware-documentation/main/contributing/pull-request-guidelines/ai-pr-review/#how-to-use if you find it useful.

Signed-off-by: Mamoru Sobue <mamoru.sobue@tier4.jp>
@soblin soblin enabled auto-merge (squash) July 24, 2024 12:58
@soblin soblin merged commit e46c927 into autowarefoundation:main Jul 24, 2024
29 of 30 checks passed
@soblin soblin deleted the feat/map_based_prediction/add-detail-proc-time branch July 24, 2024 13:15
soblin added a commit to tier4/autoware.universe that referenced this pull request Jul 25, 2024
Signed-off-by: Mamoru Sobue <mamoru.sobue@tier4.jp>
shmpwk pushed a commit to tier4/autoware.universe that referenced this pull request Jul 25, 2024
…#1426)

Signed-off-by: Mamoru Sobue <mamoru.sobue@tier4.jp>
chihungtzeng pushed a commit to chihungtzeng/autoware.universe that referenced this pull request Jul 26, 2024
Signed-off-by: Mamoru Sobue <mamoru.sobue@tier4.jp>
esteve pushed a commit to esteve/autoware.universe that referenced this pull request Aug 13, 2024
Signed-off-by: Mamoru Sobue <mamoru.sobue@tier4.jp>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component:perception Advanced sensor data processing and environment understanding. (auto-assigned) run:build-and-test-differential Mark to enable build-and-test-differential workflow. (used-by-ci) tag:pr-agent Mark to enable PR-Agent for automated reviews. (used-by-ci)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants