Skip to content

Commit

Permalink
feat(out_of_lane): ignore objects coming from behind ego
Browse files Browse the repository at this point in the history
Signed-off-by: Maxime CLEMENT <maxime.clement@tier4.jp>
  • Loading branch information
maxime-clem committed Jul 8, 2024
1 parent 598d937 commit 13a5bca
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2092,9 +2092,9 @@ std::vector<ExtendedPredictedObject> getSafetyCheckTargetObjects(
});
};

const auto to_predicted_objects = [&p, &parameters](const auto & objects) {
const auto to_predicted_objects = [&parameters](const auto & objects) {
PredictedObjects ret{};
std::for_each(objects.begin(), objects.end(), [&p, &ret, &parameters](const auto & object) {
std::for_each(objects.begin(), objects.end(), [&ret, &parameters](const auto & object) {
if (filtering_utils::isSafetyCheckTargetObjectType(object.object, parameters)) {
// check only moving objects
if (filtering_utils::isMovingObject(object, parameters) || !object.is_parked) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,12 @@ autoware_perception_msgs::msg::PredictedObjects filter_predicted_objects(
}) != object.classification.end();
if (is_pedestrian) continue;

const auto is_coming_from_behind =
motion_utils::calcSignedArcLength(
ego_data.trajectory_points, ego_data.first_trajectory_idx,
object.kinematics.initial_pose_with_covariance.pose.position) < 0.0;
if (is_coming_from_behind) continue;

Check warning on line 119 in planning/motion_velocity_planner/autoware_motion_velocity_out_of_lane_module/src/filter_predicted_objects.cpp

View check run for this annotation

CodeScene Delta Analysis / CodeScene Cloud Delta Analysis (main)

❌ Getting worse: Complex Method

filter_predicted_objects increases in cyclomatic complexity from 11 to 13, threshold = 9. This function has many conditional statements (e.g. if, for, while), leading to lower code health. Avoid adding more conditionals and code to it without refactoring.
auto filtered_object = object;
const auto is_invalid_predicted_path = [&](const auto & predicted_path) {
const auto is_low_confidence = predicted_path.confidence < params.objects_min_confidence;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
#include <map>
#include <memory>
#include <string>
#include <utility>
#include <vector>

namespace autoware::motion_velocity_planner
Expand Down

0 comments on commit 13a5bca

Please sign in to comment.