@@ -890,15 +890,19 @@ double ObstacleStopModule::calc_desired_stop_margin(
890
890
const double dist_to_collide_on_ref_traj)
891
891
{
892
892
// calculate default stop margin
893
- const double default_stop_margin = [&]() {
894
- const auto ref_traj_length =
895
- autoware::motion_utils::calcSignedArcLength (traj_points, 0 , traj_points.size () - 1 );
896
- if (dist_to_collide_on_ref_traj > ref_traj_length) {
897
- // Use terminal margin (terminal_stop_margin) for obstacle stop
898
- return stop_planning_param_.terminal_stop_margin ;
899
- }
900
- return stop_planning_param_.stop_margin ;
901
- }() + (stop_obstacle.velocity < 0.0 ) ? stop_planning_param_.stop_margin_opposing_traffic : 0.0 ;
893
+ const double default_stop_margin =
894
+ [&]() {
895
+ const auto ref_traj_length =
896
+ autoware::motion_utils::calcSignedArcLength (traj_points, 0 , traj_points.size () - 1 );
897
+ if (dist_to_collide_on_ref_traj > ref_traj_length) {
898
+ // Use terminal margin (terminal_stop_margin) for obstacle stop
899
+ return stop_planning_param_.terminal_stop_margin ;
900
+ }
901
+ return stop_planning_param_.stop_margin ;
902
+ }() +
903
+ (stop_obstacle.velocity < 0.0 )
904
+ ? stop_planning_param_.stop_margin_opposing_traffic
905
+ : 0.0 ;
902
906
903
907
// calculate stop margin on curve
904
908
const double stop_margin_on_curve = calc_margin_from_obstacle_on_curve (
@@ -915,10 +919,12 @@ double ObstacleStopModule::calc_desired_stop_margin(
915
919
const double stop_dist_diff =
916
920
closest_behavior_stop_dist_on_ref_traj - (dist_to_collide_on_ref_traj - stop_margin_on_curve);
917
921
if (0.0 < stop_dist_diff && stop_dist_diff < stop_margin_on_curve) {
918
- return stop_planning_param_.min_behavior_stop_margin + (stop_obstacle.velocity < 0.0 ) ? stop_planning_param_.stop_margin_opposing_traffic ;
922
+ return stop_planning_param_.min_behavior_stop_margin + (stop_obstacle.velocity < 0.0 )
923
+ ? stop_planning_param_.stop_margin_opposing_traffic ;
919
924
}
920
925
}
921
- return stop_margin_on_curve + (stop_obstacle.velocity < 0.0 ) ? stop_planning_param_.stop_margin_opposing_traffic ;
926
+ return stop_margin_on_curve + (stop_obstacle.velocity < 0.0 )
927
+ ? stop_planning_param_.stop_margin_opposing_traffic ;
922
928
}
923
929
924
930
std::optional<double > ObstacleStopModule::calc_candidate_zero_vel_dist (
0 commit comments