-
Notifications
You must be signed in to change notification settings - Fork 668
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(trajectory_follower_nodes): mpc_follower does not send proper converged data under low steering rate limit #2454
Conversation
@kosuke55 Sorry to bother you, would you try this? Do you think this implementation can solve our problem? |
m_current_trajectory_ptr->points.at(static_cast<size_t>(nearest)).longitudinal_velocity_mps; | ||
|
||
const auto latest_published_cmd = m_ctrl_cmd_prev; // use prev_cmd as a latest published command | ||
if (m_keep_steer_control_until_converged && !isSteerConverged(latest_published_cmd)) { |
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.
It's better to select to whether to control steer when stopping.
m_keep_steer_control_until_converged
is the option, and we would like to keep it.
@@ -31,6 +31,7 @@ struct LateralSyncData | |||
struct LongitudinalSyncData | |||
{ | |||
bool is_velocity_converged{false}; | |||
int state_of_longitudinal_controller{2}; |
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.
It's ok for draft, but we want change to use
enum class ControlState { DRIVE = 0, STOPPING, STOPPED, EMERGENCY };
and move it to longitudinal_contrller_base
https://github.com/autowarefoundation/autoware.universe/blob/main/control/trajectory_follower/include/trajectory_follower/pid_longitudinal_controller.hpp#L101-L111
@brkay54
In this part, I meant like
I thought it would be good to check the value of
Did you check the value of |
@brkay54 |
d8b3831
to
615d61c
Compare
Yes, if
I changed the structure, it does not send prev_cmd anymore when in stopped state. (Because we do not want to prev_cmd in stopped state, we need desired steering cmd.) If the vehicle in stopped state, it just resets the input buffer with prev_cmd, does not send any control command. After it resets the input buffer, it creates new control command. (Btw I changed the order in run() function, please also consider this.) |
3eda5b3
to
a5e6378
Compare
@kosuke55 Also this PR includes some structural changes of mpc_follower. |
@brkay54 |
@kosuke55 For example; Before re-initialize the vehicle: When re-initialize the vehicle in straight road -> if mpc can not solve -> lateral controller will create the previous control command which is 0.20. (it is near to actual steering so if mpc can solve -> Because the steering_angle_rate_lim = 0.0872665 rad/sec (5.0 degree/sec), lateral_controller will create control command which is near to previous steering command such as 0.195 rad. (Again it is near to actual steering so My proposal is:
What do you mean when you said "it would create too many dependencies.". With my proposal, we can still make clear the buffers with same Stopped state. But we need to use the stopped state of longitudinal controller to make the steering_angle_rate constraint large because we need to be sure to vehicle wont move. Sorry for that, I do not have any rosbag, I am testing it in planning_simulator. You can reproduce the problem with setting the this param to lower value (I set it 5.0 degree/sec). |
@brkay54 cc @TakaHoribe @mitsudome-r
This seems good as a workaround. I think it would be better to have a bool parameter(like
(And since the root cause seems that mpc can not solve under the constraint, so we will attempt to investigate further and fix in another PR.)
This also seems good. And in case the difference is very small, it would be better to look at it for a few seconds for better performance. For example, instead of making a judgment based on a change of 0.20 -> 0.195 in one step, it is better to use 1-second difference and determine that it changes when the value changes 0.2 -> 0.1.
Sorry for my lack of explanation. And |
We had another call on this PR. In conclusion:
|
This pull request has been automatically marked as stale because it has not had recent activity. |
@brkay54 will update soon. |
7f9ef03
to
6dee49e
Compare
…verged data under low steering rate limit Signed-off-by: Berkay Karaman <brkay54@gmail.com>
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## main #2454 +/- ##
=======================================
Coverage 13.82% 13.82%
=======================================
Files 1395 1395
Lines 98036 98064 +28
Branches 29147 29163 +16
=======================================
+ Hits 13553 13562 +9
- Misses 69826 69838 +12
- Partials 14657 14664 +7
*This pull request uses carry forward flags. Click here to find out more.
☔ View full report in Codecov by Sentry. |
Signed-off-by: Berkay Karaman <brkay54@gmail.com>
@kosuke55 friendly ping to review. |
sorry to be late. I checked psim and tier4 internal scenario test (1326/1372->1329/1372), and it worked fine. |
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
I send launcher PR autowarefoundation/autoware_launch#378 |
@TakaHoribe |
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. @brkay54 Thank you!
Signed-off-by: Berkay Karaman brkay54@gmail.com
Description
Closes: #1543
In current Autoware.universe, mpc_follower sends is_steer_converged data "true" to longitudinal controller without reaching the desired steering angle value.
The problem is that when reinitialize the vehicle under low steering angle rate limit, solver can not solve the problem and sends the previous command to vehicle rather than the target value.
Like before reinitialize previous cmd = 30.0 degree,
After we reinitialize vehicle, previous_cmd still 30.0 degree but target_value is maybe 0.0 degree ideally but because steering_angle_rate_limit so small, mpc can not solve the problem and sends 30.0 degree again and vehicle starts moving (because before re initialization, current steering was near to 30.0 degree.)
To solve this, I set mpc's steering_rate_limit large as possible if the vehicle in stop state (otherwise it will be what we declared), so It send the (expected) target steering without steering_rate_limit constraint.
Also I changed the logic of the
isSteerConverged()
. Like @kosuke55 said here, mpc_follower will wait for the (prev_cmd == current_cmd) to be sure output will be the desired angle. Because mpc sends prev_cmd if mpc can not solve the problem, we are also checking is_mpc_calculated.Related links
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.