-
Notifications
You must be signed in to change notification settings - Fork 667
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): use common ego nearest search #1584
fix(motion_velocity_smoother): use common ego nearest search #1584
Conversation
I confirmed this PR works well |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@takayuki5168
Please fix the following function.
autoware.universe/planning/behavior_velocity_planner/include/utilization/trajectory_utils.hpp
Lines 129 to 171 in 7748688
inline bool smoothPath( | |
const PathWithLaneId & in_path, PathWithLaneId & out_path, | |
const std::shared_ptr<const PlannerData> & planner_data) | |
{ | |
using motion_utils::findNearestIndex; | |
const geometry_msgs::msg::Pose current_pose = planner_data->current_pose.pose; | |
const double v0 = planner_data->current_velocity->twist.linear.x; | |
const double a0 = planner_data->current_accel.get(); | |
const auto & external_v_limit = planner_data->external_velocity_limit; | |
const auto & smoother = planner_data->velocity_smoother_; | |
const double max = std::numeric_limits<double>::max(); | |
auto trajectory = convertPathToTrajectoryPoints(in_path); | |
if (external_v_limit) { | |
motion_velocity_smoother::trajectory_utils::applyMaximumVelocityLimit( | |
0, trajectory.size(), external_v_limit->max_velocity, trajectory); | |
} | |
const auto traj_lateral_acc_filtered = smoother->applyLateralAccelerationFilter(trajectory); | |
// Resample trajectory with ego-velocity based interval distances | |
auto traj_resampled = smoother->resampleTrajectory( | |
*traj_lateral_acc_filtered, v0, current_pose, std::numeric_limits<double>::max()); | |
const auto traj_resampled_closest = findNearestIndex(*traj_resampled, current_pose, max, M_PI_4); | |
if (!traj_resampled_closest) { | |
return false; | |
} | |
std::vector<TrajectoryPoints> debug_trajectories; | |
// Clip trajectory from closest point | |
TrajectoryPoints clipped; | |
TrajectoryPoints traj_smoothed; | |
clipped.insert( | |
clipped.end(), traj_resampled->begin() + *traj_resampled_closest, traj_resampled->end()); | |
if (!smoother->apply(v0, a0, clipped, traj_smoothed, debug_trajectories)) { | |
std::cerr << "[behavior_velocity][trajectory_utils]: failed to smooth" << std::endl; | |
return false; | |
} | |
traj_smoothed.insert( | |
traj_smoothed.begin(), traj_resampled->begin(), | |
traj_resampled->begin() + *traj_resampled_closest); | |
out_path = convertTrajectoryPointsToPath(traj_smoothed); | |
return true; | |
} |
Codecov Report
@@ Coverage Diff @@
## main #1584 +/- ##
==========================================
- Coverage 10.25% 10.14% -0.12%
==========================================
Files 1204 1204
Lines 86787 88388 +1601
Branches 20063 20959 +896
==========================================
+ Hits 8904 8969 +65
- Misses 68613 70015 +1402
- Partials 9270 9404 +134
*This pull request uses carry forward flags. Click here to find out more.
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
@rej55 |
I'm thinking to create another PR for behavior velocity planner. |
Signed-off-by: Takayuki Murooka <takayuki5168@gmail.com>
Signed-off-by: Takayuki Murooka <takayuki5168@gmail.com>
3646ce3
to
edb5e2d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
) * fix(motion_velocity_smoother): use common ego nearest search Signed-off-by: Takayuki Murooka <takayuki5168@gmail.com> * fix Signed-off-by: Takayuki Murooka <takayuki5168@gmail.com> * fix build error and modify launch Signed-off-by: Takayuki Murooka <takayuki5168@gmail.com> * fix Signed-off-by: Takayuki Murooka <takayuki5168@gmail.com> Signed-off-by: Takayuki Murooka <takayuki5168@gmail.com>
) * fix(motion_velocity_smoother): use common ego nearest search Signed-off-by: Takayuki Murooka <takayuki5168@gmail.com> * fix Signed-off-by: Takayuki Murooka <takayuki5168@gmail.com> * fix build error and modify launch Signed-off-by: Takayuki Murooka <takayuki5168@gmail.com> * fix Signed-off-by: Takayuki Murooka <takayuki5168@gmail.com> Signed-off-by: Takayuki Murooka <takayuki5168@gmail.com>
) * fix(motion_velocity_smoother): use common ego nearest search Signed-off-by: Takayuki Murooka <takayuki5168@gmail.com> * fix Signed-off-by: Takayuki Murooka <takayuki5168@gmail.com> * fix build error and modify launch Signed-off-by: Takayuki Murooka <takayuki5168@gmail.com> * fix Signed-off-by: Takayuki Murooka <takayuki5168@gmail.com> Signed-off-by: Takayuki Murooka <takayuki5168@gmail.com>
…efoundation#1584) * fix(motion_velocity_smoother): use common ego nearest search Signed-off-by: Takayuki Murooka <takayuki5168@gmail.com> * fix Signed-off-by: Takayuki Murooka <takayuki5168@gmail.com> * fix build error and modify launch Signed-off-by: Takayuki Murooka <takayuki5168@gmail.com> * fix Signed-off-by: Takayuki Murooka <takayuki5168@gmail.com> Signed-off-by: Takayuki Murooka <takayuki5168@gmail.com>
) * fix(motion_velocity_smoother): use common ego nearest search Signed-off-by: Takayuki Murooka <takayuki5168@gmail.com> * fix Signed-off-by: Takayuki Murooka <takayuki5168@gmail.com> * fix build error and modify launch Signed-off-by: Takayuki Murooka <takayuki5168@gmail.com> * fix Signed-off-by: Takayuki Murooka <takayuki5168@gmail.com> Signed-off-by: Takayuki Murooka <takayuki5168@gmail.com>
…rce_acceleration_and_slow feat(motion_velocity_smoother): cherry pick force acceleration and slow driving
Signed-off-by: Takayuki Murooka takayuki5168@gmail.com
Description
use the new nearest index search algorithm in motion velocity smoother to deal with edge cases shown in the issue.
Related links
issue
#1581
depends on
#1582
tier4/autoware_launch#437
Tests performed
Notes for reviewers
Pre-review checklist for the PR author
The PR author must check the checkboxes below when creating the PR.
In-review checklist for the PR reviewers
The PR reviewers must check the checkboxes below before approval.
Post-review checklist for the PR author
The PR author must check the checkboxes below before merging.
After all checkboxes are checked, anyone who has write access can merge the PR.