Skip to content

Commit 6a3b605

Browse files
maxime-clemtakayuki5168
authored andcommitted
feat(crosswalk): add velocity factor when slowing down (autowarefoundation#6670)
Signed-off-by: Maxime CLEMENT <maxime.clement@tier4.jp> Co-authored-by: Takayuki Murooka <takayuki5168@gmail.com>
1 parent 8549d9f commit 6a3b605

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

planning/behavior_velocity_crosswalk_module/src/scene_crosswalk.cpp

+8
Original file line numberDiff line numberDiff line change
@@ -837,6 +837,7 @@ void CrosswalkModule::applySafetySlowDownSpeed(
837837

838838
const auto & ego_pos = planner_data_->current_odometry->pose.position;
839839
const auto ego_path = output;
840+
std::optional<Pose> slowdown_pose{std::nullopt};
840841

841842
if (!passed_safety_slow_point_) {
842843
// Safety slow down distance [m]
@@ -854,6 +855,8 @@ void CrosswalkModule::applySafetySlowDownSpeed(
854855

855856
if (p_safety_slow.has_value()) {
856857
insertDecelPointWithDebugInfo(p_safety_slow.value(), safety_slow_down_speed, output);
858+
slowdown_pose.emplace();
859+
slowdown_pose->position = p_safety_slow.value();
857860
}
858861

859862
if (safety_slow_point_range < 0.0) {
@@ -870,8 +873,13 @@ void CrosswalkModule::applySafetySlowDownSpeed(
870873
const float original_velocity = p.point.longitudinal_velocity_mps;
871874
p.point.longitudinal_velocity_mps = std::min(original_velocity, safety_slow_down_speed);
872875
}
876+
if (!output.points.empty()) slowdown_pose = output.points.front().point.pose;
873877
}
874878
}
879+
if (slowdown_pose)
880+
velocity_factor_.set(
881+
output.points, planner_data_->current_odometry->pose, *slowdown_pose,
882+
VelocityFactor::CROSSWALK);
875883
}
876884

877885
Polygon2d CrosswalkModule::getAttentionArea(

0 commit comments

Comments
 (0)