Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(crosswalk): add interset makers #5967

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2020 Tier IV, Inc.

Check notice on line 1 in planning/behavior_velocity_crosswalk_module/src/scene_crosswalk.cpp

View check run for this annotation

CodeScene Delta Analysis / CodeScene Cloud Delta Analysis (main)

ℹ Getting worse: Overall Code Complexity

The mean cyclomatic complexity increases from 5.88 to 6.00, threshold = 4. This file has many conditional statements (e.g. if, for, while) across its implementation, leading to lower code health. Avoid adding more conditionals.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -873,7 +873,7 @@
std::optional<StopFactor> CrosswalkModule::checkStopForStuckVehicles(
const PathWithLaneId & ego_path, const std::vector<PredictedObject> & objects,
const std::vector<geometry_msgs::msg::Point> & path_intersects,
const std::optional<geometry_msgs::msg::Pose> & stop_pose) const
const std::optional<geometry_msgs::msg::Pose> & stop_pose)
{
const auto & p = planner_param_;

Expand Down Expand Up @@ -938,6 +938,10 @@
continue;
}

setObjectsOfInterestData(
object.kinematics.initial_pose_with_covariance.pose, object.shape, ColorName::RED);

Check warning on line 942 in planning/behavior_velocity_crosswalk_module/src/scene_crosswalk.cpp

View check run for this annotation

Codecov / codecov/patch

planning/behavior_velocity_crosswalk_module/src/scene_crosswalk.cpp#L942

Added line #L942 was not covered by tests

// early return may not appropriate because the nearest in range object should be handled
return createStopFactor(*feasible_stop_pose, {obj_pos});
}
}
Expand Down Expand Up @@ -1018,11 +1022,29 @@
has_traffic_light, collision_point, object.classification.front().label, planner_param_,
crosswalk_.polygon2d().basicPolygon());

const auto collision_state = object_info_manager_.getCollisionState(obj_uuid);
if (collision_point) {
const auto collision_state = object_info_manager_.getCollisionState(obj_uuid);
debug_data_.collision_points.push_back(
std::make_tuple(obj_uuid, *collision_point, collision_state));
}

const auto getLabelColor = [](const auto collision_state) {
if (collision_state == CollisionState::YIELD) {

Check warning on line 1032 in planning/behavior_velocity_crosswalk_module/src/scene_crosswalk.cpp

View check run for this annotation

Codecov / codecov/patch

planning/behavior_velocity_crosswalk_module/src/scene_crosswalk.cpp#L1032

Added line #L1032 was not covered by tests
return ColorName::RED;
} else if (

Check warning on line 1034 in planning/behavior_velocity_crosswalk_module/src/scene_crosswalk.cpp

View check run for this annotation

Codecov / codecov/patch

planning/behavior_velocity_crosswalk_module/src/scene_crosswalk.cpp#L1034

Added line #L1034 was not covered by tests
collision_state == CollisionState::EGO_PASS_FIRST ||
collision_state == CollisionState::EGO_PASS_LATER) {
return ColorName::GREEN;
} else if (collision_state == CollisionState::IGNORE) {
return ColorName::GRAY;
} else {
return ColorName::AMBER;

Check warning on line 1041 in planning/behavior_velocity_crosswalk_module/src/scene_crosswalk.cpp

View check run for this annotation

Codecov / codecov/patch

planning/behavior_velocity_crosswalk_module/src/scene_crosswalk.cpp#L1041

Added line #L1041 was not covered by tests
}
};

setObjectsOfInterestData(
object.kinematics.initial_pose_with_covariance.pose, object.shape,

Check warning on line 1046 in planning/behavior_velocity_crosswalk_module/src/scene_crosswalk.cpp

View check run for this annotation

Codecov / codecov/patch

planning/behavior_velocity_crosswalk_module/src/scene_crosswalk.cpp#L1046

Added line #L1046 was not covered by tests
getLabelColor(collision_state));

Check warning on line 1047 in planning/behavior_velocity_crosswalk_module/src/scene_crosswalk.cpp

View check run for this annotation

CodeScene Delta Analysis / CodeScene Cloud Delta Analysis (main)

❌ New issue: Complex Method

CrosswalkModule::updateObjectState has a cyclomatic complexity of 12, 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.
}
object_info_manager_.finalize();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ class CrosswalkModule : public SceneModuleInterface
std::optional<StopFactor> checkStopForStuckVehicles(
const PathWithLaneId & ego_path, const std::vector<PredictedObject> & objects,
const std::vector<geometry_msgs::msg::Point> & path_intersects,
const std::optional<geometry_msgs::msg::Pose> & stop_pose) const;
const std::optional<geometry_msgs::msg::Pose> & stop_pose);

std::optional<double> findEgoPassageDirectionAlongPath(
const PathWithLaneId & sparse_resample_path) const;
Expand Down
Loading