Skip to content

Commit 6d6a7b0

Browse files
authored
feat(avoidance): make it possible to use freespace areas in avoidance module (#6001)
* fix(static_drivable_area_expansion): check right/left bound id Signed-off-by: satoshi-ota <satoshi.ota928@gmail.com> * feat(static_drivable_area): use freespace area Signed-off-by: satoshi-ota <satoshi.ota928@gmail.com> * feat(avoidance): use freespace Signed-off-by: satoshi-ota <satoshi.ota928@gmail.com> * fix(AbLC): fix flag Signed-off-by: satoshi-ota <satoshi.ota928@gmail.com> * fix(planner_manager): fix flag Signed-off-by: satoshi-ota <satoshi.ota928@gmail.com> * refactor(static_drivable_area_expansion): remove unused arg Signed-off-by: satoshi-ota <satoshi.ota928@gmail.com> * refactor(static_drivable_area_expansion): use lambda Signed-off-by: satoshi-ota <satoshi.ota928@gmail.com> * fix(static_drivable_area_expansion): fix invalid access Signed-off-by: satoshi-ota <satoshi.ota928@gmail.com> * refactor(static_drivable_area_expansion): improve readability Signed-off-by: satoshi-ota <satoshi.ota928@gmail.com> * fix(avoidance): add param Signed-off-by: satoshi-ota <satoshi.ota928@gmail.com> --------- Signed-off-by: satoshi-ota <satoshi.ota928@gmail.com>
1 parent db637bb commit 6d6a7b0

File tree

9 files changed

+417
-213
lines changed

9 files changed

+417
-213
lines changed

planning/behavior_path_avoidance_by_lane_change_module/src/scene.cpp

+2-4
Original file line numberDiff line numberDiff line change
@@ -173,11 +173,9 @@ AvoidancePlanningData AvoidanceByLaneChange::calcAvoidancePlanningData(
173173
const auto shorten_lanes =
174174
utils::cutOverlappedLanes(data.reference_path_rough, data.drivable_lanes);
175175
data.left_bound = toLineString3d(utils::calcBound(
176-
planner_data_->route_handler, shorten_lanes, avoidance_parameters_->use_hatched_road_markings,
177-
avoidance_parameters_->use_intersection_areas, true));
176+
data.reference_path_rough, planner_data_, shorten_lanes, false, false, false, true));
178177
data.right_bound = toLineString3d(utils::calcBound(
179-
planner_data_->route_handler, shorten_lanes, avoidance_parameters_->use_hatched_road_markings,
180-
avoidance_parameters_->use_intersection_areas, false));
178+
data.reference_path_rough, planner_data_, shorten_lanes, false, false, false, false));
181179

182180
// get related objects from dynamic_objects, and then separates them as target objects and non
183181
// target objects

planning/behavior_path_avoidance_module/config/avoidance.param.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
use_opposite_lane: true
2020
use_intersection_areas: true
2121
use_hatched_road_markings: true
22+
use_freespace_areas: true
2223

2324
# for debug
2425
publish_debug_marker: false

planning/behavior_path_avoidance_module/include/behavior_path_avoidance_module/data_structs.hpp

+3
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,9 @@ struct AvoidanceParameters
115115
// use intersection area for avoidance
116116
bool use_intersection_areas{false};
117117

118+
// use freespace area for avoidance
119+
bool use_freespace_areas{false};
120+
118121
// consider avoidance return dead line
119122
bool enable_dead_line_for_goal{false};
120123
bool enable_dead_line_for_traffic_light{false};

planning/behavior_path_avoidance_module/include/behavior_path_avoidance_module/parameter_helper.hpp

+1
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ AvoidanceParameters getParameter(rclcpp::Node * node)
5757
p.use_intersection_areas = getOrDeclareParameter<bool>(*node, ns + "use_intersection_areas");
5858
p.use_hatched_road_markings =
5959
getOrDeclareParameter<bool>(*node, ns + "use_hatched_road_markings");
60+
p.use_freespace_areas = getOrDeclareParameter<bool>(*node, ns + "use_freespace_areas");
6061
}
6162

6263
// target object

planning/behavior_path_avoidance_module/src/scene.cpp

+8-4
Original file line numberDiff line numberDiff line change
@@ -235,11 +235,13 @@ void AvoidanceModule::fillFundamentalData(AvoidancePlanningData & data, DebugDat
235235
auto tmp_path = getPreviousModuleOutput().path;
236236
const auto shorten_lanes = utils::cutOverlappedLanes(tmp_path, data.drivable_lanes);
237237
data.left_bound = toLineString3d(utils::calcBound(
238-
planner_data_->route_handler, shorten_lanes, parameters_->use_hatched_road_markings,
239-
parameters_->use_intersection_areas, true));
238+
getPreviousModuleOutput().path, planner_data_, shorten_lanes,
239+
parameters_->use_hatched_road_markings, parameters_->use_intersection_areas,
240+
parameters_->use_freespace_areas, true));
240241
data.right_bound = toLineString3d(utils::calcBound(
241-
planner_data_->route_handler, shorten_lanes, parameters_->use_hatched_road_markings,
242-
parameters_->use_intersection_areas, false));
242+
getPreviousModuleOutput().path, planner_data_, shorten_lanes,
243+
parameters_->use_hatched_road_markings, parameters_->use_intersection_areas,
244+
parameters_->use_freespace_areas, false));
243245

244246
// reference path
245247
if (isDrivingSameLane(helper_->getPreviousDrivingLanes(), data.current_lanelets)) {
@@ -938,6 +940,8 @@ BehaviorModuleOutput AvoidanceModule::plan()
938940
// expand intersection areas
939941
current_drivable_area_info.enable_expanding_intersection_areas =
940942
parameters_->use_intersection_areas;
943+
// expand freespace areas
944+
current_drivable_area_info.enable_expanding_freespace_areas = parameters_->use_freespace_areas;
941945

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

planning/behavior_path_planner/src/planner_manager.cpp

+2-3
Original file line numberDiff line numberDiff line change
@@ -226,8 +226,7 @@ void PlannerManager::generateCombinedDrivableArea(
226226
} else if (di.is_already_expanded) {
227227
// for single side shift
228228
utils::generateDrivableArea(
229-
output.path, di.drivable_lanes, false, false, data->parameters.vehicle_length, data,
230-
is_driving_forward);
229+
output.path, di.drivable_lanes, false, false, false, data, is_driving_forward);
231230
} else {
232231
const auto shorten_lanes = utils::cutOverlappedLanes(output.path, di.drivable_lanes);
233232

@@ -239,7 +238,7 @@ void PlannerManager::generateCombinedDrivableArea(
239238
// for other modules where multiple modules may be launched
240239
utils::generateDrivableArea(
241240
output.path, expanded_lanes, di.enable_expanding_hatched_road_markings,
242-
di.enable_expanding_intersection_areas, data->parameters.vehicle_length, data,
241+
di.enable_expanding_intersection_areas, di.enable_expanding_freespace_areas, data,
243242
is_driving_forward);
244243
}
245244

planning/behavior_path_planner_common/include/behavior_path_planner_common/data_manager.hpp

+1
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ struct DrivableAreaInfo
106106
std::vector<Obstacle> obstacles{}; // obstacles to extract from the drivable area
107107
bool enable_expanding_hatched_road_markings{false};
108108
bool enable_expanding_intersection_areas{false};
109+
bool enable_expanding_freespace_areas{false};
109110

110111
// temporary only for pull over's freespace planning
111112
double drivable_margin{0.0};

planning/behavior_path_planner_common/include/behavior_path_planner_common/utils/drivable_area_expansion/static_drivable_area.hpp

+21-7
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020
#include <memory>
2121
#include <string>
22+
#include <utility>
2223
#include <vector>
2324
namespace behavior_path_planner::utils
2425
{
@@ -40,8 +41,8 @@ std::vector<DrivableLanes> getNonOverlappingExpandedLanes(
4041
void generateDrivableArea(
4142
PathWithLaneId & path, const std::vector<DrivableLanes> & lanes,
4243
const bool enable_expanding_hatched_road_markings, const bool enable_expanding_intersection_areas,
43-
const double vehicle_length, const std::shared_ptr<const PlannerData> planner_data,
44-
const bool is_driving_forward = true);
44+
const bool enable_expanding_freespace_areas,
45+
const std::shared_ptr<const PlannerData> planner_data, const bool is_driving_forward = true);
4546

4647
void generateDrivableArea(
4748
PathWithLaneId & path, const double vehicle_length, const double offset,
@@ -62,6 +63,11 @@ std::vector<DrivableLanes> expandLanelets(
6263
void extractObstaclesFromDrivableArea(
6364
PathWithLaneId & path, const std::vector<DrivableAreaInfo::Obstacle> & obstacles);
6465

66+
std::pair<std::vector<lanelet::ConstPoint3d>, bool> getBoundWithFreeSpaceAreas(
67+
const std::vector<lanelet::ConstPoint3d> & original_bound,
68+
const std::vector<lanelet::ConstPoint3d> & other_side_bound,
69+
const std::shared_ptr<const PlannerData> planner_data, const bool is_left);
70+
6571
std::vector<lanelet::ConstPoint3d> getBoundWithHatchedRoadMarkings(
6672
const std::vector<lanelet::ConstPoint3d> & original_bound,
6773
const std::shared_ptr<RouteHandler> & route_handler);
@@ -72,14 +78,22 @@ std::vector<lanelet::ConstPoint3d> getBoundWithIntersectionAreas(
7278
const std::vector<DrivableLanes> & drivable_lanes, const bool is_left);
7379

7480
std::vector<geometry_msgs::msg::Point> calcBound(
75-
const std::shared_ptr<RouteHandler> route_handler,
81+
const PathWithLaneId & path, const std::shared_ptr<const PlannerData> planner_data,
82+
const std::vector<DrivableLanes> & drivable_lanes,
83+
const bool enable_expanding_hatched_road_markings, const bool enable_expanding_intersection_areas,
84+
const bool enable_expanding_freespace_areas, const bool is_left,
85+
const bool is_driving_forward = true);
86+
87+
std::vector<geometry_msgs::msg::Point> postProcess(
88+
const std::vector<geometry_msgs::msg::Point> & original_bound, const PathWithLaneId & path,
89+
const std::shared_ptr<const PlannerData> planner_data,
7690
const std::vector<DrivableLanes> & drivable_lanes,
7791
const bool enable_expanding_hatched_road_markings, const bool enable_expanding_intersection_areas,
78-
const bool is_left);
92+
const bool is_left, const bool is_driving_forward = true);
7993

80-
void makeBoundLongitudinallyMonotonic(
81-
PathWithLaneId & path, const std::shared_ptr<const PlannerData> & planner_data,
82-
const bool is_bound_left);
94+
std::vector<geometry_msgs::msg::Point> makeBoundLongitudinallyMonotonic(
95+
const std::vector<geometry_msgs::msg::Point> & original_bound, const PathWithLaneId & path,
96+
const std::shared_ptr<const PlannerData> & planner_data, const bool is_left);
8397

8498
DrivableAreaInfo combineDrivableAreaInfo(
8599
const DrivableAreaInfo & drivable_area_info1, const DrivableAreaInfo & drivable_area_info2);

0 commit comments

Comments
 (0)