Skip to content

Commit 90db599

Browse files
maxime-clemvividf
authored andcommitted
perf(side_shift): fix unupdated prev path that caused heavy interpolation (autowarefoundation#6967)
Signed-off-by: Maxime CLEMENT <maxime.clement@tier4.jp> Signed-off-by: vividf <yihsiang.fang@tier4.jp>
1 parent d19f9b8 commit 90db599

File tree

2 files changed

+6
-9
lines changed
  • planning/behavior_path_side_shift_module

2 files changed

+6
-9
lines changed

planning/behavior_path_side_shift_module/include/behavior_path_side_shift_module/scene.hpp

-1
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,6 @@ class SideShiftModule : public SceneModuleInterface
9292
// member
9393
PathWithLaneId refined_path_{};
9494
PathWithLaneId reference_path_{};
95-
PathWithLaneId prev_reference_{};
9695
lanelet::ConstLanelets current_lanelets_;
9796
std::shared_ptr<SideShiftParameters> parameters_;
9897

planning/behavior_path_side_shift_module/src/scene.cpp

+6-8
Original file line numberDiff line numberDiff line change
@@ -202,9 +202,6 @@ void SideShiftModule::updateData()
202202
const auto reference_pose = prev_output_.shift_length.empty()
203203
? planner_data_->self_odometry->pose.pose
204204
: utils::getUnshiftedEgoPose(getEgoPose(), prev_output_);
205-
if (prev_reference_.points.empty()) {
206-
prev_reference_ = getPreviousModuleOutput().path;
207-
}
208205
if (getPreviousModuleOutput().reference_path.points.empty()) {
209206
return;
210207
}
@@ -433,13 +430,14 @@ PathWithLaneId SideShiftModule::extendBackwardLength(const PathWithLaneId & orig
433430
const auto backward_length = std::max(
434431
planner_data_->parameters.backward_path_length, longest_dist_to_shift_point + extra_margin);
435432

433+
const auto & prev_reference = getPreviousModuleOutput().path;
436434
const size_t orig_ego_idx = findNearestIndex(original_path.points, getEgoPose().position);
437-
const size_t prev_ego_idx = findNearestSegmentIndex(
438-
prev_reference_.points, getPoint(original_path.points.at(orig_ego_idx)));
435+
const size_t prev_ego_idx =
436+
findNearestSegmentIndex(prev_reference.points, getPoint(original_path.points.at(orig_ego_idx)));
439437

440438
size_t clip_idx = 0;
441439
for (size_t i = 0; i < prev_ego_idx; ++i) {
442-
if (backward_length > calcSignedArcLength(prev_reference_.points, clip_idx, prev_ego_idx)) {
440+
if (backward_length > calcSignedArcLength(prev_reference.points, clip_idx, prev_ego_idx)) {
443441
break;
444442
}
445443
clip_idx = i;
@@ -448,8 +446,8 @@ PathWithLaneId SideShiftModule::extendBackwardLength(const PathWithLaneId & orig
448446
PathWithLaneId extended_path{};
449447
{
450448
extended_path.points.insert(
451-
extended_path.points.end(), prev_reference_.points.begin() + clip_idx,
452-
prev_reference_.points.begin() + prev_ego_idx);
449+
extended_path.points.end(), prev_reference.points.begin() + clip_idx,
450+
prev_reference.points.begin() + prev_ego_idx);
453451
}
454452

455453
{

0 commit comments

Comments
 (0)