@@ -183,11 +183,6 @@ bool RunOutModule::modifyPathVelocity(PathWithLaneId * path)
183
183
}
184
184
}
185
185
186
- // apply max jerk limit if the ego can't stop with specified max jerk and acc
187
- if (planner_param_.slow_down_limit .enable ) {
188
- applyMaxJerkLimit (current_pose, current_vel, current_acc, *path);
189
- }
190
-
191
186
publishDebugValue (extended_smoothed_path, filtered_obstacles, dynamic_obstacle, current_pose);
192
187
193
188
// record time for collision check
@@ -745,7 +740,7 @@ std::optional<geometry_msgs::msg::Pose> RunOutModule::calcStopPoint(
745
740
746
741
bool RunOutModule::insertStopPoint (
747
742
const std::optional<geometry_msgs::msg::Pose> stop_point,
748
- autoware_internal_planning_msgs::msg::PathWithLaneId & path)
743
+ autoware_internal_planning_msgs::msg::PathWithLaneId & path, const double stop_point_velocity )
749
744
{
750
745
// no stop point
751
746
if (!stop_point) {
@@ -769,7 +764,7 @@ bool RunOutModule::insertStopPoint(
769
764
autoware_internal_planning_msgs::msg::PathPointWithLaneId stop_point_with_lane_id;
770
765
stop_point_with_lane_id = path.points .at (nearest_seg_idx);
771
766
stop_point_with_lane_id.point .pose = *stop_point;
772
- planning_utils::insertVelocity (path, stop_point_with_lane_id, 0.0 , insert_idx);
767
+ planning_utils::insertVelocity (path, stop_point_with_lane_id, stop_point_velocity , insert_idx);
773
768
774
769
planning_factor_interface_->add (
775
770
path.points , planner_data_->current_odometry ->pose , stop_point.value (), stop_point.value (),
@@ -855,7 +850,14 @@ bool RunOutModule::insertStoppingVelocity(
855
850
{
856
851
stopping_point =
857
852
calcStopPoint (dynamic_obstacle, output_path, current_pose, current_vel, current_acc);
858
- return insertStopPoint (stopping_point, output_path);
853
+
854
+ // apply max jerk limit if the ego can't stop with specified max jerk and acc
855
+ double stop_point_velocity = 0.0 ;
856
+ if (planner_param_.slow_down_limit .enable ) {
857
+ stop_point_velocity = calcMaxJerkLimitedVelocity (
858
+ current_pose, current_vel, current_acc, output_path, *stopping_point);
859
+ }
860
+ return insertStopPoint (stopping_point, output_path, stop_point_velocity);
859
861
}
860
862
861
863
void RunOutModule::insertApproachingVelocity (
@@ -901,26 +903,19 @@ void RunOutModule::insertApproachingVelocity(
901
903
planning_utils::insertVelocity (output_path, stop_point_with_lane_id, 0.0 , insert_idx_stop);
902
904
}
903
905
904
- void RunOutModule::applyMaxJerkLimit (
906
+ double RunOutModule::calcMaxJerkLimitedVelocity (
905
907
const geometry_msgs::msg::Pose & current_pose, const float current_vel, const float current_acc,
906
- PathWithLaneId & path) const
908
+ PathWithLaneId & path, const geometry_msgs::msg::Pose & stop_point ) const
907
909
{
908
- const auto stop_point_idx = run_out_utils::findFirstStopPointIdx (path.points );
909
- if (!stop_point_idx) {
910
- return ;
911
- }
912
-
913
- const auto stop_point = path.points .at (stop_point_idx.value ()).point .pose .position ;
914
- const auto dist_to_stop_point =
915
- autoware::motion_utils::calcSignedArcLength (path.points , current_pose.position , stop_point);
910
+ const auto dist_to_stop_point = autoware::motion_utils::calcSignedArcLength (
911
+ path.points , current_pose.position , stop_point.position );
916
912
917
913
// calculate desired velocity with limited jerk
918
914
const auto jerk_limited_vel = planning_utils::calcDecelerationVelocityFromDistanceToTarget (
919
915
planner_param_.slow_down_limit .max_jerk , planner_param_.slow_down_limit .max_acc , current_acc,
920
916
current_vel, dist_to_stop_point);
921
917
922
- // overwrite velocity with limited velocity
923
- run_out_utils::insertPathVelocityFromIndex (stop_point_idx.value (), jerk_limited_vel, path.points );
918
+ return jerk_limited_vel;
924
919
}
925
920
926
921
std::vector<DynamicObstacle> RunOutModule::excludeObstaclesCrossingEgoCutLine (
0 commit comments