Skip to content

Commit 12e8d0a

Browse files
fix behavior_path_planner state
fix incorrect comments Signed-off-by: Yuki Takagi <yuki.takagi@tier4.jp>
1 parent 58695bd commit 12e8d0a

File tree

2 files changed

+16
-16
lines changed
  • planning/behavior_path_dynamic_avoidance_module

2 files changed

+16
-16
lines changed

planning/behavior_path_dynamic_avoidance_module/include/behavior_path_dynamic_avoidance_module/scene.hpp

-2
Original file line numberDiff line numberDiff line change
@@ -345,8 +345,6 @@ class DynamicAvoidanceModule : public SceneModuleInterface
345345

346346
bool canTransitFailureState() override { return false; }
347347

348-
ModuleStatus setInitState() const override { return ModuleStatus::IDLE; }
349-
350348
bool isLabelTargetObstacle(const uint8_t label) const;
351349
void updateTargetObjects();
352350
LatFeasiblePaths generateLateralFeasiblePaths(

planning/behavior_path_dynamic_avoidance_module/src/scene.cpp

+16-14
Original file line numberDiff line numberDiff line change
@@ -1066,28 +1066,30 @@ MinMaxValue DynamicAvoidanceModule::calcMinMaxLongitudinalOffsetToAvoid(
10661066
// calculate bound start and end length
10671067
const double start_length_to_avoid = [&]() {
10681068
if (obj_vel < parameters_->max_stopped_object_vel) {
1069-
// The ego and object are the same directional or the object is parked.
1069+
// The ego and object are the opposite directional or the object is parked.
10701070
return std::min(time_while_collision.time_to_start_collision, 8.0) * std::abs(obj_vel) +
10711071
std::abs(relative_velocity) * parameters_->start_duration_to_avoid_oncoming_object;
1072+
} else {
1073+
// The ego and object are the same directional
1074+
const double obj_acc = -0.5;
1075+
const double decel_time = 1.0;
1076+
const double obj_moving_dist =
1077+
(std::pow(std::max(obj_vel + obj_acc * decel_time, 0.0), 2) - std::pow(obj_vel, 2)) / 2 /
1078+
obj_acc;
1079+
const double ego_moving_dist = getEgoSpeed() * decel_time;
1080+
return std::max(0.0, ego_moving_dist - obj_moving_dist) +
1081+
std::abs(relative_velocity) * parameters_->start_duration_to_avoid_overtaking_object;
10721082
}
1073-
// The ego and object are the opposite directional.
1074-
const double obj_acc = -0.5;
1075-
const double decel_time = 1.0;
1076-
const double obj_moving_dist =
1077-
(std::pow(std::max(obj_vel + obj_acc * decel_time, 0.0), 2) - std::pow(obj_vel, 2)) / 2 /
1078-
obj_acc;
1079-
const double ego_moving_dist = getEgoSpeed() * decel_time;
1080-
return std::max(0.0, ego_moving_dist - obj_moving_dist) +
1081-
std::abs(relative_velocity) * parameters_->start_duration_to_avoid_overtaking_object;
10821083
}();
10831084
const double end_length_to_avoid = [&]() {
10841085
if (obj_vel < parameters_->max_stopped_object_vel) {
1085-
// The ego and object are the same directional or the object is parked.
1086+
// The ego and object are the opposite directional or the object is parked.
10861087
return std::abs(relative_velocity) * parameters_->end_duration_to_avoid_oncoming_object;
1088+
} else {
1089+
// The ego and object are the same directional
1090+
return std::min(time_while_collision.time_to_end_collision, 3.0) * obj_vel +
1091+
std::abs(relative_velocity) * parameters_->end_duration_to_avoid_overtaking_object;
10871092
}
1088-
// The ego and object are the opposite directional.
1089-
return std::min(time_while_collision.time_to_end_collision, 3.0) * obj_vel +
1090-
std::abs(relative_velocity) * parameters_->end_duration_to_avoid_overtaking_object;
10911093
}();
10921094

10931095
// calculate valid path for the forked object's path from the ego's path

0 commit comments

Comments
 (0)