Skip to content

Commit

Permalink
refactor(avoidance): remove redundant function
Browse files Browse the repository at this point in the history
Signed-off-by: satoshi-ota <[email protected]>
  • Loading branch information
satoshi-ota committed Oct 11, 2023
1 parent bfc5799 commit 37573a1
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -477,13 +477,6 @@ class AvoidanceModule : public SceneModuleInterface
*/
TurnSignalInfo calcTurnSignalInfo(const ShiftedPath & path) const;

// TODO(murooka) judge when and which way to extend drivable area. current implementation is keep
// extending during avoidance module
// TODO(murooka) freespace during turning in intersection where there is no neighbor lanes
// NOTE: Assume that there is no situation where there is an object in the middle lane of more
// than two lanes since which way to avoid is not obvious
void generateExpandDrivableLanes(BehaviorModuleOutput & output) const;

/**
* @brief fill debug markers.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1950,25 +1950,6 @@ bool AvoidanceModule::isSafePath(
return safe_ || safe_count_ > parameters_->hysteresis_factor_safe_count;
}

void AvoidanceModule::generateExpandDrivableLanes(BehaviorModuleOutput & output) const
{
DrivableAreaInfo current_drivable_area_info;
// generate drivable lanes
current_drivable_area_info.drivable_lanes = avoid_data_.drivable_lanes;
// generate obstacle polygons
current_drivable_area_info.obstacles = utils::avoidance::generateObstaclePolygonsForDrivableArea(
avoid_data_.target_objects, parameters_, planner_data_->parameters.vehicle_width / 2.0);
// expand hatched road markings
current_drivable_area_info.enable_expanding_hatched_road_markings =
parameters_->use_hatched_road_markings;
// expand intersection areas
current_drivable_area_info.enable_expanding_intersection_areas =
parameters_->use_intersection_areas;

output.drivable_area_info = utils::combineDrivableAreaInfo(
current_drivable_area_info, getPreviousModuleOutput().drivable_area_info);
}

PathWithLaneId AvoidanceModule::extendBackwardLength(const PathWithLaneId & original_path) const
{
const auto previous_path = helper_.getPreviousReferencePath();
Expand Down Expand Up @@ -2102,8 +2083,26 @@ BehaviorModuleOutput AvoidanceModule::plan()
utils::clipPathLength(*output.path, ego_idx, planner_data_->parameters);

// Drivable area generation.
generateExpandDrivableLanes(output);
setDrivableLanes(output.drivable_area_info.drivable_lanes);
{
DrivableAreaInfo current_drivable_area_info;
// generate drivable lanes
current_drivable_area_info.drivable_lanes = avoid_data_.drivable_lanes;
// generate obstacle polygons
current_drivable_area_info.obstacles =
utils::avoidance::generateObstaclePolygonsForDrivableArea(
avoid_data_.target_objects, parameters_, planner_data_->parameters.vehicle_width / 2.0);
// expand hatched road markings
current_drivable_area_info.enable_expanding_hatched_road_markings =
parameters_->use_hatched_road_markings;

Check warning on line 2096 in planning/behavior_path_planner/src/scene_module/avoidance/avoidance_module.cpp

View check run for this annotation

Codecov / codecov/patch

planning/behavior_path_planner/src/scene_module/avoidance/avoidance_module.cpp#L2095-L2096

Added lines #L2095 - L2096 were not covered by tests
// expand intersection areas
current_drivable_area_info.enable_expanding_intersection_areas =

Check warning on line 2098 in planning/behavior_path_planner/src/scene_module/avoidance/avoidance_module.cpp

View check run for this annotation

Codecov / codecov/patch

planning/behavior_path_planner/src/scene_module/avoidance/avoidance_module.cpp#L2098

Added line #L2098 was not covered by tests
parameters_->use_intersection_areas;

output.drivable_area_info = utils::combineDrivableAreaInfo(
current_drivable_area_info, getPreviousModuleOutput().drivable_area_info);

Check warning on line 2102 in planning/behavior_path_planner/src/scene_module/avoidance/avoidance_module.cpp

View check run for this annotation

Codecov / codecov/patch

planning/behavior_path_planner/src/scene_module/avoidance/avoidance_module.cpp#L2102

Added line #L2102 was not covered by tests

setDrivableLanes(output.drivable_area_info.drivable_lanes);
}

Check warning on line 2105 in planning/behavior_path_planner/src/scene_module/avoidance/avoidance_module.cpp

View check run for this annotation

CodeScene Delta Analysis / CodeScene Cloud Delta Analysis (main)

❌ New issue: Large Method

AvoidanceModule::plan has 71 lines, threshold = 70. Large functions with many lines of code are generally harder to understand and lower the code health. Avoid adding more lines to this function.

return output;
}
Expand Down

0 comments on commit 37573a1

Please sign in to comment.