Skip to content

Commit cb73f80

Browse files
committed
fix(avoidance): add target filtering threshold for merging/deviating vehicle
Signed-off-by: satoshi-ota <satoshi.ota928@gmail.com>
1 parent 6424244 commit cb73f80

File tree

5 files changed

+61
-0
lines changed

5 files changed

+61
-0
lines changed

planning/behavior_path_avoidance_module/config/avoidance.param.yaml

+4
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,10 @@
132132
th_shiftable_ratio: 0.8 # [-]
133133
min_road_shoulder_width: 0.5 # [m] FOR DEVELOPER
134134

135+
# for merging/deviating vehicle
136+
merging_vehicle:
137+
th_overhang_distance: 0.0 # [m]
138+
135139
# params for avoidance of vehicle type objects that are ambiguous as to whether they are parked.
136140
avoidance_for_ambiguous_vehicle:
137141
enable: true # [-]

planning/behavior_path_avoidance_module/include/behavior_path_avoidance_module/data_structs.hpp

+3
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,9 @@ struct AvoidanceParameters
189189
double time_threshold_for_ambiguous_vehicle{0.0};
190190
double distance_threshold_for_ambiguous_vehicle{0.0};
191191

192+
// for merging/deviating vehicle
193+
double th_overhang_distance{0.0};
194+
192195
// parameters for safety check area
193196
bool enable_safety_check{false};
194197
bool check_current_lane{false};

planning/behavior_path_avoidance_module/schema/avoidance.schema.json

+13
Original file line numberDiff line numberDiff line change
@@ -681,6 +681,18 @@
681681
],
682682
"additionalProperties": false
683683
},
684+
"merging_vehicle": {
685+
"type": "object",
686+
"properties": {
687+
"th_overhang_distance": {
688+
"type": "number",
689+
"description": "Distance threshold between overhang point and ego lane's centerline. If the nearest overhang point of merging/deviating vehicle is less than this param, the module never avoid it. (Basically, the ego stopps behind of it.)",
690+
"default": 0.5
691+
}
692+
},
693+
"required": ["th_overhang_distance"],
694+
"additionalProperties": false
695+
},
684696
"parked_vehicle": {
685697
"type": "object",
686698
"properties": {
@@ -803,6 +815,7 @@
803815
"object_check_return_pose_distance",
804816
"max_compensation_time",
805817
"detection_area",
818+
"merging_vehicle",
806819
"parked_vehicle",
807820
"avoidance_for_ambiguous_vehicle",
808821
"intersection"

planning/behavior_path_avoidance_module/src/debug.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -578,6 +578,7 @@ MarkerArray createDebugMarkerArray(
578578
addObjects(data.other_objects, std::string("TooNearToGoal"));
579579
addObjects(data.other_objects, std::string("ParallelToEgoLane"));
580580
addObjects(data.other_objects, std::string("MergingToEgoLane"));
581+
addObjects(data.other_objects, std::string("DeviatingFromEgoLane"));
581582
addObjects(data.other_objects, std::string("UnstableObject"));
582583
addObjects(data.other_objects, std::string("AmbiguousStoppedVehicle"));
583584
addObjects(data.other_objects, std::string("AmbiguousStoppedVehicle(wait-and-see)"));

planning/behavior_path_avoidance_module/src/utils.cpp

+40
Original file line numberDiff line numberDiff line change
@@ -673,6 +673,46 @@ bool isNeverAvoidanceTarget(
673673
}
674674
}
675675

676+
if (object.behavior == ObjectData::Behavior::MERGING) {
677+
object.reason = "MergingToEgoLane";
678+
if (
679+
isOnRight(object) &&
680+
object.overhang_points.front().first > parameters->th_overhang_distance) {
681+
RCLCPP_DEBUG(
682+
rclcpp::get_logger(__func__),
683+
"merging vehicle. but overhang distance is larger than threshold.");
684+
return true;
685+
}
686+
if (
687+
!isOnRight(object) &&
688+
object.overhang_points.front().first < -1.0 * parameters->th_overhang_distance) {
689+
RCLCPP_DEBUG(
690+
rclcpp::get_logger(__func__),
691+
"merging vehicle. but overhang distance is larger than threshold.");
692+
return true;
693+
}
694+
}
695+
696+
if (object.behavior == ObjectData::Behavior::DEVIATING) {
697+
object.reason = "DeviatingFromEgoLane";
698+
if (
699+
isOnRight(object) &&
700+
object.overhang_points.front().first > parameters->th_overhang_distance) {
701+
RCLCPP_DEBUG(
702+
rclcpp::get_logger(__func__),
703+
"deviating vehicle. but overhang distance is larger than threshold.");
704+
return true;
705+
}
706+
if (
707+
!isOnRight(object) &&
708+
object.overhang_points.front().first < -1.0 * parameters->th_overhang_distance) {
709+
RCLCPP_DEBUG(
710+
rclcpp::get_logger(__func__),
711+
"deviating vehicle. but overhang distance is larger than threshold.");
712+
return true;
713+
}
714+
}
715+
676716
if (object.is_on_ego_lane) {
677717
const auto right_lane =
678718
planner_data->route_handler->getRightLanelet(object.overhang_lanelet, true, false);

0 commit comments

Comments
 (0)