@@ -113,11 +113,6 @@ bool RunOutModule::modifyPathVelocity(
113
113
insertStoppingVelocity (dynamic_obstacle, current_pose, current_vel, current_acc, *path);
114
114
}
115
115
116
- // apply max jerk limit if the ego can't stop with specified max jerk and acc
117
- if (planner_param_.slow_down_limit .enable ) {
118
- applyMaxJerkLimit (current_pose, current_vel, current_acc, *path);
119
- }
120
-
121
116
publishDebugValue (
122
117
trim_smoothed_path, partition_excluded_obstacles, dynamic_obstacle, current_pose);
123
118
@@ -585,7 +580,8 @@ boost::optional<geometry_msgs::msg::Pose> RunOutModule::calcStopPoint(
585
580
586
581
void RunOutModule::insertStopPoint (
587
582
const boost::optional<geometry_msgs::msg::Pose> stop_point,
588
- autoware_auto_planning_msgs::msg::PathWithLaneId & path)
583
+ autoware_auto_planning_msgs::msg::PathWithLaneId & path,
584
+ const geometry_msgs::msg::Pose & current_pose, const float current_vel, const float current_acc)
589
585
{
590
586
// no stop point
591
587
if (!stop_point) {
@@ -610,7 +606,14 @@ void RunOutModule::insertStopPoint(
610
606
stop_point_with_lane_id = path.points .at (nearest_seg_idx);
611
607
stop_point_with_lane_id.point .pose = *stop_point;
612
608
613
- planning_utils::insertVelocity (path, stop_point_with_lane_id, 0.0 , insert_idx);
609
+ double stop_point_velocity = 0.0 ;
610
+ // apply max jerk limit if the ego can't stop with specified max jerk and acc
611
+ if (planner_param_.slow_down_limit .enable ) {
612
+ stop_point_velocity =
613
+ calcMaxJerkLimitedVelocity (current_pose, current_vel, current_acc, path, *stop_point);
614
+ }
615
+
616
+ planning_utils::insertVelocity (path, stop_point_with_lane_id, stop_point_velocity, insert_idx);
614
617
}
615
618
616
619
void RunOutModule::insertVelocityForState (
@@ -679,7 +682,7 @@ void RunOutModule::insertStoppingVelocity(
679
682
{
680
683
const auto stop_point =
681
684
calcStopPoint (dynamic_obstacle, output_path, current_pose, current_vel, current_acc);
682
- insertStopPoint (stop_point, output_path);
685
+ insertStopPoint (stop_point, output_path, current_pose, current_vel, current_acc );
683
686
}
684
687
685
688
void RunOutModule::insertApproachingVelocity (
@@ -719,26 +722,19 @@ void RunOutModule::insertApproachingVelocity(
719
722
planning_utils::insertVelocity (output_path, stop_point_with_lane_id, 0.0 , insert_idx_stop);
720
723
}
721
724
722
- void RunOutModule::applyMaxJerkLimit (
725
+ double RunOutModule::calcMaxJerkLimitedVelocity (
723
726
const geometry_msgs::msg::Pose & current_pose, const float current_vel, const float current_acc,
724
- PathWithLaneId & path) const
727
+ PathWithLaneId & path, const geometry_msgs::msg::Pose & stop_point ) const
725
728
{
726
- const auto stop_point_idx = run_out_utils::findFirstStopPointIdx (path.points );
727
- if (!stop_point_idx) {
728
- return ;
729
- }
730
-
731
- const auto stop_point = path.points .at (stop_point_idx.get ()).point .pose .position ;
732
729
const auto dist_to_stop_point =
733
- motion_utils::calcSignedArcLength (path.points , current_pose.position , stop_point);
730
+ motion_utils::calcSignedArcLength (path.points , current_pose.position , stop_point. position );
734
731
735
732
// calculate desired velocity with limited jerk
736
733
const auto jerk_limited_vel = planning_utils::calcDecelerationVelocityFromDistanceToTarget (
737
734
planner_param_.slow_down_limit .max_jerk , planner_param_.slow_down_limit .max_acc , current_acc,
738
735
current_vel, dist_to_stop_point);
739
736
740
- // overwrite velocity with limited velocity
741
- run_out_utils::insertPathVelocityFromIndex (stop_point_idx.get (), jerk_limited_vel, path.points );
737
+ return jerk_limited_vel;
742
738
}
743
739
744
740
std::vector<DynamicObstacle> RunOutModule::excludeObstaclesOutSideOfPartition (
0 commit comments