Skip to content

Commit 3c84a57

Browse files
authored
fix(behavior_velocity_run_out_module): fix slow_down jerk filter (autowarefoundation#10065)
Signed-off-by: tomoya.kimura <[email protected]>
1 parent 4823597 commit 3c84a57

File tree

2 files changed

+19
-23
lines changed
  • planning/behavior_velocity_planner/autoware_behavior_velocity_run_out_module/src

2 files changed

+19
-23
lines changed

planning/behavior_velocity_planner/autoware_behavior_velocity_run_out_module/src/scene.cpp

+15-20
Original file line numberDiff line numberDiff line change
@@ -183,11 +183,6 @@ bool RunOutModule::modifyPathVelocity(PathWithLaneId * path)
183183
}
184184
}
185185

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-
191186
publishDebugValue(extended_smoothed_path, filtered_obstacles, dynamic_obstacle, current_pose);
192187

193188
// record time for collision check
@@ -745,7 +740,7 @@ std::optional<geometry_msgs::msg::Pose> RunOutModule::calcStopPoint(
745740

746741
bool RunOutModule::insertStopPoint(
747742
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)
749744
{
750745
// no stop point
751746
if (!stop_point) {
@@ -769,7 +764,7 @@ bool RunOutModule::insertStopPoint(
769764
autoware_internal_planning_msgs::msg::PathPointWithLaneId stop_point_with_lane_id;
770765
stop_point_with_lane_id = path.points.at(nearest_seg_idx);
771766
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);
773768

774769
planning_factor_interface_->add(
775770
path.points, planner_data_->current_odometry->pose, stop_point.value(), stop_point.value(),
@@ -855,7 +850,14 @@ bool RunOutModule::insertStoppingVelocity(
855850
{
856851
stopping_point =
857852
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);
859861
}
860862

861863
void RunOutModule::insertApproachingVelocity(
@@ -901,26 +903,19 @@ void RunOutModule::insertApproachingVelocity(
901903
planning_utils::insertVelocity(output_path, stop_point_with_lane_id, 0.0, insert_idx_stop);
902904
}
903905

904-
void RunOutModule::applyMaxJerkLimit(
906+
double RunOutModule::calcMaxJerkLimitedVelocity(
905907
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
907909
{
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);
916912

917913
// calculate desired velocity with limited jerk
918914
const auto jerk_limited_vel = planning_utils::calcDecelerationVelocityFromDistanceToTarget(
919915
planner_param_.slow_down_limit.max_jerk, planner_param_.slow_down_limit.max_acc, current_acc,
920916
current_vel, dist_to_stop_point);
921917

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;
924919
}
925920

926921
std::vector<DynamicObstacle> RunOutModule::excludeObstaclesCrossingEgoCutLine(

planning/behavior_velocity_planner/autoware_behavior_velocity_run_out_module/src/scene.hpp

+4-3
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,8 @@ class RunOutModule : public SceneModuleInterface
127127

128128
bool insertStopPoint(
129129
const std::optional<geometry_msgs::msg::Pose> stop_point,
130-
autoware_internal_planning_msgs::msg::PathWithLaneId & path);
130+
autoware_internal_planning_msgs::msg::PathWithLaneId & path,
131+
const double stop_point_velocity = 0.0);
131132

132133
void insertVelocityForState(
133134
const std::optional<DynamicObstacle> & dynamic_obstacle, const PlannerData planner_data,
@@ -148,9 +149,9 @@ class RunOutModule : public SceneModuleInterface
148149
const DynamicObstacle & dynamic_obstacle, const geometry_msgs::msg::Pose & current_pose,
149150
const float approaching_vel, const float approach_margin, PathWithLaneId & output_path);
150151

151-
void applyMaxJerkLimit(
152+
double calcMaxJerkLimitedVelocity(
152153
const geometry_msgs::msg::Pose & current_pose, const float current_vel, const float current_acc,
153-
PathWithLaneId & path) const;
154+
PathWithLaneId & path, const geometry_msgs::msg::Pose & stop_point) const;
154155

155156
/**
156157
* @brief Creates a virtual line segment that is perpendicular to the ego vehicle and that passes

0 commit comments

Comments
 (0)