@@ -1564,8 +1564,10 @@ std::vector<geometry_msgs::msg::Point> postProcess(
1564
1564
findNearestSegmentIndexFromLateralDistance (tmp_bound, front_pose, M_PI_2);
1565
1565
const auto start_point =
1566
1566
calcLongitudinalOffsetStartPoint (tmp_bound, front_pose, front_start_idx, -front_length);
1567
+
1567
1568
// Insert a start point
1568
1569
processed_bound.push_back (start_point);
1570
+
1569
1571
const auto p_tmp =
1570
1572
geometry_msgs::build<Pose>().position (start_point).orientation (front_pose.orientation );
1571
1573
return findNearestSegmentIndexFromLateralDistance (tmp_bound, p_tmp, M_PI_2);
@@ -1585,27 +1587,19 @@ std::vector<geometry_msgs::msg::Point> postProcess(
1585
1587
return std::make_pair (goal_idx, goal_point);
1586
1588
}();
1587
1589
1588
- // Forward driving
1589
- if (start_idx < goal_idx){
1590
- for (size_t i = start_idx + 1 ; i <= goal_idx; ++i) {
1591
- const auto & next_point = tmp_bound.at (i);
1592
- const double dist = tier4_autoware_utils::calcDistance2d (processed_bound.back (), next_point);
1593
- if (dist > overlap_threshold) {
1594
- processed_bound.push_back (next_point);
1595
- }
1596
- }
1597
- }
1598
- // Backward driving
1599
- else {
1600
- for (size_t i = start_idx - 1 ; i >= goal_idx; --i) {
1601
- const auto & next_point = tmp_bound.at (i);
1602
- const double dist = tier4_autoware_utils::calcDistance2d (processed_bound.back (), next_point);
1603
- if (dist > overlap_threshold) {
1604
- processed_bound.push_back (next_point);
1605
- }
1590
+ // Insert middle points
1591
+ size_t step = (start_idx < goal_idx) ? 1 : -1 ;
1592
+ for (size_t i = start_idx + step; i != goal_idx + step; i += step) {
1593
+ const auto &next_point = tmp_bound.at (i);
1594
+ const double dist = tier4_autoware_utils::calcDistance2d (processed_bound.back (), next_point);
1595
+ if (dist > overlap_threshold) {
1596
+ processed_bound.push_back (next_point);
1606
1597
}
1607
1598
}
1608
- if (tier4_autoware_utils::calcDistance2d (processed_bound.back (), goal_point) > overlap_threshold) {
1599
+
1600
+ // Insert a goal point
1601
+ if (
1602
+ tier4_autoware_utils::calcDistance2d (processed_bound.back (), goal_point) > overlap_threshold) {
1609
1603
processed_bound.push_back (goal_point);
1610
1604
}
1611
1605
0 commit comments