Skip to content

Commit 41b5d5b

Browse files
satoshi-otaTomohitoAndo
authored andcommitted
refactor(avoidance): add function to check if the object is moving (autowarefoundation#6243)
Signed-off-by: satoshi-ota <satoshi.ota928@gmail.com>
1 parent 7887d8a commit 41b5d5b

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
@@ -301,8 +301,7 @@ void AvoidanceModule::fillAvoidanceTargetObjects(
301301
data, parameters_, forward_detection_range + MARGIN, debug);
302302

303303
for (const auto & object : object_outside_target_lane.objects) {
304-
ObjectData other_object;
305-
other_object.object = object;
304+
ObjectData other_object = createObjectData(data, object);
306305
other_object.reason = "OutOfTargetArea";
307306
data.other_objects.push_back(other_object);
308307
}

planning/behavior_path_avoidance_module/src/utils.cpp

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

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

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

0 commit comments

Comments
 (0)