Skip to content

Commit

Permalink
fix(map_based_prediction): filter by distance for opposite lanes as w…
Browse files Browse the repository at this point in the history
…ell (autowarefoundation#5195)

* fix(map_based_prediction): filter by distance for opposite lanes as well

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

* update

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

---------

Signed-off-by: kminoda <[email protected]>
  • Loading branch information
kminoda committed Oct 2, 2023
1 parent 8a9262c commit 1b3d855
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -184,8 +184,7 @@ class MapBasedPredictionNode : public rclcpp::Node

LaneletsData getCurrentLanelets(const TrackedObject & object);
bool checkCloseLaneletCondition(
const std::pair<double, lanelet::Lanelet> & lanelet, const TrackedObject & object,
const bool check_distance = true);
const std::pair<double, lanelet::Lanelet> & lanelet, const TrackedObject & object);
float calculateLocalLikelihood(
const lanelet::Lanelet & current_lanelet, const TrackedObject & object) const;
void updateObjectData(TrackedObject & object);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1240,7 +1240,7 @@ LaneletsData MapBasedPredictionNode::getCurrentLanelets(const TrackedObject & ob
for (const auto & lanelet : surrounding_opposite_lanelets) {
// Check if the close lanelets meet the necessary condition for start lanelets
// except for distance checking
if (!checkCloseLaneletCondition(lanelet, object, false)) {
if (!checkCloseLaneletCondition(lanelet, object)) {
continue;
}

Expand All @@ -1260,8 +1260,7 @@ LaneletsData MapBasedPredictionNode::getCurrentLanelets(const TrackedObject & ob
}

bool MapBasedPredictionNode::checkCloseLaneletCondition(
const std::pair<double, lanelet::Lanelet> & lanelet, const TrackedObject & object,
const bool check_distance)
const std::pair<double, lanelet::Lanelet> & lanelet, const TrackedObject & object)
{
// Step1. If we only have one point in the centerline, we will ignore the lanelet
if (lanelet.second.centerline().size() <= 1) {
Expand Down Expand Up @@ -1296,7 +1295,7 @@ bool MapBasedPredictionNode::checkCloseLaneletCondition(
const double object_vel = object.kinematics.twist_with_covariance.twist.linear.x;
const bool is_yaw_reversed =
M_PI - delta_yaw_threshold_for_searching_lanelet_ < abs_norm_delta && object_vel < 0.0;
if (check_distance && dist_threshold_for_searching_lanelet_ < lanelet.first) {
if (dist_threshold_for_searching_lanelet_ < lanelet.first) {
return false;
}
if (!is_yaw_reversed && delta_yaw_threshold_for_searching_lanelet_ < abs_norm_delta) {
Expand Down

0 comments on commit 1b3d855

Please sign in to comment.