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(mpc): bilinear discretization #1567

Merged

Conversation

TakaHoribe
Copy link
Contributor

@TakaHoribe TakaHoribe commented Aug 10, 2022

Description

The bilinear discretization used in the MPC model needs to be fixed.

Related links

Tests performed

To see the accuracy of the model, steering rate information is visualized below.
The important lines are:

  • steering rate estimated in the model (red on the left plot)
  • steering rate measured by the sensor (green on the left plot)

These two plots should fit in the perfect model. (Although there is a time shift due to the delay compensation.) You can see that the current model is not good, and the bilinear one has the best fit.

Current Implementation
(Ad is bilinear, but Bd, Cd, Wd is Euler)
image

Euler
image

Bilinear (fixed)
image

Note: test site in simulation (kashiwanoha)
image

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.

  • The PR follows the pull request guidelines.
  • The PR has been properly tested.
  • The PR has been reviewed by the code owners.

Post-review checklist for the PR author

The PR author must check the checkboxes below before merging.

  • There are no open discussions or they are tracked via tickets.
  • The PR is ready for merge.

After all checkboxes are checked, anyone who has write access can merge the PR.

@TakaHoribe TakaHoribe requested review from tkimura4 and boyali August 10, 2022 13:12
@TakaHoribe
Copy link
Contributor Author

@boyali Would you please check this fix for the bilinear discretization?

@TakaHoribe TakaHoribe self-assigned this Aug 10, 2022
@codecov
Copy link

codecov bot commented Aug 10, 2022

Codecov Report

Base: 10.85% // Head: 10.85% // No change to project coverage 👍

Coverage data is based on head (15d0e83) compared to base (15d0e83).
Patch has no changes to coverable lines.

❗ Current head 15d0e83 differs from pull request most recent head f35af14. Consider uploading reports for the commit f35af14 to get more accurate results

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1567   +/-   ##
=======================================
  Coverage   10.85%   10.85%           
=======================================
  Files        1176     1176           
  Lines       77652    77652           
  Branches    19386    19386           
=======================================
  Hits         8432     8432           
  Misses      59978    59978           
  Partials     9242     9242           
Flag Coverage Δ
total 10.85% <0.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

a_d = inv * (I + dt * 0.5 * a_d);
c_d = c_d * inv;
b_d = inv * b_d * dt;
w_d = inv * w_d * dt;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know if you are using d_d. Even D = 0 in the continuous state space is not zero in the discrete version.

y(k) = Cx(k) + Du(k)

Here my implementation in the Autoware Control Toolbox.

auto const &&mat1_ATs = I - A_ * Ts / 2.;
auto const &&inv1_ATs = mat1_ATs.inverse();

Ad_ = inv1_ATs * (I + A_ * Ts / 2.);
Bd_ = inv1_ATs * B_ * Ts;
Cd_ = C_ * inv1_ATs;
Dd_ = D_ + C_ * Bd_ / 2.;

Dd = D + C inv(1 - Adt/2) Bdt/2

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the comment. I misunderstood. Since we can assume the system has a ZOH input, we don't need to convert the measurement equation.

@TakaHoribe TakaHoribe force-pushed the fix/mpc-bilinear-discretization branch 2 times, most recently from fa6282c to 7a5e992 Compare August 11, 2022 14:10
@TakaHoribe TakaHoribe added the component:control Vehicle control algorithms and mechanisms. (auto-assigned) label Aug 12, 2022
Copy link
Contributor

@tkimura4 tkimura4 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We tested it on a real vehicle and found no problems.

@TakaHoribe TakaHoribe enabled auto-merge (squash) September 21, 2022 06:52
Signed-off-by: Takamasa Horibe <horibe.takamasa@gmail.com>
Signed-off-by: Takamasa Horibe <horibe.takamasa@gmail.com>
Signed-off-by: Takamasa Horibe <horibe.takamasa@gmail.com>
@TakaHoribe TakaHoribe force-pushed the fix/mpc-bilinear-discretization branch from 7a5e992 to f35af14 Compare October 20, 2022 10:17
@TakaHoribe TakaHoribe merged commit f70cb22 into autowarefoundation:main Oct 20, 2022
@TakaHoribe TakaHoribe deleted the fix/mpc-bilinear-discretization branch October 20, 2022 10:48
mkuri added a commit to mkuri/autoware.universe that referenced this pull request Dec 6, 2022
saka1-s added a commit to technolojin/autoware.universe that referenced this pull request Oct 31, 2024
saka1-s added a commit to saka1-s/autoware.universe that referenced this pull request Nov 9, 2024
…n#1612)

* chore: fix dependency of mult object tracker (autowarefoundation#1567)

fix dependency of mult object tracker

* add relax logic

Signed-off-by: Yuki Takagi <yuki.takagi@tier4.jp>

* define params

Signed-off-by: Yuki Takagi <yuki.takagi@tier4.jp>

* add universe params

Signed-off-by: Yuki Takagi <yuki.takagi@tier4.jp>

* delete null line

Signed-off-by: Yuki Takagi <yuki.takagi@tier4.jp>

* fix spell

Signed-off-by: Yuki Takagi <yuki.takagi@tier4.jp>

* fix

Signed-off-by: Yuki Takagi <yuki.takagi@tier4.jp>

* change universe params

Signed-off-by: Yuki Takagi <yuki.takagi@tier4.jp>

---------

Signed-off-by: Yuki Takagi <yuki.takagi@tier4.jp>
Co-authored-by: Shohei Sakai <saka1s.jp@gmail.com>
saka1-s added a commit to saka1-s/autoware.universe that referenced this pull request Nov 9, 2024
…n#1612)

* chore: fix dependency of mult object tracker (autowarefoundation#1567)

fix dependency of mult object tracker

* add relax logic

Signed-off-by: Yuki Takagi <yuki.takagi@tier4.jp>

* define params

Signed-off-by: Yuki Takagi <yuki.takagi@tier4.jp>

* add universe params

Signed-off-by: Yuki Takagi <yuki.takagi@tier4.jp>

* delete null line

Signed-off-by: Yuki Takagi <yuki.takagi@tier4.jp>

* fix spell

Signed-off-by: Yuki Takagi <yuki.takagi@tier4.jp>

* fix

Signed-off-by: Yuki Takagi <yuki.takagi@tier4.jp>

* change universe params

Signed-off-by: Yuki Takagi <yuki.takagi@tier4.jp>

---------

Signed-off-by: Yuki Takagi <yuki.takagi@tier4.jp>
Co-authored-by: Shohei Sakai <saka1s.jp@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component:control Vehicle control algorithms and mechanisms. (auto-assigned)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants