Skip to content

Commit b5e2ece

Browse files
committedApr 30, 2024
prioritize on coming object check instead
Signed-off-by: Muhammad Zulfaqar Azmi <zulfaqar.azmi@tier4.jp>
1 parent a957ada commit b5e2ece

File tree

2 files changed

+37
-11
lines changed
  • planning/behavior_path_lane_change_module

2 files changed

+37
-11
lines changed
 

‎planning/behavior_path_lane_change_module/include/behavior_path_lane_change_module/scene.hpp

+3-1
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,9 @@ class NormalLaneChange : public LaneChangeBase
125125
const lanelet::ConstLanelets & current_lanes,
126126
const lanelet::ConstLanelets & target_lanes) const;
127127

128-
void filterObjectsAheadTerminal(
128+
void filterOncomingObjects(PredictedObjects & objects) const;
129+
130+
void filterAheadTerminalObjects(
129131
PredictedObjects & objects, const lanelet::ConstLanelets & current_lanes) const;
130132

131133
void filterObjectsByLanelets(

‎planning/behavior_path_lane_change_module/src/scene.cpp

+34-10
Original file line numberDiff line numberDiff line change
@@ -887,7 +887,9 @@ LaneChangeLanesFilteredObjects NormalLaneChange::filterObjects(
887887
return {};
888888
}
889889

890-
filterObjectsAheadTerminal(objects, current_lanes);
890+
filterOncomingObjects(objects);
891+
892+
filterAheadTerminalObjects(objects, current_lanes);
891893

892894
std::vector<PredictedObject> target_lane_objects;
893895
std::vector<PredictedObject> current_lane_objects;
@@ -915,24 +917,19 @@ LaneChangeLanesFilteredObjects NormalLaneChange::filterObjects(
915917
return max_dist_ego_to_obj >= 0.0;
916918
};
917919

918-
const auto is_same_direction = [&](const PredictedObject & object) {
919-
const auto & object_pose = object.kinematics.initial_pose_with_covariance.pose;
920-
return !utils::path_safety_checker::isTargetObjectOncoming(current_pose, object_pose);
921-
};
922-
923920
utils::path_safety_checker::filterObjects(
924921
target_lane_objects, [&](const PredictedObject & object) {
925-
return is_same_direction(object) && (is_within_vel_th(object) || is_ahead_of_ego(object));
922+
return (is_within_vel_th(object) || is_ahead_of_ego(object));
926923
});
927924

928925
utils::path_safety_checker::filterObjects(
929926
other_lane_objects, [&](const PredictedObject & object) {
930-
return is_within_vel_th(object) && is_same_direction(object) && is_ahead_of_ego(object);
927+
return is_within_vel_th(object) && is_ahead_of_ego(object);
931928
});
932929

933930
utils::path_safety_checker::filterObjects(
934931
current_lane_objects, [&](const PredictedObject & object) {
935-
return is_within_vel_th(object) && is_same_direction(object) && is_ahead_of_ego(object);
932+
return is_within_vel_th(object) && is_ahead_of_ego(object);
936933
});
937934

938935
LaneChangeLanesFilteredObjects lane_change_target_objects;
@@ -961,7 +958,34 @@ LaneChangeLanesFilteredObjects NormalLaneChange::filterObjects(
961958
return lane_change_target_objects;
962959
}
963960

964-
void NormalLaneChange::filterObjectsAheadTerminal(
961+
void NormalLaneChange::filterOncomingObjects(PredictedObjects & objects) const
962+
{
963+
const auto & current_pose = getEgoPose();
964+
965+
const auto is_same_direction = [&](const PredictedObject & object) {
966+
const auto & object_pose = object.kinematics.initial_pose_with_covariance.pose;
967+
return !utils::path_safety_checker::isTargetObjectOncoming(current_pose, object_pose);
968+
};
969+
970+
// Perception noise could make stationary objects seem opposite the ego vehicle; check the
971+
// velocity to prevent this.
972+
const auto is_stopped_object = [](const auto & object) -> bool {
973+
constexpr double min_vel_th = -0.5;
974+
constexpr double max_vel_th = 0.5;
975+
return utils::path_safety_checker::filter::velocity_filter(object, min_vel_th, max_vel_th);
976+
};
977+
978+
utils::path_safety_checker::filterObjects(objects, [&](const PredictedObject & object) {
979+
const auto same_direction = is_same_direction(object);
980+
if (same_direction) {
981+
return true;
982+
}
983+
984+
return is_stopped_object(object);
985+
});
986+
}
987+
988+
void NormalLaneChange::filterAheadTerminalObjects(
965989
PredictedObjects & objects, const lanelet::ConstLanelets & current_lanes) const
966990
{
967991
const auto & current_pose = getEgoPose();

0 commit comments

Comments
 (0)