Skip to content

Commit 887105e

Browse files
committed
feat(avoidance): make it possible to use freespace areas in avoidance module (autowarefoundation#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 789831b commit 887105e

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
@@ -170,11 +170,9 @@ AvoidancePlanningData AvoidanceByLaneChange::calcAvoidancePlanningData(
170170
const auto shorten_lanes =
171171
utils::cutOverlappedLanes(data.reference_path_rough, data.drivable_lanes);
172172
data.left_bound = toLineString3d(utils::calcBound(
173-
planner_data_->route_handler, shorten_lanes, avoidance_parameters_->use_hatched_road_markings,
174-
avoidance_parameters_->use_intersection_areas, true));
173+
data.reference_path_rough, planner_data_, shorten_lanes, false, false, false, true));
175174
data.right_bound = toLineString3d(utils::calcBound(
176-
planner_data_->route_handler, shorten_lanes, avoidance_parameters_->use_hatched_road_markings,
177-
avoidance_parameters_->use_intersection_areas, false));
175+
data.reference_path_rough, planner_data_, shorten_lanes, false, false, false, false));
178176

179177
// get related objects from dynamic_objects, and then separates them as target objects and non
180178
// 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)) {
@@ -937,6 +939,8 @@ BehaviorModuleOutput AvoidanceModule::plan()
937939
// expand intersection areas
938940
current_drivable_area_info.enable_expanding_intersection_areas =
939941
parameters_->use_intersection_areas;
942+
// expand freespace areas
943+
current_drivable_area_info.enable_expanding_freespace_areas = parameters_->use_freespace_areas;
940944

941945
output.drivable_area_info = utils::combineDrivableAreaInfo(
942946
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
@@ -216,8 +216,7 @@ void PlannerManager::generateCombinedDrivableArea(
216216
} else if (di.is_already_expanded) {
217217
// for single side shift
218218
utils::generateDrivableArea(
219-
output.path, di.drivable_lanes, false, false, data->parameters.vehicle_length, data,
220-
is_driving_forward);
219+
output.path, di.drivable_lanes, false, false, false, data, is_driving_forward);
221220
} else {
222221
const auto shorten_lanes = utils::cutOverlappedLanes(output.path, di.drivable_lanes);
223222

@@ -229,7 +228,7 @@ void PlannerManager::generateCombinedDrivableArea(
229228
// for other modules where multiple modules may be launched
230229
utils::generateDrivableArea(
231230
output.path, expanded_lanes, di.enable_expanding_hatched_road_markings,
232-
di.enable_expanding_intersection_areas, data->parameters.vehicle_length, data,
231+
di.enable_expanding_intersection_areas, di.enable_expanding_freespace_areas, data,
233232
is_driving_forward);
234233
}
235234

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,
@@ -65,6 +66,11 @@ std::vector<DrivableLanes> expandLanelets(
6566
void extractObstaclesFromDrivableArea(
6667
PathWithLaneId & path, const std::vector<DrivableAreaInfo::Obstacle> & obstacles);
6768

69+
std::pair<std::vector<lanelet::ConstPoint3d>, bool> getBoundWithFreeSpaceAreas(
70+
const std::vector<lanelet::ConstPoint3d> & original_bound,
71+
const std::vector<lanelet::ConstPoint3d> & other_side_bound,
72+
const std::shared_ptr<const PlannerData> planner_data, const bool is_left);
73+
6874
std::vector<lanelet::ConstPoint3d> getBoundWithHatchedRoadMarkings(
6975
const std::vector<lanelet::ConstPoint3d> & original_bound,
7076
const std::shared_ptr<RouteHandler> & route_handler);
@@ -75,14 +81,22 @@ std::vector<lanelet::ConstPoint3d> getBoundWithIntersectionAreas(
7581
const std::vector<DrivableLanes> & drivable_lanes, const bool is_left);
7682

7783
std::vector<geometry_msgs::msg::Point> calcBound(
78-
const std::shared_ptr<RouteHandler> route_handler,
84+
const PathWithLaneId & path, const std::shared_ptr<const PlannerData> planner_data,
85+
const std::vector<DrivableLanes> & drivable_lanes,
86+
const bool enable_expanding_hatched_road_markings, const bool enable_expanding_intersection_areas,
87+
const bool enable_expanding_freespace_areas, const bool is_left,
88+
const bool is_driving_forward = true);
89+
90+
std::vector<geometry_msgs::msg::Point> postProcess(
91+
const std::vector<geometry_msgs::msg::Point> & original_bound, const PathWithLaneId & path,
92+
const std::shared_ptr<const PlannerData> planner_data,
7993
const std::vector<DrivableLanes> & drivable_lanes,
8094
const bool enable_expanding_hatched_road_markings, const bool enable_expanding_intersection_areas,
81-
const bool is_left);
95+
const bool is_left, const bool is_driving_forward = true);
8296

83-
void makeBoundLongitudinallyMonotonic(
84-
PathWithLaneId & path, const std::shared_ptr<const PlannerData> & planner_data,
85-
const bool is_bound_left);
97+
std::vector<geometry_msgs::msg::Point> makeBoundLongitudinallyMonotonic(
98+
const std::vector<geometry_msgs::msg::Point> & original_bound, const PathWithLaneId & path,
99+
const std::shared_ptr<const PlannerData> & planner_data, const bool is_left);
86100

87101
DrivableAreaInfo combineDrivableAreaInfo(
88102
const DrivableAreaInfo & drivable_area_info1, const DrivableAreaInfo & drivable_area_info2);

0 commit comments

Comments
 (0)