File tree 1 file changed +6
-2
lines changed
common/motion_utils/include/motion_utils/trajectory
1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -607,8 +607,12 @@ double calcLateralOffset(
607
607
return std::nan (" " );
608
608
}
609
609
610
- const auto p_front = tier4_autoware_utils::getPoint (overlap_removed_points.at (seg_idx));
611
- const auto p_back = tier4_autoware_utils::getPoint (overlap_removed_points.at (seg_idx + 1 ));
610
+ const auto p_indices = overlap_removed_points.size () - 2 ;
611
+ const auto p_front_idx = (p_indices > seg_idx) ? seg_idx : p_indices;
612
+ const auto p_back_idx = p_front_idx + 1 ;
613
+
614
+ const auto p_front = tier4_autoware_utils::getPoint (overlap_removed_points.at (p_front_idx));
615
+ const auto p_back = tier4_autoware_utils::getPoint (overlap_removed_points.at (p_back_idx));
612
616
613
617
const Eigen::Vector3d segment_vec{p_back.x - p_front.x , p_back.y - p_front.y , 0.0 };
614
618
const Eigen::Vector3d target_vec{p_target.x - p_front.x , p_target.y - p_front.y , 0.0 };
You can’t perform that action at this time.
0 commit comments