Skip to content

Commit

Permalink
add interest makers
Browse files Browse the repository at this point in the history
Signed-off-by: Yuki Takagi <yuki.takagi@tier4.jp>
  • Loading branch information
yuki-takagi-66 committed Dec 26, 2023
1 parent 64c6dba commit 55bf72d
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -873,7 +873,7 @@ Polygon2d CrosswalkModule::getAttentionArea(
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 @@ std::optional<StopFactor> CrosswalkModule::checkStopForStuckVehicles(
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 @@ void CrosswalkModule::updateObjectState(
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

0 comments on commit 55bf72d

Please sign in to comment.