Skip to content

Commit 82d1b10

Browse files
authored
refactor(avoidance): add function to check if the object is moving (#6243)
Signed-off-by: satoshi-ota <satoshi.ota928@gmail.com>
1 parent b415e2e commit 82d1b10

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

planning/behavior_path_avoidance_module/src/scene.cpp

+1-2
Original file line numberDiff line numberDiff line change
@@ -303,8 +303,7 @@ void AvoidanceModule::fillAvoidanceTargetObjects(
303303
data, parameters_, forward_detection_range + MARGIN, debug);
304304

305305
for (const auto & object : object_outside_target_lane.objects) {
306-
ObjectData other_object;
307-
other_object.object = object;
306+
ObjectData other_object = createObjectData(data, object);
308307
other_object.reason = "OutOfTargetArea";
309308
data.other_objects.push_back(other_object);
310309
}

planning/behavior_path_avoidance_module/src/utils.cpp

+9-3
Original file line numberDiff line numberDiff line change
@@ -389,6 +389,14 @@ bool isVehicleTypeObject(const ObjectData & object)
389389
return true;
390390
}
391391

392+
bool isMovingObject(
393+
const ObjectData & object, const std::shared_ptr<AvoidanceParameters> & parameters)
394+
{
395+
const auto object_type = utils::getHighestProbLabel(object.object.classification);
396+
const auto object_parameter = parameters->object_parameters.at(object_type);
397+
return object.move_time > object_parameter.moving_time_threshold;
398+
}
399+
392400
bool isWithinCrosswalk(
393401
const ObjectData & object,
394402
const std::shared_ptr<const lanelet::routing::RoutingGraphContainer> & overall_graphs)
@@ -665,9 +673,7 @@ bool isSatisfiedWithCommonCondition(
665673
}
666674

667675
// Step2. filtered stopped objects.
668-
const auto object_type = utils::getHighestProbLabel(object.object.classification);
669-
const auto object_parameter = parameters->object_parameters.at(object_type);
670-
if (object.move_time > object_parameter.moving_time_threshold) {
676+
if (filtering_utils::isMovingObject(object, parameters)) {
671677
object.reason = AvoidanceDebugFactor::MOVING_OBJECT;
672678
return false;
673679
}

0 commit comments

Comments
 (0)