Skip to content

Commit 6840e85

Browse files
add param to override lane_departure_check when starting outside lane
Signed-off-by: Daniel Sanchez <danielsanchezaran@gmail.com>
1 parent 499f56c commit 6840e85

File tree

4 files changed

+26
-5
lines changed

4 files changed

+26
-5
lines changed

planning/behavior_path_start_planner_module/config/start_planner.param.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
# shift pull out
1414
enable_shift_pull_out: true
1515
check_shift_path_lane_departure: true
16+
allow_check_shift_path_lane_departure_override: false
1617
shift_collision_check_distance_from_end: -10.0
1718
minimum_shift_pull_out_distance: 0.0
1819
deceleration_interval: 15.0

planning/behavior_path_start_planner_module/include/behavior_path_start_planner_module/data_structs.hpp

+1
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ struct StartPlannerParameters
7272
// shift pull out
7373
bool enable_shift_pull_out{false};
7474
bool check_shift_path_lane_departure{false};
75+
bool allow_check_shift_path_lane_departure_override{false};
7576
double shift_collision_check_distance_from_end{0.0};
7677
double minimum_shift_pull_out_distance{0.0};
7778
int lateral_acceleration_sampling_num{0};

planning/behavior_path_start_planner_module/src/manager.cpp

+5
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@ void StartPlannerModuleManager::init(rclcpp::Node * node)
5454
p.enable_shift_pull_out = node->declare_parameter<bool>(ns + "enable_shift_pull_out");
5555
p.check_shift_path_lane_departure =
5656
node->declare_parameter<bool>(ns + "check_shift_path_lane_departure");
57+
p.allow_check_shift_path_lane_departure_override =
58+
node->declare_parameter<bool>(ns + "allow_check_shift_path_lane_departure_override");
5759
p.shift_collision_check_distance_from_end =
5860
node->declare_parameter<double>(ns + "shift_collision_check_distance_from_end");
5961
p.minimum_shift_pull_out_distance =
@@ -390,6 +392,9 @@ void StartPlannerModuleManager::updateModuleParams(
390392
p->geometric_collision_check_distance_from_end);
391393
updateParam<bool>(
392394
parameters, ns + "check_shift_path_lane_departure", p->check_shift_path_lane_departure);
395+
updateParam<bool>(
396+
parameters, ns + "allow_check_shift_path_lane_departure_override",
397+
p->allow_check_shift_path_lane_departure_override);
393398
updateParam<std::string>(parameters, ns + "search_priority", p->search_priority);
394399
updateParam<double>(parameters, ns + "max_back_distance", p->max_back_distance);
395400
updateParam<double>(

planning/behavior_path_start_planner_module/src/shift_pull_out.cpp

+19-5
Original file line numberDiff line numberDiff line change
@@ -74,13 +74,27 @@ std::optional<PullOutPath> ShiftPullOut::plan(const Pose & start_pose, const Pos
7474
shift_path.points.begin() + pull_out_end_idx + 1);
7575
}
7676

77-
// check lane departure
78-
// The method for lane departure checking verifies if the footprint of each point on the path is
79-
// contained within a lanelet using `boost::geometry::within`, which incurs a high computational
80-
// cost.
8177
const auto lanelet_map_ptr = planner_data_->route_handler->getLaneletMapPtr();
78+
79+
// if lane departure check override is true, and if the initial pose is not fully within a lane,
80+
// cancel lane departure check
81+
const bool is_lane_departure_check_required = std::invoke([&]() -> bool {
82+
if (!parameters_.allow_check_shift_path_lane_departure_override)
83+
return parameters_.check_shift_path_lane_departure;
84+
85+
PathWithLaneId path_with_only_first_pose{};
86+
path_with_only_first_pose.points.push_back(path_shift_start_to_end.points.at(0));
87+
return !lane_departure_checker_->checkPathWillLeaveLane(
88+
lanelet_map_ptr, path_with_only_first_pose);
89+
});
90+
91+
// check lane departure
92+
// The method for lane departure checking verifies if the footprint of each point on the path
93+
// is contained within a lanelet using `boost::geometry::within`, which incurs a high
94+
// computational cost.
95+
8296
if (
83-
parameters_.check_shift_path_lane_departure &&
97+
is_lane_departure_check_required &&
8498
lane_departure_checker_->checkPathWillLeaveLane(lanelet_map_ptr, path_shift_start_to_end)) {
8599
continue;
86100
}

0 commit comments

Comments
 (0)