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

perf(probabilistic_occupancy_grid_map): performance tuning for pointcloud based occupancy grid map #7687

Merged
merged 20 commits into from
Jul 16, 2024

Conversation

taisa1
Copy link
Contributor

@taisa1 taisa1 commented Jun 25, 2024

Description

This PR makes pointcloud based occupancy grid map faster without changing logical output.

The tail latency of the probabilistic_occupancy_grid_map (type: OccupancyGridMapFixedBlindSpot) gets about x1.5 faster with this PR merged.

image

Pointcloud based occupancy grid map has two types.
This PR focuses on OccupancyGridMapFixedBlindSpot (default type), but it also changes implementation of OccupancyGridMapProjectiveBlindSpot.

The main changes are as follows:

  • Processed points without making new PointCloud2 as much as possible.
  • Used std::vector more efficiently, such as use of emplace_back and reserve, to reduce the cost of memory allocation.
  • Replaced std::hypot with std::sqrt.

In addition, some small changes are made to improve performance.

Measurement Condition

  • Ubuntu22.04 + ROS2 Humble + Autoware Universe rosbag simulation
  • Core Isolated
  • Core Frequency Fixed (2.3GHz)
  • L3 Cache: 24MB

Related links

Private Links:

Tests performed

Local test

It has been verified that the content of output topics with the same timestamp is identical before and after the PR.

Download files from https://drive.google.com/drive/folders/1rxwKyDgtOYEfnNyFPES1hga2I_-KCK0l. This folder contains files for rosbag simulation, topic output as csv, and script for comparison.
For comparing results, run python3 python3 validator.py default_(fix|projective).csv pr_(fix|projective).csv.

Evaluator test

The perception mode test has been passed.
https://github.com/tier4/auto-evaluator/actions/runs/9855260202

Notes for reviewers

None.

Interface changes

None.

Effects on system behavior

None.

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.

  • The PR follows the pull request guidelines.
  • The PR has been properly tested.
  • The PR has been reviewed by the code owners.

Post-review checklist for the PR author

The PR author must check the checkboxes below before merging.

  • There are no open discussions or they are tracked via tickets.
  • The PR is ready for merge.

After all checkboxes are checked, anyone who has write access can merge the PR.

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

github-actions bot commented Jun 25, 2024

Thank you for contributing to the Autoware project!

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

Please ensure:

@taisa1 taisa1 force-pushed the perf_occupancy_grid_map branch from 3fb5ce1 to dda0c0d Compare June 25, 2024 10:03
Copy link
Contributor

@atsushi421 atsushi421 left a comment

Choose a reason for hiding this comment

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

Please insert blank lines into your code to improve readability.
https://medium.com/@wijithbandara/best-practices-in-coding-9b9ffbdbfe27

@atsushi421 atsushi421 self-requested a review July 9, 2024 10:56
Copy link
Contributor

@atsushi421 atsushi421 left a comment

Choose a reason for hiding this comment

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

LGTM

@atsushi421 atsushi421 marked this pull request as ready for review July 11, 2024 01:20
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.

Cool! LGTM

@atsushi421 atsushi421 added the run:build-and-test-differential Mark to enable build-and-test-differential workflow. (used-by-ci) label Jul 16, 2024
Signed-off-by: taisa1 <[email protected]>
Copy link

codecov bot commented Jul 16, 2024

Codecov Report

Attention: Patch coverage is 63.46154% with 38 lines in your changes missing coverage. Please review.

Project coverage is 28.44%. Comparing base (f716b5b) to head (71974b3).
Report is 74 commits behind head on main.

Files Patch % Lines
...p/lib/costmap_2d/occupancy_grid_map_projective.cpp 0.00% 31 Missing ⚠️
...d_map/pointcloud_based_occupancy_grid_map_node.cpp 50.00% 3 Missing and 2 partials ⚠️
...cy_grid_map/costmap_2d/occupancy_grid_map_base.hpp 75.00% 0 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7687      +/-   ##
==========================================
+ Coverage   28.42%   28.44%   +0.01%     
==========================================
  Files        1591     1592       +1     
  Lines      116213   116265      +52     
  Branches    49606    49606              
==========================================
+ Hits        33039    33077      +38     
- Misses      74174    74188      +14     
  Partials     9000     9000              
Flag Coverage Δ *Carryforward flag
differential 11.34% <63.46%> (?)
total 28.41% <ø> (-0.02%) ⬇️ Carriedforward from f716b5b

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

@atsushi421 atsushi421 merged commit ee097c5 into autowarefoundation:main Jul 16, 2024
29 of 30 checks passed
@atsushi421 atsushi421 deleted the perf_occupancy_grid_map branch July 16, 2024 07:32
Ariiees pushed a commit to Ariiees/autoware.universe that referenced this pull request Jul 22, 2024
…loud based occupancy grid map (autowarefoundation#7687)

* perf: performance tuning

Signed-off-by: taisa1 <[email protected]>

* fix: remove unnecessary change

Signed-off-by: taisa1 <[email protected]>

* chore: edit comments

Signed-off-by: taisa1 <[email protected]>

* fix: change the way of offset initialization

Signed-off-by: taisa1 <[email protected]>

* fix: compile error and name

Signed-off-by: taisa1 <[email protected]>

* fix: take common parts as func

Signed-off-by: taisa1 <[email protected]>

* refactor: change variable name

Signed-off-by: taisa1 <[email protected]>

* refactor: add some blank lines

Signed-off-by: taisa1 <[email protected]>

* fix: made unapplied change

Signed-off-by: taisa1 <[email protected]>

* fix: compile error

Signed-off-by: taisa1 <[email protected]>

* refactor: simplified conditions

Signed-off-by: taisa1 <[email protected]>

* fix: apply changes to projective

Signed-off-by: taisa1 <[email protected]>

* fix: remove reserve from projective

Signed-off-by: taisa1 <[email protected]>

* refactor: reduce too many arguments

Signed-off-by: taisa1 <[email protected]>

* refactor: delete angle_increment

Signed-off-by: taisa1 <[email protected]>

* fix: reflect review

Signed-off-by: taisa1 <[email protected]>

* fix: build error

Signed-off-by: taisa1 <[email protected]>

---------

Signed-off-by: taisa1 <[email protected]>
Co-authored-by: atsushi yano <[email protected]>
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)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants