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(image_projection_based_fusion): substitute message filter with custom synchronizer #2175

Merged

Conversation

tzhong518
Copy link
Contributor

@tzhong518 tzhong518 commented Oct 28, 2022

Signed-off-by: tzhong518 sworgun@gmail.com

Description

message_filters::sync::ApproximateTime in ROS2 is designed to collect fixed-size sets of messages, which means the callback will not be called unless all messages are subscribed.
As a result, if a roi message is delayed or missed, not only the waiting time will be long but also the set it belongs to might be discarded.
On the other hand, offsets exist between the timestamps of camera and lidar, which is determined by their shutter time. The matching could be more accurate if the offsets are considered.

Therefore, we decided to use a custom synchronizer fusion callback instead of the messge_filter, which

  • adds the offsets to the pointcloud message when matching it with the rois messages
  • sets timeout in case the message is delayed, so that the painted pointcloud will still be publised even if not all cameras are painted
  • starts fuseOnSingleImage as soon as the roi msg is received to avoid waiting time

Related links

ticket: https://tier4.atlassian.net/browse/T4PB-21187?focusedCommentId=98418&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-98418
confluence pages: https://tier4.atlassian.net/wiki/spaces/~459732634/pages/2597454815
https://tier4.atlassian.net/wiki/spaces/~459732634/pages/2599911881
rosbag with yolo's result: https://drive.google.com/drive/folders/1cqXByizuWT22nYx9j_5fB42lyGJk9pzg?usp=sharing

Tests performed

Notes for reviewers

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.

tzhong518 and others added 2 commits October 28, 2022 15:46
Signed-off-by: tzhong518 <sworgun@gmail.com>
@miursh miursh self-requested a review October 28, 2022 07:01
@tzhong518 tzhong518 marked this pull request as ready for review October 28, 2022 07:22
@yukke42
Copy link
Contributor

yukke42 commented Nov 1, 2022

@tzhong518 Cloud you describe how you checked this PR solves the issue we discussed before and the results of it in the Description?

tzhong518 and others added 3 commits November 1, 2022 23:02
Co-authored-by: Yusuke Muramatsu <yukke42@users.noreply.github.com>
Co-authored-by: Yusuke Muramatsu <yukke42@users.noreply.github.com>
Co-authored-by: Yusuke Muramatsu <yukke42@users.noreply.github.com>
@codecov
Copy link

codecov bot commented Nov 1, 2022

Codecov Report

Base: 10.82% // Head: 10.79% // Decreases project coverage by -0.02% ⚠️

Coverage data is based on head (ce65279) compared to base (dd52915).
Patch coverage: 0.00% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2175      +/-   ##
==========================================
- Coverage   10.82%   10.79%   -0.03%     
==========================================
  Files        1178     1178              
  Lines       84623    84798     +175     
  Branches    19945    19945              
==========================================
  Hits         9158     9158              
- Misses      65755    65930     +175     
  Partials     9710     9710              
Flag Coverage Δ *Carryforward flag
differential 0.00% <0.00%> (?)
total 10.79% <0.00%> (ø) Carriedforward from 28c0658

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

Impacted Files Coverage Δ
...lude/image_projection_based_fusion/fusion_node.hpp 0.00% <ø> (ø)
.../image_projection_based_fusion/src/fusion_node.cpp 0.00% <0.00%> (ø)
...ion_based_fusion/src/pointpainting_fusion/node.cpp 0.00% <0.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@tzhong518 tzhong518 changed the title feat(sync_fusion_callback): add custom sync callback feat(image_projection_based_fusion): substitute message filter with custom synchronizer Nov 2, 2022
Signed-off-by: tzhong518 <sworgun@gmail.com>
Signed-off-by: tzhong518 <sworgun@gmail.com>
@yukke42 yukke42 added the component:perception Advanced sensor data processing and environment understanding. (auto-assigned) label Nov 7, 2022
Comment on lines 63 to 66
if (!input_offset_ms_.empty() && rois_number_ != input_offset_ms_.size()) {
RCLCPP_ERROR(get_logger(), "The number of topics does not match the number of offsets.");
return;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
if (!input_offset_ms_.empty() && rois_number_ != input_offset_ms_.size()) {
RCLCPP_ERROR(get_logger(), "The number of topics does not match the number of offsets.");
return;
}
if (input_offset_ms_.empty() || rois_number_ != input_offset_ms_.size()) {
throw std::runtime_error("The number of offsets does not match the number of topics.");
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

May I ask what is the difference?

Copy link
Contributor

@yukke42 yukke42 Nov 9, 2022

Choose a reason for hiding this comment

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

Your program just returns from the constructor and continues without any error in your code, but we want the program to exit with error if rois_number and the size of offsets don't matches.

@yukke42
Copy link
Contributor

yukke42 commented Nov 7, 2022

@tzhong518
The output from pointpainting isn't available when I play the bag with the option of --remap /perception/object_recognition/detection/rois0:=/mapped/perception/object_recognition/detection/rois0 to produce the situation that the one of the ROI topics is missed. Cloud you check?

Signed-off-by: tzhong518 <sworgun@gmail.com>
…bject_fusion.launch.xml

Co-authored-by: Yusuke Muramatsu <yukke42@users.noreply.github.com>
@yukke42
Copy link
Contributor

yukke42 commented Nov 15, 2022

[debug messages]
Screenshot from 2022-11-16 01-03-43

@yukke42 yukke42 self-requested a review November 18, 2022 04:24
Copy link
Contributor

@yukke42 yukke42 left a comment

Choose a reason for hiding this comment

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

LGTM

Signed-off-by: tzhong518 <sworgun@gmail.com>
@tzhong518 tzhong518 enabled auto-merge (squash) November 22, 2022 07:22
…utoware.universe into feature/sync_fusion_callback
@tzhong518 tzhong518 requested a review from a team as a code owner November 24, 2022 02:20
@tzhong518 tzhong518 merged commit cf36f84 into autowarefoundation:main Nov 24, 2022
tzhong518 added a commit to tier4/autoware.universe that referenced this pull request Dec 9, 2022
…ustom synchronizer (autowarefoundation#2175)

* add: custom sync fusion callback

Signed-off-by: tzhong518 <sworgun@gmail.com>

* ci(pre-commit): autofix

* Update perception/image_projection_based_fusion/src/fusion_node.cpp

Co-authored-by: Yusuke Muramatsu <yukke42@users.noreply.github.com>

* Update perception/image_projection_based_fusion/src/fusion_node.cpp

Co-authored-by: Yusuke Muramatsu <yukke42@users.noreply.github.com>

* Update perception/image_projection_based_fusion/src/fusion_node.cpp

Co-authored-by: Yusuke Muramatsu <yukke42@users.noreply.github.com>

* fix: change parameter names

Signed-off-by: tzhong518 <sworgun@gmail.com>

* fix: solve review comments

Signed-off-by: tzhong518 <sworgun@gmail.com>

* Update perception/image_projection_based_fusion/launch/roi_detected_object_fusion.launch.xml

Co-authored-by: Yusuke Muramatsu <yukke42@users.noreply.github.com>

* Update perception/image_projection_based_fusion/src/fusion_node.cpp

* Update perception/image_projection_based_fusion/config/roi_sync.param.yaml

Signed-off-by: tzhong518 <sworgun@gmail.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Yusuke Muramatsu <yukke42@users.noreply.github.com>
HansRobo pushed a commit to HansRobo/autoware.universe that referenced this pull request Dec 16, 2022
…ustom synchronizer (autowarefoundation#2175)

* add: custom sync fusion callback

Signed-off-by: tzhong518 <sworgun@gmail.com>

* ci(pre-commit): autofix

* Update perception/image_projection_based_fusion/src/fusion_node.cpp

Co-authored-by: Yusuke Muramatsu <yukke42@users.noreply.github.com>

* Update perception/image_projection_based_fusion/src/fusion_node.cpp

Co-authored-by: Yusuke Muramatsu <yukke42@users.noreply.github.com>

* Update perception/image_projection_based_fusion/src/fusion_node.cpp

Co-authored-by: Yusuke Muramatsu <yukke42@users.noreply.github.com>

* fix: change parameter names

Signed-off-by: tzhong518 <sworgun@gmail.com>

* fix: solve review comments

Signed-off-by: tzhong518 <sworgun@gmail.com>

* Update perception/image_projection_based_fusion/launch/roi_detected_object_fusion.launch.xml

Co-authored-by: Yusuke Muramatsu <yukke42@users.noreply.github.com>

* Update perception/image_projection_based_fusion/src/fusion_node.cpp

* Update perception/image_projection_based_fusion/config/roi_sync.param.yaml

Signed-off-by: tzhong518 <sworgun@gmail.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Yusuke Muramatsu <yukke42@users.noreply.github.com>
Signed-off-by: Kotaro Yoshimoto <pythagora.yoshimoto@gmail.com>
kminoda pushed a commit to kminoda/autoware.universe that referenced this pull request Jan 6, 2023
…ustom synchronizer (autowarefoundation#2175)

* add: custom sync fusion callback

Signed-off-by: tzhong518 <sworgun@gmail.com>

* ci(pre-commit): autofix

* Update perception/image_projection_based_fusion/src/fusion_node.cpp

Co-authored-by: Yusuke Muramatsu <yukke42@users.noreply.github.com>

* Update perception/image_projection_based_fusion/src/fusion_node.cpp

Co-authored-by: Yusuke Muramatsu <yukke42@users.noreply.github.com>

* Update perception/image_projection_based_fusion/src/fusion_node.cpp

Co-authored-by: Yusuke Muramatsu <yukke42@users.noreply.github.com>

* fix: change parameter names

Signed-off-by: tzhong518 <sworgun@gmail.com>

* fix: solve review comments

Signed-off-by: tzhong518 <sworgun@gmail.com>

* Update perception/image_projection_based_fusion/launch/roi_detected_object_fusion.launch.xml

Co-authored-by: Yusuke Muramatsu <yukke42@users.noreply.github.com>

* Update perception/image_projection_based_fusion/src/fusion_node.cpp

* Update perception/image_projection_based_fusion/config/roi_sync.param.yaml

Signed-off-by: tzhong518 <sworgun@gmail.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Yusuke Muramatsu <yukke42@users.noreply.github.com>
Signed-off-by: kminoda <koji.minoda@tier4.jp>
badai-nguyen pushed a commit to badai-nguyen/autoware.universe that referenced this pull request Feb 2, 2023
…ustom synchronizer (autowarefoundation#2175)

* add: custom sync fusion callback

Signed-off-by: tzhong518 <sworgun@gmail.com>

* ci(pre-commit): autofix

* Update perception/image_projection_based_fusion/src/fusion_node.cpp

Co-authored-by: Yusuke Muramatsu <yukke42@users.noreply.github.com>

* Update perception/image_projection_based_fusion/src/fusion_node.cpp

Co-authored-by: Yusuke Muramatsu <yukke42@users.noreply.github.com>

* Update perception/image_projection_based_fusion/src/fusion_node.cpp

Co-authored-by: Yusuke Muramatsu <yukke42@users.noreply.github.com>

* fix: change parameter names

Signed-off-by: tzhong518 <sworgun@gmail.com>

* fix: solve review comments

Signed-off-by: tzhong518 <sworgun@gmail.com>

* Update perception/image_projection_based_fusion/launch/roi_detected_object_fusion.launch.xml

Co-authored-by: Yusuke Muramatsu <yukke42@users.noreply.github.com>

* Update perception/image_projection_based_fusion/src/fusion_node.cpp

* Update perception/image_projection_based_fusion/config/roi_sync.param.yaml

Signed-off-by: tzhong518 <sworgun@gmail.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Yusuke Muramatsu <yukke42@users.noreply.github.com>
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)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants