Skip to content

Commit

Permalink
fix(avoidance): update filtering logic for non-vehicle (autowarefound…
Browse files Browse the repository at this point in the history
…ation#6206)

Signed-off-by: satoshi-ota <[email protected]>
  • Loading branch information
satoshi-ota committed Feb 23, 2024
1 parent 70efb41 commit 27cc1d9
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 4 deletions.
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 @@ -557,6 +557,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("UnstableObject"));
}

// shift line pre-process
Expand Down
29 changes: 25 additions & 4 deletions planning/behavior_path_avoidance_module/src/utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -368,13 +368,15 @@ bool isSafetyCheckTargetObjectType(
return parameters->object_parameters.at(object_type).is_safety_check_target;
}

bool isVehicleTypeObject(const ObjectData & object)
bool isUnknownTypeObject(const ObjectData & object)
{
const auto object_type = utils::getHighestProbLabel(object.object.classification);
return object_type == ObjectClassification::UNKNOWN;
}

if (object_type == ObjectClassification::UNKNOWN) {
return false;
}
bool isVehicleTypeObject(const ObjectData & object)
{
const auto object_type = utils::getHighestProbLabel(object.object.classification);

if (object_type == ObjectClassification::PEDESTRIAN) {
return false;
Expand Down Expand Up @@ -723,6 +725,15 @@ bool isSatisfiedWithNonVehicleCondition(
return false;
}

// Object is on center line -> ignore.
const auto & object_pose = object.object.kinematics.initial_pose_with_covariance.pose;
object.to_centerline =
lanelet::utils::getArcCoordinates(data.current_lanelets, object_pose).distance;
if (std::abs(object.to_centerline) < parameters->threshold_distance_object_is_on_center) {
object.reason = AvoidanceDebugFactor::TOO_NEAR_TO_CENTERLINE;
return false;
}

return true;
}

Expand Down Expand Up @@ -1626,6 +1637,16 @@ void filterTargetObjects(
o.to_road_shoulder_distance = filtering_utils::getRoadShoulderDistance(o, data, planner_data);
o.avoid_margin = filtering_utils::getAvoidMargin(o, planner_data, parameters);

// TODO(Satoshi Ota) parametrize stop time threshold if need.
constexpr double STOP_TIME_THRESHOLD = 3.0; // [s]
if (filtering_utils::isUnknownTypeObject(o)) {
if (o.stop_time < STOP_TIME_THRESHOLD) {
o.reason = "UnstableObject";
data.other_objects.push_back(o);
continue;
}
}

if (filtering_utils::isNoNeedAvoidanceBehavior(o, parameters)) {
data.other_objects.push_back(o);
continue;
Expand Down

0 comments on commit 27cc1d9

Please sign in to comment.