Skip to content

Commit

Permalink
refactor(avoidance): add function to check if the object is moving
Browse files Browse the repository at this point in the history
Signed-off-by: satoshi-ota <[email protected]>
  • Loading branch information
satoshi-ota committed Jan 31, 2024
1 parent ae3e758 commit bb5f76f
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 @@ -303,8 +303,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(

Check warning on line 392 in planning/behavior_path_avoidance_module/src/utils.cpp

View check run for this annotation

Codecov / codecov/patch

planning/behavior_path_avoidance_module/src/utils.cpp#L392

Added line #L392 was not covered by tests
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;

Check warning on line 397 in planning/behavior_path_avoidance_module/src/utils.cpp

View check run for this annotation

Codecov / codecov/patch

planning/behavior_path_avoidance_module/src/utils.cpp#L395-L397

Added lines #L395 - L397 were not covered by tests
}

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 bb5f76f

Please sign in to comment.