Commit 161e23d 1 parent ca9e277 commit 161e23d Copy full SHA for 161e23d
File tree 3 files changed +38
-0
lines changed
planning/behavior_path_planner
include/behavior_path_planner/utils/avoidance
3 files changed +38
-0
lines changed Original file line number Diff line number Diff line change @@ -34,6 +34,8 @@ bool isTargetObjectType(
34
34
double calcShiftLength (
35
35
const bool & is_object_on_right, const double & overhang_dist, const double & avoid_margin);
36
36
37
+ bool isShiftNecessary (const bool & is_object_on_right, const double & shift_length);
38
+
37
39
bool isSameDirectionShift (const bool & is_object_on_right, const double & shift_length);
38
40
39
41
size_t findPathIndexFromArclength (
Original file line number Diff line number Diff line change @@ -3313,6 +3313,7 @@ void AvoidanceModule::updateDebugMarker(
3313
3313
add (createOtherObjectsMarkerArray (data.other_objects , AvoidanceDebugFactor::NOT_PARKING_OBJECT));
3314
3314
add (createOtherObjectsMarkerArray (data.other_objects , std::string (" MovingObject" )));
3315
3315
add (createOtherObjectsMarkerArray (data.other_objects , std::string (" OutOfTargetArea" )));
3316
+ add (createOtherObjectsMarkerArray (data.other_objects , std::string (" NotNeedAvoidance" )));
3316
3317
3317
3318
add (makeOverhangToRoadShoulderMarkerArray (data.target_objects , " overhang" ));
3318
3319
add (createOverhangFurthestLineStringMarkerArray (
Original file line number Diff line number Diff line change @@ -96,6 +96,32 @@ double calcShiftLength(
96
96
return std::fabs (shift_length) > 1e-3 ? shift_length : 0.0 ;
97
97
}
98
98
99
+ bool isShiftNecessary (const bool & is_object_on_right, const double & shift_length)
100
+ {
101
+ /* *
102
+ * ^
103
+ * |
104
+ * --+----x-------------------------------x--->
105
+ * | x x
106
+ * | ==obj==
107
+ */
108
+ if (is_object_on_right && shift_length < 0.0 ) {
109
+ return false ;
110
+ }
111
+
112
+ /* *
113
+ * ^ ==obj==
114
+ * | x x
115
+ * --+----x-------------------------------x--->
116
+ * |
117
+ */
118
+ if (!is_object_on_right && shift_length > 0.0 ) {
119
+ return false ;
120
+ }
121
+
122
+ return true ;
123
+ }
124
+
99
125
bool isSameDirectionShift (const bool & is_object_on_right, const double & shift_length)
100
126
{
101
127
return (is_object_on_right == std::signbit (shift_length));
@@ -683,6 +709,15 @@ void filterTargetObjects(
683
709
return std::min (max_allowable_lateral_distance, max_avoid_margin);
684
710
}();
685
711
712
+ if (!!avoid_margin) {
713
+ const auto shift_length = calcShiftLength (isOnRight (o), o.overhang_dist , avoid_margin.get ());
714
+ if (!isShiftNecessary (isOnRight (o), shift_length)) {
715
+ o.reason = " NotNeedAvoidance" ;
716
+ data.other_objects .push_back (o);
717
+ continue ;
718
+ }
719
+ }
720
+
686
721
// force avoidance for stopped vehicle
687
722
{
688
723
const auto to_traffic_light =
You can’t perform that action at this time.
0 commit comments