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): avoid unnecessary data copy #999

Merged
merged 3 commits into from
May 31, 2022

Conversation

VRichardJP
Copy link
Contributor

Description

Avoid unnecessary data copy as explained in #998

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.

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.

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

@codecov
Copy link

codecov bot commented May 31, 2022

Codecov Report

Merging #999 (6e44229) into main (a0ef0e9) will decrease coverage by 0.00%.
The diff coverage is 0.00%.

@@           Coverage Diff            @@
##            main    #999      +/-   ##
========================================
- Coverage   9.71%   9.71%   -0.01%     
========================================
  Files        953     953              
  Lines      64012   64013       +1     
  Branches   11181   11181              
========================================
  Hits        6217    6217              
- Misses     52632   52633       +1     
  Partials    5163    5163              
Flag Coverage Δ *Carryforward flag
differential 0.00% <0.00%> (?)
total 9.69% <0.00%> (ø) Carriedforward from a0ef0e9

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

Impacted Files Coverage Δ
sensing/pointcloud_preprocessor/src/filter.cpp 0.00% <0.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a0ef0e9...6e44229. Read the comment docs.

@yukkysaito
Copy link
Contributor

LGTM

Just a comment.
They were originally copied from perception_ros for the following reasons
https://github.com/autowarefoundation/autoware.universe/tree/main/sensing/pointcloud_preprocessor
image

However, I am curious as to why the copying is occurring even in the original.
https://github.com/ros-perception/perception_pcl/blob/ros2/pcl_ros/src/pcl_ros/filters/filter.cpp#L71

@VRichardJP
Copy link
Contributor Author

By the way, it seems there is the same issue with the 2 conditional transform:

PointCloud2 cloud_transformed;
if (!pcl_ros::transformPointCloud(tf_output_frame_, output, cloud_transformed, *tf_buffer_)) {
RCLCPP_ERROR(
this->get_logger(), "[computePublish] Error converting output dataset from %s to %s.",
output.header.frame_id.c_str(), tf_output_frame_.c_str());
return;
}
cloud_tf.reset(new PointCloud2(cloud_transformed));

cloud_tf.reset(new PointCloud2(cloud_transformed)); creates a copy of cloud_transformed while it could be also avoided by using a unique_ptr in the first place, like so:

    auto cloud_transformed = std::make_unique<PointCloud2>();
    if (!pcl_ros::transformPointCloud(tf_output_frame_, *cloud_tf, *cloud_transformed, *tf_buffer_)) {
      RCLCPP_ERROR(
        this->get_logger(), "[computePublish] Error converting output dataset from %s to %s.",
        cloud_tf->header.frame_id.c_str(), tf_output_frame_.c_str());
      return;
    }
    cloud_tf = std::move(cloud_transformed);

@yukkysaito
Copy link
Contributor

I'm checking to work correctly

@yukkysaito
Copy link
Contributor

I confirmed to work correctory with tutorial rosbag.

@yukkysaito yukkysaito closed this May 31, 2022
@yukkysaito yukkysaito reopened this May 31, 2022
@yukkysaito yukkysaito self-requested a review May 31, 2022 09:41
Copy link
Contributor

@yukkysaito yukkysaito left a comment

Choose a reason for hiding this comment

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

@VRichardJP LGTM
If you are ok, I'll merge this
cc @miursh @aohsato

@VRichardJP
Copy link
Contributor Author

Yes, thank you :)

@yukkysaito yukkysaito merged commit bf88d08 into autowarefoundation:main May 31, 2022
@yukkysaito
Copy link
Contributor

@VRichardJP thank you for your contribution 👍

ktro2828 pushed a commit to ktro2828/autoware.universe that referenced this pull request Jun 7, 2022
…undation#999)

* fix(pointcloud_preprocessor): avoid unnecessary data copy

Signed-off-by: Vincent Richard <[email protected]>

* ci(pre-commit): autofix

Signed-off-by: Vincent Richard <[email protected]>

* fix: avoid unnecessary cloud data copy

Signed-off-by: Vincent Richard <[email protected]>

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Signed-off-by: ktro2828 <[email protected]>
tkimura4 referenced this pull request in tier4/autoware.universe Jun 24, 2022
* fix(pointcloud_preprocessor): avoid unnecessary data copy

Signed-off-by: Vincent Richard <[email protected]>

* ci(pre-commit): autofix

Signed-off-by: Vincent Richard <[email protected]>

* fix: avoid unnecessary cloud data copy

Signed-off-by: Vincent Richard <[email protected]>

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
boyali referenced this pull request in boyali/autoware.universe Sep 28, 2022
* fix(pointcloud_preprocessor): avoid unnecessary data copy

Signed-off-by: Vincent Richard <[email protected]>

* ci(pre-commit): autofix

Signed-off-by: Vincent Richard <[email protected]>

* fix: avoid unnecessary cloud data copy

Signed-off-by: Vincent Richard <[email protected]>

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
boyali referenced this pull request in boyali/autoware.universe Oct 3, 2022
* fix(pointcloud_preprocessor): avoid unnecessary data copy

Signed-off-by: Vincent Richard <[email protected]>

* ci(pre-commit): autofix

Signed-off-by: Vincent Richard <[email protected]>

* fix: avoid unnecessary cloud data copy

Signed-off-by: Vincent Richard <[email protected]>

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
boyali referenced this pull request in boyali/autoware.universe Oct 3, 2022
* fix(pointcloud_preprocessor): avoid unnecessary data copy

Signed-off-by: Vincent Richard <[email protected]>

* ci(pre-commit): autofix

Signed-off-by: Vincent Richard <[email protected]>

* fix: avoid unnecessary cloud data copy

Signed-off-by: Vincent Richard <[email protected]>

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
@VRichardJP VRichardJP deleted the patch-1 branch October 27, 2022 22:51
satoshi-ota pushed a commit to satoshi-ota/autoware.universe that referenced this pull request Nov 29, 2023
…ving (autowarefoundation#999)

* fix(pid_longitudinal_control): not check steering convergence when moving

Signed-off-by: Takamasa Horibe <[email protected]>

* style(pre-commit): autofix

---------

Signed-off-by: Takamasa Horibe <[email protected]>
Co-authored-by: Tomoya Kimura <[email protected]>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants