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

feat(mpc_lateral_controller): signal a MRM when MPC fails. #7016

Merged
merged 13 commits into from
Jun 19, 2024

Conversation

HansOersted
Copy link
Contributor

@HansOersted HansOersted commented May 15, 2024

Description

The car is expected to experience an MRM stop when MPC fails.

Related links

https://tier4.atlassian.net/jira/software/c/projects/RT1/boards/438?selectedIssue=RT1-6221

Tests performed

Set the is_mpc_solved to false manually.
We received the error message.
Screencast from 06-05-2024 03:34:32 PM.webm

Notes for reviewers

Interface changes

ROS Topic Changes

ROS Parameter Changes

Effects on system behavior

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.

@github-actions github-actions bot added the component:control Vehicle control algorithms and mechanisms. (auto-assigned) label May 15, 2024
@TomohitoAndo TomohitoAndo self-requested a review May 22, 2024 23:38
@HansOersted HansOersted marked this pull request as ready for review June 5, 2024 06:40
Copy link
Contributor

@TakaHoribe TakaHoribe left a comment

Choose a reason for hiding this comment

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

Almost lgtm. Please take my suggestion.

@@ -88,9 +91,16 @@ class MpcLateralController : public trajectory_follower::LateralControllerBase
// Flag indicating whether to keep the steering control until it converges.
bool m_keep_steer_control_until_converged;

// MPC solver checker.
bool m_is_mpc_solved{true};
Copy link
Contributor

Choose a reason for hiding this comment

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

This code is okay, but let me write some advice here.

Increasing the number of member variables is generally not recommended because having more variables accessible from anywhere in the class reduces maintainability.

In essence, this variable does not need to be a member variable. It is enough to receive the results of the MPC optimization and, if it fails, publish the diagnostic as an ERROR right there. We don't have to store the information in the class member veriable.

This code has room for improvement in the sense that it unnecessarily increases the number of member variables and outputs diagnostic information via member variables.

However, since using the diagnostic_updater makes the above improvements somewhat difficult, the current code is acceptable.

@TomohitoAndo TomohitoAndo self-requested a review June 17, 2024 23:39
Copy link
Contributor

@TomohitoAndo TomohitoAndo left a comment

Choose a reason for hiding this comment

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

HansOersted and others added 10 commits June 19, 2024 12:57
Signed-off-by: Zhe Shen <lucidshenzhe@gmail.com>
Signed-off-by: Zhe Shen <lucidshenzhe@gmail.com>
Signed-off-by: Zhe Shen <lucidshenzhe@gmail.com>
Signed-off-by: Zhe Shen <lucidshenzhe@gmail.com>
Signed-off-by: Zhe Shen <lucidshenzhe@gmail.com>
Signed-off-by: Zhe Shen <lucidshenzhe@gmail.com>
Signed-off-by: Zhe Shen <lucidshenzhe@gmail.com>
Signed-off-by: Zhe Shen <lucidshenzhe@gmail.com>
Signed-off-by: Zhe Shen <lucidshenzhe@gmail.com>
Co-authored-by: Takamasa Horibe <horibe.takamasa@gmail.com>
Signed-off-by: Zhe Shen <lucidshenzhe@gmail.com>
Signed-off-by: Zhe Shen <lucidshenzhe@gmail.com>
Signed-off-by: Zhe Shen <lucidshenzhe@gmail.com>
@HansOersted HansOersted added the run:build-and-test-differential Mark to enable build-and-test-differential workflow. (used-by-ci) label Jun 19, 2024
Copy link

codecov bot commented Jun 19, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 19.01%. Comparing base (507e3f4) to head (df61189).
Report is 53 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff             @@
##             main    #7016       +/-   ##
===========================================
+ Coverage   14.84%   19.01%    +4.16%     
===========================================
  Files        1999      149     -1850     
  Lines      139163    13440   -125723     
  Branches    43716     2217    -41499     
===========================================
- Hits        20661     2555    -18106     
+ Misses      95731    10531    -85200     
+ Partials    22771      354    -22417     
Flag Coverage Δ
differential 19.01% <100.00%> (?)
total ?

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@TakaHoribe TakaHoribe left a comment

Choose a reason for hiding this comment

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

LGTM

@HansOersted HansOersted merged commit fbd61e2 into autowarefoundation:main Jun 19, 2024
40 checks passed
@HansOersted HansOersted deleted the mpc_not_solved branch June 19, 2024 06:18
simon-eisenmann-driveblocks pushed a commit to simon-eisenmann-driveblocks/autoware.universe that referenced this pull request Jun 26, 2024
…oundation#7016)

* mpc fail checker diagnostic added

Signed-off-by: Zhe Shen <lucidshenzhe@gmail.com>

* fix some scope issues

Signed-off-by: Zhe Shen <lucidshenzhe@gmail.com>

* member attribute added.

Signed-off-by: Zhe Shen <lucidshenzhe@gmail.com>

* shared pointer added.

Signed-off-by: Zhe Shen <lucidshenzhe@gmail.com>

* member attribute (diag_updater_) added

Signed-off-by: Zhe Shen <lucidshenzhe@gmail.com>

* dependency added.

Signed-off-by: Zhe Shen <lucidshenzhe@gmail.com>

* implementation of the MpcLateralController corrected!

Signed-off-by: Zhe Shen <lucidshenzhe@gmail.com>

* typo in comment corrected!

Signed-off-by: Zhe Shen <lucidshenzhe@gmail.com>

* member method argument corrected

Signed-off-by: Zhe Shen <lucidshenzhe@gmail.com>

* delete unnecessary reference mark

Co-authored-by: Takamasa Horibe <horibe.takamasa@gmail.com>

* rebase

Signed-off-by: Zhe Shen <lucidshenzhe@gmail.com>

* correct the include

Signed-off-by: Zhe Shen <lucidshenzhe@gmail.com>

* pre-commit

Signed-off-by: Zhe Shen <lucidshenzhe@gmail.com>

---------

Signed-off-by: Zhe Shen <lucidshenzhe@gmail.com>
Co-authored-by: Takamasa Horibe <horibe.takamasa@gmail.com>
Signed-off-by: Simon Eisenmann <simon.eisenmann@driveblocks.ai>
KhalilSelyan pushed a commit that referenced this pull request Jul 22, 2024
* mpc fail checker diagnostic added

Signed-off-by: Zhe Shen <lucidshenzhe@gmail.com>

* fix some scope issues

Signed-off-by: Zhe Shen <lucidshenzhe@gmail.com>

* member attribute added.

Signed-off-by: Zhe Shen <lucidshenzhe@gmail.com>

* shared pointer added.

Signed-off-by: Zhe Shen <lucidshenzhe@gmail.com>

* member attribute (diag_updater_) added

Signed-off-by: Zhe Shen <lucidshenzhe@gmail.com>

* dependency added.

Signed-off-by: Zhe Shen <lucidshenzhe@gmail.com>

* implementation of the MpcLateralController corrected!

Signed-off-by: Zhe Shen <lucidshenzhe@gmail.com>

* typo in comment corrected!

Signed-off-by: Zhe Shen <lucidshenzhe@gmail.com>

* member method argument corrected

Signed-off-by: Zhe Shen <lucidshenzhe@gmail.com>

* delete unnecessary reference mark

Co-authored-by: Takamasa Horibe <horibe.takamasa@gmail.com>

* rebase

Signed-off-by: Zhe Shen <lucidshenzhe@gmail.com>

* correct the include

Signed-off-by: Zhe Shen <lucidshenzhe@gmail.com>

* pre-commit

Signed-off-by: Zhe Shen <lucidshenzhe@gmail.com>

---------

Signed-off-by: Zhe Shen <lucidshenzhe@gmail.com>
Co-authored-by: Takamasa Horibe <horibe.takamasa@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) run:build-and-test-differential Mark to enable build-and-test-differential workflow. (used-by-ci)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants