Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(motion_velocity_smoother): fix overwriteStopPoint using backward point #816

Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
fix(motion_velocity_smoother): fix overwriteStopPoint using backward …
…point

Signed-off-by: kosuke55 <kosuke.tnp@gmail.com>
  • Loading branch information
kosuke55 committed Apr 27, 2022
commit a5531a59f6cca7759a3f0627e3d954ca9b5cee6d
Original file line number Diff line number Diff line change
Expand Up @@ -714,14 +714,23 @@ MotionVelocitySmootherNode::calcInitialMotion(
void MotionVelocitySmootherNode::overwriteStopPoint(
const TrajectoryPoints & input, TrajectoryPoints & output) const
{
const auto stop_idx = tier4_autoware_utils::searchZeroVelocityIndex(input);
if (!stop_idx) {
// Search 0 velocity point after the previous point of the closest point of ego
const auto closest_idx = tier4_autoware_utils::findNearestIndex(
input, current_pose_ptr_->pose, std::numeric_limits<double>::max(),
node_param_.delta_yaw_threshold);
if (!closest_idx || *closest_idx == 0) {
return;
}
TrajectoryPoints points_after_ego{input.begin() + *closest_idx - 1, input.end()};
const auto stop_idx_after_ego = tier4_autoware_utils::searchZeroVelocityIndex(points_after_ego);
if (!stop_idx_after_ego) {
return;
}
const auto stop_idx = *stop_idx_after_ego + *closest_idx - 1;

// Get Closest Point from Output
const auto nearest_output_point_idx = tier4_autoware_utils::findNearestIndex(
output, input.at(*stop_idx).pose, std::numeric_limits<double>::max(),
output, input.at(stop_idx).pose, std::numeric_limits<double>::max(),
node_param_.delta_yaw_threshold);

// check over velocity
Expand Down