@@ -1008,7 +1008,8 @@ IntersectionModule::DecisionResult IntersectionModule::modifyPathVelocityDetail(
1008
1008
getTrafficPrioritizedLevel (assigned_lanelet, planner_data_->traffic_light_id_map );
1009
1009
const bool is_prioritized =
1010
1010
traffic_prioritized_level == TrafficPrioritizedLevel::FULLY_PRIORITIZED;
1011
- intersection_lanelets.update (is_prioritized, interpolated_path_info, footprint, baselink2front);
1011
+ intersection_lanelets.update (
1012
+ is_prioritized, interpolated_path_info, footprint, baselink2front, routing_graph_ptr);
1012
1013
1013
1014
// this is abnormal
1014
1015
const auto & conflicting_lanelets = intersection_lanelets.conflicting ();
@@ -1019,6 +1020,7 @@ IntersectionModule::DecisionResult IntersectionModule::modifyPathVelocityDetail(
1019
1020
}
1020
1021
const auto & first_conflicting_lane = first_conflicting_lane_opt.value ();
1021
1022
const auto & first_conflicting_area = first_conflicting_area_opt.value ();
1023
+ const auto & second_attention_area_opt = intersection_lanelets.second_attention_area ();
1022
1024
1023
1025
// generate all stop line candidates
1024
1026
// see the doc for struct IntersectionStopLines
@@ -1029,16 +1031,20 @@ IntersectionModule::DecisionResult IntersectionModule::modifyPathVelocityDetail(
1029
1031
: first_conflicting_lane;
1030
1032
1031
1033
const auto intersection_stoplines_opt = generateIntersectionStopLines (
1032
- assigned_lanelet, first_conflicting_area, dummy_first_attention_lane, interpolated_path_info ,
1033
- path);
1034
+ assigned_lanelet, first_conflicting_area, dummy_first_attention_lane, second_attention_area_opt ,
1035
+ interpolated_path_info, path);
1034
1036
if (!intersection_stoplines_opt) {
1035
1037
return IntersectionModule::Indecisive{" failed to generate intersection_stoplines" };
1036
1038
}
1037
1039
const auto & intersection_stoplines = intersection_stoplines_opt.value ();
1038
- const auto
1039
- [closest_idx, stuck_stopline_idx_opt, default_stopline_idx_opt,
1040
- first_attention_stopline_idx_opt, occlusion_peeking_stopline_idx_opt,
1041
- default_pass_judge_line_idx, occlusion_wo_tl_pass_judge_line_idx] = intersection_stoplines;
1040
+ const auto closest_idx = intersection_stoplines.closest_idx ;
1041
+ const auto stuck_stopline_idx_opt = intersection_stoplines.stuck_stopline ;
1042
+ const auto default_stopline_idx_opt = intersection_stoplines.default_stopline ;
1043
+ const auto first_attention_stopline_idx_opt = intersection_stoplines.first_attention_stopline ;
1044
+ const auto occlusion_peeking_stopline_idx_opt = intersection_stoplines.occlusion_peeking_stopline ;
1045
+ const auto default_pass_judge_line_idx = intersection_stoplines.first_pass_judge_line ;
1046
+ const auto occlusion_wo_tl_pass_judge_line_idx =
1047
+ intersection_stoplines.occlusion_wo_tl_pass_judge_line ;
1042
1048
1043
1049
// see the doc for struct PathLanelets
1044
1050
const auto & first_attention_area_opt = intersection_lanelets.first_attention_area ();
@@ -1147,6 +1153,8 @@ IntersectionModule::DecisionResult IntersectionModule::modifyPathVelocityDetail(
1147
1153
debug_data_.attention_area = intersection_lanelets.attention_area ();
1148
1154
debug_data_.occlusion_attention_area = occlusion_attention_area;
1149
1155
debug_data_.adjacent_area = intersection_lanelets.adjacent_area ();
1156
+ debug_data_.first_attention_area = intersection_lanelets.first_attention_area ();
1157
+ debug_data_.second_attention_area = intersection_lanelets.second_attention_area ();
1150
1158
1151
1159
// check occlusion on detection lane
1152
1160
if (!occlusion_attention_divisions_) {
@@ -1662,6 +1670,7 @@ IntersectionLanelets IntersectionModule::getObjectiveLanelets(
1662
1670
std::optional<IntersectionStopLines> IntersectionModule::generateIntersectionStopLines (
1663
1671
lanelet::ConstLanelet assigned_lanelet, const lanelet::CompoundPolygon3d & first_conflicting_area,
1664
1672
const lanelet::ConstLanelet & first_attention_lane,
1673
+ const std::optional<lanelet::CompoundPolygon3d> & second_attention_area_opt,
1665
1674
const util::InterpolatedPathInfo & interpolated_path_info,
1666
1675
autoware_auto_planning_msgs::msg::PathWithLaneId * original_path)
1667
1676
{
@@ -1683,15 +1692,16 @@ std::optional<IntersectionStopLines> IntersectionModule::generateIntersectionSto
1683
1692
const int base2front_idx_dist =
1684
1693
std::ceil (planner_data_->vehicle_info_ .max_longitudinal_offset_m / ds);
1685
1694
1686
- // find the index of the first point whose vehicle footprint on it intersects with detection_area
1695
+ // find the index of the first point whose vehicle footprint on it intersects with attention_area
1687
1696
const auto local_footprint = planner_data_->vehicle_info_ .createFootprint (0.0 , 0.0 );
1688
- std::optional<size_t > first_footprint_inside_detection_ip_opt =
1697
+ const std::optional<size_t > first_footprint_inside_1st_attention_ip_opt =
1689
1698
getFirstPointInsidePolygonByFootprint (
1690
1699
first_attention_area, interpolated_path_info, local_footprint, baselink2front);
1691
- if (!first_footprint_inside_detection_ip_opt ) {
1700
+ if (!first_footprint_inside_1st_attention_ip_opt ) {
1692
1701
return std::nullopt;
1693
1702
}
1694
- const auto first_footprint_inside_detection_ip = first_footprint_inside_detection_ip_opt.value ();
1703
+ const auto first_footprint_inside_1st_attention_ip =
1704
+ first_footprint_inside_1st_attention_ip_opt.value ();
1695
1705
1696
1706
std::optional<size_t > first_footprint_attention_centerline_ip_opt = std::nullopt;
1697
1707
for (auto i = std::get<0 >(lane_interval_ip); i < std::get<1 >(lane_interval_ip); ++i) {
@@ -1719,7 +1729,7 @@ std::optional<IntersectionStopLines> IntersectionModule::generateIntersectionSto
1719
1729
stop_idx_ip_int = static_cast <int >(map_stop_idx_ip.value ()) - base2front_idx_dist;
1720
1730
}
1721
1731
if (stop_idx_ip_int < 0 ) {
1722
- stop_idx_ip_int = first_footprint_inside_detection_ip - stopline_margin_idx_dist;
1732
+ stop_idx_ip_int = first_footprint_inside_1st_attention_ip - stopline_margin_idx_dist;
1723
1733
}
1724
1734
if (stop_idx_ip_int < 0 ) {
1725
1735
default_stopline_valid = false ;
@@ -1735,7 +1745,7 @@ std::optional<IntersectionStopLines> IntersectionModule::generateIntersectionSto
1735
1745
// (3) occlusion peeking stop line position on interpolated path
1736
1746
int occlusion_peeking_line_ip_int = static_cast <int >(default_stopline_ip);
1737
1747
bool occlusion_peeking_line_valid = true ;
1738
- // NOTE: if footprints[0] is already inside the detection area, invalid
1748
+ // NOTE: if footprints[0] is already inside the attention area, invalid
1739
1749
{
1740
1750
const auto & base_pose0 = path_ip.points .at (default_stopline_ip).point .pose ;
1741
1751
const auto path_footprint0 = tier4_autoware_utils::transformVector (
@@ -1747,32 +1757,32 @@ std::optional<IntersectionStopLines> IntersectionModule::generateIntersectionSto
1747
1757
}
1748
1758
if (occlusion_peeking_line_valid) {
1749
1759
occlusion_peeking_line_ip_int =
1750
- first_footprint_inside_detection_ip + std::ceil (peeking_offset / ds);
1760
+ first_footprint_inside_1st_attention_ip + std::ceil (peeking_offset / ds);
1751
1761
}
1752
-
1753
1762
const auto occlusion_peeking_line_ip = static_cast <size_t >(
1754
1763
std::clamp<int >(occlusion_peeking_line_ip_int, 0 , static_cast <int >(path_ip.points .size ()) - 1 ));
1755
- const auto first_attention_stopline_ip = first_footprint_inside_detection_ip;
1764
+
1765
+ // (4) first attention stopline position on interpolated path
1766
+ const auto first_attention_stopline_ip = first_footprint_inside_1st_attention_ip;
1756
1767
const bool first_attention_stopline_valid = true ;
1757
1768
1758
- // (4) pass judge line position on interpolated path
1769
+ // (5) 1st pass judge line position on interpolated path
1759
1770
const double velocity = planner_data_->current_velocity ->twist .linear .x ;
1760
1771
const double acceleration = planner_data_->current_acceleration ->accel .accel .linear .x ;
1761
1772
const double braking_dist = planning_utils::calcJudgeLineDistWithJerkLimit (
1762
1773
velocity, acceleration, max_accel, max_jerk, delay_response_time);
1763
- int pass_judge_ip_int =
1764
- static_cast <int >(first_footprint_inside_detection_ip) - std::ceil (braking_dist / ds);
1765
- const auto pass_judge_line_ip = static_cast <size_t >(
1766
- std::clamp<int >(pass_judge_ip_int, 0 , static_cast <int >(path_ip.points .size ()) - 1 ));
1767
- // TODO(Mamoru Sobue): maybe braking dist should be considered
1768
- const auto occlusion_wo_tl_pass_judge_line_ip =
1769
- static_cast <size_t >(first_footprint_attention_centerline_ip);
1770
-
1771
- // (5) stuck vehicle stop line
1774
+ int first_pass_judge_ip_int =
1775
+ static_cast <int >(first_footprint_inside_1st_attention_ip) - std::ceil (braking_dist / ds);
1776
+ const auto first_pass_judge_line_ip = static_cast <size_t >(
1777
+ std::clamp<int >(first_pass_judge_ip_int, 0 , static_cast <int >(path_ip.points .size ()) - 1 ));
1778
+ const auto occlusion_wo_tl_pass_judge_line_ip = static_cast <size_t >(std::max<int >(
1779
+ 0 , static_cast <int >(first_footprint_attention_centerline_ip) - std::ceil (braking_dist / ds)));
1780
+
1781
+ // (6) stuck vehicle stopline position on interpolated path
1772
1782
int stuck_stopline_ip_int = 0 ;
1773
1783
bool stuck_stopline_valid = true ;
1774
1784
if (use_stuck_stopline) {
1775
- // NOTE: when ego vehicle is approaching detection area and already passed
1785
+ // NOTE: when ego vehicle is approaching attention area and already passed
1776
1786
// first_conflicting_area, this could be null.
1777
1787
const auto stuck_stopline_idx_ip_opt = getFirstPointInsidePolygonByFootprint (
1778
1788
first_conflicting_area, interpolated_path_info, local_footprint, baselink2front);
@@ -1791,14 +1801,37 @@ std::optional<IntersectionStopLines> IntersectionModule::generateIntersectionSto
1791
1801
}
1792
1802
const auto stuck_stopline_ip = static_cast <size_t >(std::max (0 , stuck_stopline_ip_int));
1793
1803
1804
+ // (7) second attention stopline position on interpolated path
1805
+ int second_attention_stopline_ip_int = -1 ;
1806
+ bool second_attention_stopline_valid = false ;
1807
+ if (second_attention_area_opt) {
1808
+ const auto & second_attention_area = second_attention_area_opt.value ();
1809
+ std::optional<size_t > first_footprint_inside_2nd_attention_ip_opt =
1810
+ getFirstPointInsidePolygonByFootprint (
1811
+ second_attention_area, interpolated_path_info, local_footprint, baselink2front);
1812
+ if (first_footprint_inside_2nd_attention_ip_opt) {
1813
+ second_attention_stopline_ip_int = first_footprint_inside_2nd_attention_ip_opt.value ();
1814
+ }
1815
+ }
1816
+ const auto second_attention_stopline_ip =
1817
+ second_attention_stopline_ip_int >= 0 ? static_cast <size_t >(second_attention_stopline_ip_int)
1818
+ : 0 ;
1819
+
1820
+ // (8) second pass judge lie position on interpolated path
1821
+ int second_pass_judge_ip_int = second_attention_stopline_ip_int - std::ceil (braking_dist / ds);
1822
+ const auto second_pass_judge_line_ip =
1823
+ static_cast <size_t >(std::max<int >(second_pass_judge_ip_int, 0 ));
1824
+
1794
1825
struct IntersectionStopLinesTemp
1795
1826
{
1796
1827
size_t closest_idx{0 };
1797
1828
size_t stuck_stopline{0 };
1798
1829
size_t default_stopline{0 };
1799
1830
size_t first_attention_stopline{0 };
1831
+ size_t second_attention_stopline{0 };
1800
1832
size_t occlusion_peeking_stopline{0 };
1801
- size_t pass_judge_line{0 };
1833
+ size_t first_pass_judge_line{0 };
1834
+ size_t second_pass_judge_line{0 };
1802
1835
size_t occlusion_wo_tl_pass_judge_line{0 };
1803
1836
};
1804
1837
@@ -1808,8 +1841,10 @@ std::optional<IntersectionStopLines> IntersectionModule::generateIntersectionSto
1808
1841
{&stuck_stopline_ip, &intersection_stoplines_temp.stuck_stopline },
1809
1842
{&default_stopline_ip, &intersection_stoplines_temp.default_stopline },
1810
1843
{&first_attention_stopline_ip, &intersection_stoplines_temp.first_attention_stopline },
1844
+ {&second_attention_stopline_ip, &intersection_stoplines_temp.second_attention_stopline },
1811
1845
{&occlusion_peeking_line_ip, &intersection_stoplines_temp.occlusion_peeking_stopline },
1812
- {&pass_judge_line_ip, &intersection_stoplines_temp.pass_judge_line },
1846
+ {&first_pass_judge_line_ip, &intersection_stoplines_temp.first_pass_judge_line },
1847
+ {&second_pass_judge_line_ip, &intersection_stoplines_temp.second_pass_judge_line },
1813
1848
{&occlusion_wo_tl_pass_judge_line_ip,
1814
1849
&intersection_stoplines_temp.occlusion_wo_tl_pass_judge_line }};
1815
1850
stoplines.sort (
@@ -1843,11 +1878,17 @@ std::optional<IntersectionStopLines> IntersectionModule::generateIntersectionSto
1843
1878
intersection_stoplines.first_attention_stopline =
1844
1879
intersection_stoplines_temp.first_attention_stopline ;
1845
1880
}
1881
+ if (second_attention_stopline_valid) {
1882
+ intersection_stoplines.second_attention_stopline =
1883
+ intersection_stoplines_temp.second_attention_stopline ;
1884
+ }
1846
1885
if (occlusion_peeking_line_valid) {
1847
1886
intersection_stoplines.occlusion_peeking_stopline =
1848
1887
intersection_stoplines_temp.occlusion_peeking_stopline ;
1849
1888
}
1850
- intersection_stoplines.pass_judge_line = intersection_stoplines_temp.pass_judge_line ;
1889
+ intersection_stoplines.first_pass_judge_line = intersection_stoplines_temp.first_pass_judge_line ;
1890
+ intersection_stoplines.second_pass_judge_line =
1891
+ intersection_stoplines_temp.second_pass_judge_line ;
1851
1892
intersection_stoplines.occlusion_wo_tl_pass_judge_line =
1852
1893
intersection_stoplines_temp.occlusion_wo_tl_pass_judge_line ;
1853
1894
return intersection_stoplines;
@@ -3252,7 +3293,8 @@ getFirstPointInsidePolygonsByFootprint(
3252
3293
3253
3294
void IntersectionLanelets::update (
3254
3295
const bool is_prioritized, const util::InterpolatedPathInfo & interpolated_path_info,
3255
- const tier4_autoware_utils::LinearRing2d & footprint, const double vehicle_length)
3296
+ const tier4_autoware_utils::LinearRing2d & footprint, const double vehicle_length,
3297
+ lanelet::routing::RoutingGraphPtr routing_graph_ptr)
3256
3298
{
3257
3299
is_prioritized_ = is_prioritized;
3258
3300
// find the first conflicting/detection area polygon intersecting the path
@@ -3265,13 +3307,44 @@ void IntersectionLanelets::update(
3265
3307
}
3266
3308
}
3267
3309
if (!first_attention_area_) {
3268
- auto first = getFirstPointInsidePolygonsByFootprint (
3310
+ const auto first = getFirstPointInsidePolygonsByFootprint (
3269
3311
attention_non_preceding_area_, interpolated_path_info, footprint, vehicle_length);
3270
3312
if (first) {
3271
3313
first_attention_lane_ = attention_non_preceding_.at (first.value ().second );
3272
3314
first_attention_area_ = attention_non_preceding_area_.at (first.value ().second );
3273
3315
}
3274
3316
}
3317
+ if (first_attention_lane_ && !second_attention_lane_ && !second_attention_lane_empty_) {
3318
+ const auto first_attention_lane = first_attention_lane_.value ();
3319
+ // remove first_attention_area_ and non-straight lanelets from attention_non_preceding
3320
+ lanelet::ConstLanelets attention_non_preceding_ex_first;
3321
+ lanelet::ConstLanelets sibling_first_attention_lanelets;
3322
+ for (const auto & previous : routing_graph_ptr->previous (first_attention_lane)) {
3323
+ for (const auto & following : routing_graph_ptr->following (previous)) {
3324
+ sibling_first_attention_lanelets.push_back (following);
3325
+ }
3326
+ }
3327
+ for (const auto & ll : attention_non_preceding_) {
3328
+ // the sibling lanelets of first_attention_lanelet are ruled out
3329
+ if (lanelet::utils::contains (sibling_first_attention_lanelets, ll)) {
3330
+ continue ;
3331
+ }
3332
+ if (std::string (ll.attributeOr (" turn_direction" , " else" )).compare (" straight" ) == 0 ) {
3333
+ attention_non_preceding_ex_first.push_back (ll);
3334
+ }
3335
+ }
3336
+ if (attention_non_preceding_ex_first.empty ()) {
3337
+ second_attention_lane_empty_ = true ;
3338
+ }
3339
+ const auto attention_non_preceding_ex_first_area =
3340
+ getPolygon3dFromLanelets (attention_non_preceding_ex_first);
3341
+ const auto second = getFirstPointInsidePolygonsByFootprint (
3342
+ attention_non_preceding_ex_first_area, interpolated_path_info, footprint, vehicle_length);
3343
+ if (second) {
3344
+ second_attention_lane_ = attention_non_preceding_ex_first.at (second.value ().second );
3345
+ second_attention_area_ = second_attention_lane_.value ().polygon3d ();
3346
+ }
3347
+ }
3275
3348
}
3276
3349
3277
3350
void TargetObject::calc_dist_to_stopline ()
0 commit comments