Skip to content

Commit be23154

Browse files
authored
feat(mission_planner): judge reroute safe when ego is stopped (autowarefoundation#5787)
Signed-off-by: kosuke55 <kosuke.tnp@gmail.com>
1 parent 9f89588 commit be23154

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

planning/mission_planner/src/mission_planner/mission_planner.cpp

+12-1
Original file line numberDiff line numberDiff line change
@@ -734,6 +734,13 @@ bool MissionPlanner::check_reroute_safety(
734734
return false;
735735
}
736736

737+
const auto current_velocity = odometry_->twist.twist.linear.x;
738+
739+
// if vehicle is stopped, do not check safety
740+
if (current_velocity < 0.01) {
741+
return true;
742+
}
743+
737744
auto hasSamePrimitives = [](
738745
const std::vector<LaneletPrimitive> & original_primitives,
739746
const std::vector<LaneletPrimitive> & target_primitives) {
@@ -878,13 +885,17 @@ bool MissionPlanner::check_reroute_safety(
878885
}
879886

880887
// check safety
881-
const auto current_velocity = odometry_->twist.twist.linear.x;
882888
const double safety_length =
883889
std::max(current_velocity * reroute_time_threshold_, minimum_reroute_length_);
884890
if (accumulated_length > safety_length) {
885891
return true;
886892
}
887893

894+
RCLCPP_WARN(
895+
get_logger(),
896+
"Length of lane where original and B target (= %f) is less than safety length (= %f), so "
897+
"reroute is not safe.",
898+
accumulated_length, safety_length);
888899
return false;
889900
}
890901
} // namespace mission_planner

0 commit comments

Comments
 (0)