Skip to content

Commit

Permalink
fix(run_out): do not insert stop point when stopped in Object method (a…
Browse files Browse the repository at this point in the history
…utowarefoundation#5911)

Signed-off-by: Tomohito Ando <[email protected]>
  • Loading branch information
TomohitoAndo authored and karishma1911 committed May 26, 2024
1 parent da7ecfc commit 7def1b2
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions planning/behavior_velocity_run_out_module/src/scene.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -615,16 +615,25 @@ std::optional<geometry_msgs::msg::Pose> RunOutModule::calcStopPoint(
// vehicle have to decelerate if there is not enough distance with deceleration_jerk
const bool deceleration_needed =
*stop_dist > dist_to_collision - planner_param_.run_out.stop_margin;
// avoid acceleration when ego is decelerating
// TODO(Tomohito Ando): replace with more appropriate method
constexpr float epsilon = 1.0e-2;
constexpr float stopping_vel_mps = 2.5 / 3.6;
const bool is_stopping = current_vel < stopping_vel_mps && current_acc < epsilon;
if (!deceleration_needed && !is_stopping) {
const auto & detection_method = planner_param_.run_out.detection_method;

if (!deceleration_needed && detection_method == "Object") {
debug_ptr_->setAccelReason(RunOutDebug::AccelReason::LOW_JERK);
return {};
}

// If the detection method assumes running out, avoid acceleration when the ego is decelerating.
// TODO(Tomohito Ando): replace with more appropriate way
if (!deceleration_needed && detection_method != "Object") {
constexpr float epsilon = 1.0e-2;
constexpr float stopping_vel_mps = 2.5 / 3.6;
const bool is_stopping = current_vel < stopping_vel_mps && current_acc < epsilon;
if (!is_stopping) {
debug_ptr_->setAccelReason(RunOutDebug::AccelReason::LOW_JERK);
return {};
}
}

// calculate the stop point for base link
const float base_to_collision_point =
planner_param_.run_out.stop_margin + planner_param_.vehicle_param.base_to_front;
Expand Down

0 comments on commit 7def1b2

Please sign in to comment.