Skip to content

Commit 5d6449d

Browse files
authored
fix(lane_change): add margin in stuck detection distance (#5306)
* fix(lane_change): add margin in stuck detection distance Signed-off-by: Takamasa Horibe <horibe.takamasa@gmail.com> * use margin Signed-off-by: Takamasa Horibe <horibe.takamasa@gmail.com> --------- Signed-off-by: Takamasa Horibe <horibe.takamasa@gmail.com>
1 parent b266f47 commit 5d6449d

File tree

1 file changed

+16
-2
lines changed
  • planning/behavior_path_planner/src/scene_module/lane_change

1 file changed

+16
-2
lines changed

planning/behavior_path_planner/src/scene_module/lane_change/normal.cpp

+16-2
Original file line numberDiff line numberDiff line change
@@ -655,7 +655,7 @@ std::vector<double> NormalLaneChange::sampleLongitudinalAccValues(
655655
}
656656

657657
// If the ego is in stuck, sampling all possible accelerations to find avoiding path.
658-
if (isVehicleStuckByObstacle(current_lanes, max_lane_change_length)) {
658+
if (isVehicleStuckByObstacle(current_lanes)) {
659659
auto clock = rclcpp::Clock(RCL_ROS_TIME);
660660
RCLCPP_INFO_THROTTLE(
661661
logger_, clock, 1000, "Vehicle is stuck. sample all longitudinal acceleration.");
@@ -1668,7 +1668,21 @@ bool NormalLaneChange::isVehicleStuckByObstacle(const lanelet::ConstLanelets & c
16681668

16691669
const auto [min_acc, max_acc] = calcCurrentMinMaxAcceleration();
16701670
const auto max_lane_change_length = calcMaximumLaneChangeLength(current_lanes.back(), max_acc);
1671-
return isVehicleStuckByObstacle(current_lanes, max_lane_change_length);
1671+
const auto rss_dist = calcRssDistance(
1672+
0.0, planner_data_->parameters.minimum_lane_changing_velocity,
1673+
lane_change_parameters_->rss_params);
1674+
1675+
// It is difficult to define the detection range. If it is too short, the stuck will not be
1676+
// determined, even though you are stuck by an obstacle. If it is too long,
1677+
// the ego will be judged to be stuck by a distant vehicle, even though the ego is only
1678+
// stopped at a traffic light. Essentially, the calculation should be based on the information of
1679+
// the stop reason, but this is outside the scope of one module. I keep it as a TODO.
1680+
constexpr double DETECTION_DISTANCE_MARGIN = 10.0;
1681+
const auto detection_distance = max_lane_change_length + rss_dist +
1682+
getCommonParam().base_link2front + DETECTION_DISTANCE_MARGIN;
1683+
RCLCPP_INFO(logger_, "max_lane_change_length: %f, max_acc: %f", max_lane_change_length, max_acc);
1684+
1685+
return isVehicleStuckByObstacle(current_lanes, detection_distance);
16721686
}
16731687

16741688
void NormalLaneChange::setStopPose(const Pose & stop_pose)

0 commit comments

Comments
 (0)