-
Notifications
You must be signed in to change notification settings - Fork 700
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
Conversation
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>
8adc5b8
to
1823b7f
Compare
} | ||
|
||
// Delete old information | ||
while (!object_data.empty()) { |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
perception/map_based_prediction/src/map_based_prediction_node.cpp
Outdated
Show resolved
Hide resolved
perception/map_based_prediction/src/map_based_prediction_node.cpp
Outdated
Show resolved
Hide resolved
perception/map_based_prediction/src/map_based_prediction_node.cpp
Outdated
Show resolved
Hide resolved
perception/map_based_prediction/src/map_based_prediction_node.cpp
Outdated
Show resolved
Hide resolved
perception/map_based_prediction/src/map_based_prediction_node.cpp
Outdated
Show resolved
Hide resolved
perception/map_based_prediction/src/map_based_prediction_node.cpp
Outdated
Show resolved
Hide resolved
perception/map_based_prediction/include/map_based_prediction/map_based_prediction_node.hpp
Outdated
Show resolved
Hide resolved
perception/map_based_prediction/include/map_based_prediction/map_based_prediction_node.hpp
Outdated
Show resolved
Hide resolved
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>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
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; | ||
} | ||
} |
There was a problem hiding this comment.
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
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(),[¤t_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:
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
Signed-off-by: Dmitrii Koldaev <dmitrii.koldaev@tier4.jp>
…arefoundation#6905) Signed-off-by: Dmitrii Koldaev <dmitrii.koldaev@tier4.jp> Signed-off-by: vividf <yihsiang.fang@tier4.jp>
…arefoundation#6905) Signed-off-by: Dmitrii Koldaev <dmitrii.koldaev@tier4.jp>
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.
Post-review checklist for the PR author
The PR author must check the checkboxes below before merging.
After all checkboxes are checked, anyone who has write access can merge the PR.