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): incorporate crosswalk user history #6905

Merged
merged 11 commits into from May 13, 2024

Conversation

dkoldaev
Copy link
Contributor

@dkoldaev dkoldaev commented Apr 30, 2024

Description

This PR incorporates crosswalk user history to the map based prediction node. The history is useful when detection is unstable and crosswalk user disappear from the detection for some short time. Since current PR, a user that disappeared from the detection for times shorter than the history timeout will get a path based on the latest available position. Additionally, when a crosswalk user is detected in with multiple different IDs it is reasonable to try matching those IDs. This PR introduces simple matching that is based on the position of the user.

Related links

TIER IV INTERNAL LINK

Tests performed

Tested on TIER IV internal data

https://evaluation.tier4.jp/evaluation/reports/08d0336a-8a00-59ad-984c-850352428143?project_id=prd_jt

Notes for reviewers

NA

Interface changes

NA

Effects on system behavior

The new functionality can be disabled with newly introduced parameters

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 Apr 30, 2024
@dkoldaev dkoldaev changed the title feat(map_based_prediction) : incorporate crosswalk user history feat(map_based_prediction): incorporate crosswalk user history Apr 30, 2024
Dmitrii Koldaev added 4 commits April 30, 2024 15:06
Signed-off-by: Dmitrii Koldaev <dmitrii.koldaev@tier4.jp>
Signed-off-by: Dmitrii Koldaev <dmitrii.koldaev@tier4.jp>
Signed-off-by: Dmitrii Koldaev <dmitrii.koldaev@tier4.jp>
Signed-off-by: Dmitrii Koldaev <dmitrii.koldaev@tier4.jp>
@dkoldaev dkoldaev force-pushed the dm/history_for_map_based_prediction branch from 8adc5b8 to 1823b7f Compare April 30, 2024 06:06
}

// Delete old information
while (!object_data.empty()) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you use std::remove_if here instead? https://en.cppreference.com/w/cpp/algorithm/remove . Also, you can do an early return if you do something like

if (current_time - post_object_time <= buffer_time) break;

or

if (current_time - post_object_time <= buffer_time) return false;

if you use std::remove_if with a predicate.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

this is not a new function, but a slightly modified version of removeOldObjectsHistory to accommodate crosswalk user history. I agree that it will look better with remove_if, but I think it is not a good idea to make refactoring while adding features.

Copy link
Contributor

Choose a reason for hiding this comment

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

@dkoldaev but these are new added lines, so it is not a refactoring of old code? Even so, function logic is not altered so I really suggest you do it on this PR

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@danielsanchezaran I also am not sure how to implement an early return in case of remove if. The predicate is bool, so it will go through all of the iterator list as I understand. The early return is possible, because of while loop and sorted structure of the object data... I would keep it as is for now and address it in a separate PR if you want to improve here

Copy link
Contributor

Choose a reason for hiding this comment

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

Please see my latest comment on the issue

Dmitrii Koldaev added 5 commits May 8, 2024 10:21
Signed-off-by: Dmitrii Koldaev <dmitrii.koldaev@tier4.jp>
Signed-off-by: Dmitrii Koldaev <dmitrii.koldaev@tier4.jp>
Signed-off-by: Dmitrii Koldaev <dmitrii.koldaev@tier4.jp>
Signed-off-by: Dmitrii Koldaev <dmitrii.koldaev@tier4.jp>
Signed-off-by: Dmitrii Koldaev <dmitrii.koldaev@tier4.jp>
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

Comment on lines 613 to 621
while (!object_data.empty()) {
const double post_object_time = rclcpp::Time(object_data.front().header.stamp).seconds();
if (current_time - post_object_time > buffer_time) {
// Delete Old Position
object_data.pop_front();
} else {
break;
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

I mean something like this: which is more readable and will not significantly affect performance

Suggested change
while (!object_data.empty()) {
const double post_object_time = rclcpp::Time(object_data.front().header.stamp).seconds();
if (current_time - post_object_time > buffer_time) {
// Delete Old Position
object_data.pop_front();
} else {
break;
}
}
std::remove_if(object_data.begin(),object_data.end(),[&current_time, &buffer_time](const auto & obj){
const double post_object_time = rclcpp::Time(obj.header.stamp).seconds();
return (current_time - post_object_time > buffer_time);
});

You could also do this:

Suggested change
while (!object_data.empty()) {
const double post_object_time = rclcpp::Time(object_data.front().header.stamp).seconds();
if (current_time - post_object_time > buffer_time) {
// Delete Old Position
object_data.pop_front();
} else {
break;
}
}
while (!object_data.empty()) {
const double post_object_time = rclcpp::Time(object_data.front().header.stamp).seconds();
if (current_time - post_object_time <= buffer_time) {
break;
}
object_data.pop_front();
}

But the first suggestion is better imo.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you! But as I understand the first suggestion does not have early exit, it will keep iterating through the list getting bool value for all of the objects. I will go with the second solution.

Copy link
Contributor

Choose a reason for hiding this comment

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

@dkoldaev yes, it does not have but the processing cost is low, I believe the first option is more readable and the performance cost is not significant.

@danielsanchezaran danielsanchezaran added the tag:run-build-and-test-differential Mark to enable build-and-test-differential workflow. (used-by-ci) label May 8, 2024
@soblin soblin merged commit aff5370 into main May 13, 2024
37 of 40 checks passed
@soblin soblin deleted the dm/history_for_map_based_prediction branch May 13, 2024 11:05
vividf pushed a commit to vividf/autoware.universe that referenced this pull request May 16, 2024
…arefoundation#6905)

Signed-off-by: Dmitrii Koldaev <dmitrii.koldaev@tier4.jp>
Signed-off-by: vividf <yihsiang.fang@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) tag: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.

None yet

4 participants