Skip to content

Commit

Permalink
fix(behavior_path_planner): insert stop point in root reference path (a…
Browse files Browse the repository at this point in the history
…utowarefoundation#653)

* fix(behavior_path_planner): insert stop point in root reference path

Signed-off-by: Fumiya Watanabe <[email protected]>

* fix(behavior_path_planner): fix insert stop point calculation

Signed-off-by: Fumiya Watanabe <[email protected]>

---------

Signed-off-by: Fumiya Watanabe <[email protected]>
  • Loading branch information
rej55 authored Jul 10, 2023
1 parent 8444898 commit 9350e87
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,6 @@ class LaneChangeBase

virtual void updateSpecialData() {}

virtual void insertStopPoint([[maybe_unused]] PathWithLaneId & path) {}

const LaneChangeStatus & getLaneChangeStatus() const { return status_; }

const LaneChangePaths & getDebugValidPath() const { return debug_valid_path_; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,6 @@ class NormalLaneChange : public LaneChangeBase

void extendOutputDrivableArea(BehaviorModuleOutput & output) override;

void insertStopPoint(PathWithLaneId & path) override;

PathWithLaneId getReferencePath() const override;

void resetParameters() override;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,6 @@ BehaviorModuleOutput LaneChangeInterface::plan()
BehaviorModuleOutput LaneChangeInterface::planWaitingApproval()
{
*prev_approved_path_ = *getPreviousModuleOutput().path;
module_type_->insertStopPoint(*prev_approved_path_);

BehaviorModuleOutput out;
out.path = std::make_shared<PathWithLaneId>(*prev_approved_path_);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,19 +170,6 @@ void NormalLaneChange::extendOutputDrivableArea(BehaviorModuleOutput & output)
*output.path, expanded_lanes, false, common_parameters.vehicle_length, planner_data_);
}

void NormalLaneChange::insertStopPoint(PathWithLaneId & path)
{
const auto shift_intervals = getRouteHandler()->getLateralIntervalsToPreferredLane(
status_.lane_change_path.reference_lanelets.back());
const double lane_change_buffer =
utils::calcMinimumLaneChangeLength(getCommonParam(), shift_intervals, 0.0);
constexpr double stop_point_buffer{1.0};
const auto stopping_distance = std::max(
motion_utils::calcArcLength(path.points) - lane_change_buffer - stop_point_buffer, 0.0);

const auto stop_point = utils::insertStopPoint(stopping_distance, path);
}

PathWithLaneId NormalLaneChange::getReferencePath() const
{
return utils::getCenterLinePathFromRootLanelet(status_.lane_change_lanes.front(), planner_data_);
Expand Down
16 changes: 16 additions & 0 deletions planning/behavior_path_planner/src/utils/utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2518,6 +2518,22 @@ BehaviorModuleOutput getReferencePath(
*route_handler, current_lanes_with_backward_margin, current_pose, backward_length,
p.forward_path_length, p);

// Set stop point for lane change
if (route_handler->getNumLaneToPreferredLane(current_lanes_with_backward_margin.back()) != 0) {
const auto shift_intervals =
route_handler->getLateralIntervalsToPreferredLane(current_lanes_with_backward_margin.back());
const double lane_change_buffer = utils::calcMinimumLaneChangeLength(p, shift_intervals, 0.0);
const double length_to_dead_end = utils::getDistanceToEndOfLane(
reference_path.points.back().point.pose, current_lanes_with_backward_margin);
constexpr double stop_point_buffer{1.0};
const auto stopping_distance = std::max(
motion_utils::calcArcLength(reference_path.points) -
(lane_change_buffer + stop_point_buffer - length_to_dead_end),
0.0);

const auto stop_point = utils::insertStopPoint(stopping_distance, reference_path);
}

// clip backward length
// NOTE: In order to keep backward_path_length at least, resampling interval is added to the
// backward.
Expand Down

0 comments on commit 9350e87

Please sign in to comment.