Skip to content

Commit

Permalink
refactor(avoidance): add function to check if the object is moving (a…
Browse files Browse the repository at this point in the history
…utowarefoundation#6243)

Signed-off-by: satoshi-ota <[email protected]>
  • Loading branch information
satoshi-ota committed Feb 2, 2024
1 parent 3fd5323 commit 31ffa43
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
3 changes: 1 addition & 2 deletions planning/behavior_path_avoidance_module/src/scene.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -301,8 +301,7 @@ void AvoidanceModule::fillAvoidanceTargetObjects(
data, parameters_, forward_detection_range + MARGIN, debug);

for (const auto & object : object_outside_target_lane.objects) {
ObjectData other_object;
other_object.object = object;
ObjectData other_object = createObjectData(data, object);
other_object.reason = "OutOfTargetArea";
data.other_objects.push_back(other_object);
}
Expand Down
12 changes: 9 additions & 3 deletions planning/behavior_path_avoidance_module/src/utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,14 @@ bool isVehicleTypeObject(const ObjectData & object)
return true;
}

bool isMovingObject(
const ObjectData & object, const std::shared_ptr<AvoidanceParameters> & parameters)
{
const auto object_type = utils::getHighestProbLabel(object.object.classification);
const auto object_parameter = parameters->object_parameters.at(object_type);
return object.move_time > object_parameter.moving_time_threshold;
}

bool isWithinCrosswalk(
const ObjectData & object,
const std::shared_ptr<const lanelet::routing::RoutingGraphContainer> & overall_graphs)
Expand Down Expand Up @@ -665,9 +673,7 @@ bool isSatisfiedWithCommonCondition(
}

// Step2. filtered stopped objects.
const auto object_type = utils::getHighestProbLabel(object.object.classification);
const auto object_parameter = parameters->object_parameters.at(object_type);
if (object.move_time > object_parameter.moving_time_threshold) {
if (filtering_utils::isMovingObject(object, parameters)) {
object.reason = AvoidanceDebugFactor::MOVING_OBJECT;
return false;
}
Expand Down

0 comments on commit 31ffa43

Please sign in to comment.