41
41
#include < string>
42
42
#include < tuple>
43
43
#include < utility>
44
+ #include < variant>
44
45
#include < vector>
45
46
46
47
namespace behavior_velocity_planner
@@ -166,16 +167,25 @@ class IntersectionModule : public SceneModuleInterface
166
167
} debug;
167
168
};
168
169
169
- enum OcclusionType {
170
- // ! occlusion is not detected
171
- NOT_OCCLUDED,
172
- // ! occlusion is not caused by dynamic objects
173
- STATICALLY_OCCLUDED,
174
- // ! occlusion is caused by dynamic objects
175
- DYNAMICALLY_OCCLUDED,
176
- // ! actual occlusion does not exist, only disapproved by RTC
177
- RTC_OCCLUDED,
170
+ // ! occlusion is not detected
171
+ struct NotOccluded
172
+ {
173
+ double best_clearance_distance{-1.0 };
174
+ };
175
+ // ! occlusion is not caused by dynamic objects
176
+ struct StaticallyOccluded
177
+ {
178
+ double best_clearance_distance{0.0 };
179
+ };
180
+ // ! occlusion is caused by dynamic objects
181
+ struct DynamicallyOccluded
182
+ {
183
+ double best_clearance_distance{0.0 };
178
184
};
185
+ // ! actual occlusion does not exist, only disapproved by RTC
186
+ using RTCOccluded = std::monostate;
187
+ using OcclusionType =
188
+ std::variant<NotOccluded, StaticallyOccluded, DynamicallyOccluded, RTCOccluded>;
179
189
180
190
struct DebugData
181
191
{
@@ -294,11 +304,9 @@ class IntersectionModule : public SceneModuleInterface
294
304
bool getOcclusionSafety () const { return occlusion_safety_; }
295
305
double getOcclusionDistance () const { return occlusion_stop_distance_; }
296
306
void setOcclusionActivation (const bool activation) { occlusion_activated_ = activation; }
297
- bool isOcclusionFirstStopRequired () { return occlusion_first_stop_required_; }
307
+ bool isOcclusionFirstStopRequired () const { return occlusion_first_stop_required_; }
298
308
299
309
private:
300
- rclcpp::Node & node_;
301
-
302
310
/* *
303
311
***********************************************************
304
312
***********************************************************
@@ -396,7 +404,7 @@ class IntersectionModule : public SceneModuleInterface
396
404
* @defgroup occlusion-variables [var] occlusion detection variables
397
405
* @{
398
406
*/
399
- OcclusionType prev_occlusion_status_;
407
+ OcclusionType prev_occlusion_status_{NotOccluded{}} ;
400
408
401
409
// ! debouncing for the first brief stop at the default stopline
402
410
StateMachine before_creep_state_machine_;
@@ -499,7 +507,7 @@ class IntersectionModule : public SceneModuleInterface
499
507
*/
500
508
std::optional<size_t > getStopLineIndexFromMap (
501
509
const intersection::InterpolatedPathInfo & interpolated_path_info,
502
- lanelet::ConstLanelet assigned_lanelet);
510
+ lanelet::ConstLanelet assigned_lanelet) const ;
503
511
504
512
/* *
505
513
* @brief generate IntersectionStopLines
@@ -510,15 +518,15 @@ class IntersectionModule : public SceneModuleInterface
510
518
const lanelet::ConstLanelet & first_attention_lane,
511
519
const std::optional<lanelet::CompoundPolygon3d> & second_attention_area_opt,
512
520
const intersection::InterpolatedPathInfo & interpolated_path_info,
513
- autoware_auto_planning_msgs::msg::PathWithLaneId * original_path);
521
+ autoware_auto_planning_msgs::msg::PathWithLaneId * original_path) const ;
514
522
515
523
/* *
516
524
* @brief generate IntersectionLanelets
517
525
*/
518
526
intersection::IntersectionLanelets generateObjectiveLanelets (
519
527
lanelet::LaneletMapConstPtr lanelet_map_ptr,
520
528
lanelet::routing::RoutingGraphPtr routing_graph_ptr,
521
- const lanelet::ConstLanelet assigned_lanelet);
529
+ const lanelet::ConstLanelet assigned_lanelet) const ;
522
530
523
531
/* *
524
532
* @brief generate PathLanelets
@@ -529,14 +537,15 @@ class IntersectionModule : public SceneModuleInterface
529
537
const lanelet::CompoundPolygon3d & first_conflicting_area,
530
538
const std::vector<lanelet::CompoundPolygon3d> & conflicting_areas,
531
539
const std::optional<lanelet::CompoundPolygon3d> & first_attention_area,
532
- const std::vector<lanelet::CompoundPolygon3d> & attention_areas, const size_t closest_idx);
540
+ const std::vector<lanelet::CompoundPolygon3d> & attention_areas,
541
+ const size_t closest_idx) const ;
533
542
534
543
/* *
535
544
* @brief generate discretized detection lane linestring.
536
545
*/
537
546
std::vector<lanelet::ConstLineString3d> generateDetectionLaneDivisions (
538
547
lanelet::ConstLanelets detection_lanelets,
539
- const lanelet::routing::RoutingGraphPtr routing_graph_ptr, const double resolution);
548
+ const lanelet::routing::RoutingGraphPtr routing_graph_ptr, const double resolution) const ;
540
549
/* * @} */
541
550
542
551
private:
@@ -636,7 +645,8 @@ class IntersectionModule : public SceneModuleInterface
636
645
* @attention this function has access to value() of intersection_lanelets_,
637
646
* intersection_lanelets.first_attention_area(), occlusion_attention_divisions_
638
647
*/
639
- OcclusionType detectOcclusion (const intersection::InterpolatedPathInfo & interpolated_path_info);
648
+ OcclusionType detectOcclusion (
649
+ const intersection::InterpolatedPathInfo & interpolated_path_info) const ;
640
650
/* * @} */
641
651
642
652
private:
@@ -699,7 +709,7 @@ class IntersectionModule : public SceneModuleInterface
699
709
*/
700
710
std::optional<intersection::NonOccludedCollisionStop> isGreenPseudoCollisionStatus (
701
711
const size_t closest_idx, const size_t collision_stopline_idx,
702
- const intersection::IntersectionStopLines & intersection_stoplines);
712
+ const intersection::IntersectionStopLines & intersection_stoplines) const ;
703
713
704
714
/* *
705
715
* @brief generate the message explaining why too_late_detect_objects/misjudge_objects exist and
@@ -731,7 +741,8 @@ class IntersectionModule : public SceneModuleInterface
731
741
* @brief return if collision is detected and the collision position
732
742
*/
733
743
CollisionStatus detectCollision (
734
- const bool is_over_1st_pass_judge_line, const std::optional<bool > is_over_2nd_pass_judge_line);
744
+ const bool is_over_1st_pass_judge_line,
745
+ const std::optional<bool > is_over_2nd_pass_judge_line) const ;
735
746
736
747
std::optional<size_t > checkAngleForTargetLanelets (
737
748
const geometry_msgs::msg::Pose & pose, const lanelet::ConstLanelets & target_lanelets,
@@ -747,7 +758,7 @@ class IntersectionModule : public SceneModuleInterface
747
758
TimeDistanceArray calcIntersectionPassingTime (
748
759
const autoware_auto_planning_msgs::msg::PathWithLaneId & path, const bool is_prioritized,
749
760
const intersection::IntersectionStopLines & intersection_stoplines,
750
- tier4_debug_msgs::msg::Float64MultiArrayStamped * debug_ttc_array);
761
+ tier4_debug_msgs::msg::Float64MultiArrayStamped * debug_ttc_array) const ;
751
762
/* * @} */
752
763
753
764
mutable DebugData debug_data_;
0 commit comments