Skip to content

Commit

Permalink
fix(avoidance): add target filtering threshold for merging/deviating …
Browse files Browse the repository at this point in the history
…vehicle

Signed-off-by: satoshi-ota <[email protected]>
  • Loading branch information
satoshi-ota committed Apr 12, 2024
1 parent 682a814 commit ced46ed
Show file tree
Hide file tree
Showing 5 changed files with 61 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,10 @@
th_shiftable_ratio: 0.8 # [-]
min_road_shoulder_width: 0.5 # [m] FOR DEVELOPER

# for merging/deviating vehicle
merging_vehicle:
th_overhang_distance: 0.5 # [m]

# params for avoidance of vehicle type objects that are ambiguous as to whether they are parked.
avoidance_for_ambiguous_vehicle:
enable: true # [-]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,9 @@ struct AvoidanceParameters
double time_threshold_for_ambiguous_vehicle{0.0};
double distance_threshold_for_ambiguous_vehicle{0.0};

// for merging/deviating vehicle
double th_overhang_distance{0.0};

// parameters for safety check area
bool enable_safety_check{false};
bool check_current_lane{false};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -681,6 +681,18 @@
],
"additionalProperties": false
},
"merging_vehicle": {
"type": "object",
"properties": {
"th_overhang_distance": {
"type": "number",
"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.)",
"default": 0.5
}
},
"required": ["th_overhang_distance"],
"additionalProperties": false
},
"parked_vehicle": {
"type": "object",
"properties": {
Expand Down Expand Up @@ -803,6 +815,7 @@
"object_check_return_pose_distance",
"max_compensation_time",
"detection_area",
"merging_vehicle",
"parked_vehicle",
"avoidance_for_ambiguous_vehicle",
"intersection"
Expand Down
1 change: 1 addition & 0 deletions planning/behavior_path_avoidance_module/src/debug.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -578,6 +578,7 @@ MarkerArray createDebugMarkerArray(
addObjects(data.other_objects, std::string("TooNearToGoal"));
addObjects(data.other_objects, std::string("ParallelToEgoLane"));
addObjects(data.other_objects, std::string("MergingToEgoLane"));
addObjects(data.other_objects, std::string("DeviatingFromEgoLane"));
addObjects(data.other_objects, std::string("UnstableObject"));
addObjects(data.other_objects, std::string("AmbiguousStoppedVehicle"));
addObjects(data.other_objects, std::string("AmbiguousStoppedVehicle(wait-and-see)"));
Expand Down
40 changes: 40 additions & 0 deletions planning/behavior_path_avoidance_module/src/utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -574,6 +574,46 @@ bool isNeverAvoidanceTarget(
}
}

if (object.behavior == ObjectData::Behavior::MERGING) {
object.reason = "MergingToEgoLane";
if (
isOnRight(object) &&
object.overhang_points.front().first > parameters->th_overhang_distance) {
RCLCPP_DEBUG(
rclcpp::get_logger(__func__),
"merging vehicle. but overhang distance is larger than threshold.");
return true;
}
if (
!isOnRight(object) &&
object.overhang_points.front().first < -1.0 * parameters->th_overhang_distance) {
RCLCPP_DEBUG(
rclcpp::get_logger(__func__),
"merging vehicle. but overhang distance is larger than threshold.");
return true;
}
}

if (object.behavior == ObjectData::Behavior::DEVIATING) {
object.reason = "DeviatingFromEgoLane";
if (
isOnRight(object) &&
object.overhang_points.front().first > parameters->th_overhang_distance) {
RCLCPP_DEBUG(
rclcpp::get_logger(__func__),
"deviating vehicle. but overhang distance is larger than threshold.");
return true;
}
if (
!isOnRight(object) &&
object.overhang_points.front().first < -1.0 * parameters->th_overhang_distance) {
RCLCPP_DEBUG(
rclcpp::get_logger(__func__),
"deviating vehicle. but overhang distance is larger than threshold.");
return true;
}
}

if (object.is_on_ego_lane) {
const auto right_lane =
planner_data->route_handler->getRightLanelet(object.overhang_lanelet, true, false);
Expand Down

0 comments on commit ced46ed

Please sign in to comment.