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): visualize/correct the longitudinal and lateral deviations for pid and mpc #6268

Draft
wants to merge 24 commits into
base: main
Choose a base branch
from

Conversation

HansOersted
Copy link
Contributor

@HansOersted HansOersted commented Feb 1, 2024

Description

The PID and MPC controllers are to stabilize the longitudinal velocity and lateral position, respectively.
Specifically, they intend to decrease the deviations (state - reference) or state error (reference -state).

This PR publishes the following deviations (state - reference) for evaluating the quality of the controllers:

  1. /control/trajectory_follower/lane_departure_checker_node/debug/deviation/longitudinal
    The deviation of the longitudinal position is published.
  2. /control/trajectory_follower/lane_departure_checker_node/debug/deviation/longitudinal_velocity
    The deviation of the longitudinal velocity is published.
  3. /control/trajectory_follower/lateral/diagnostic
    The deviation of the lateral position (with respect to the actual reference feeding the optimization module) is corrected.
    The deviation of the lateral position (with respect to the original raw planned date feeding MPC.cpp) is added.

These topics can be further visualized by third-party app, e.g., plotjuggler.

Related links

Tests performed

Screencast.from.02-01-2024.11.25.03.AM.webm

Longitudidal position deviation:
image

Longitudidal velocity deviation:
image

Lateral position deviation:
( red: w.r.t. the raw reference feeding mpc.cpp. green: w.r.t. the actual reference feeding the optimization module.)
image

Notes for reviewers

Interface 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.

Signed-off-by: Zhe Shen <lucidshenzhe@gmail.com>
…ative function prototype defined

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

Signed-off-by: Zhe Shen <lucidshenzhe@gmail.com>
Signed-off-by: Zhe Shen <lucidshenzhe@gmail.com>
Signed-off-by: Zhe Shen <lucidshenzhe@gmail.com>
…tude, but the current_acc may only be available by subscribing

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

Signed-off-by: Zhe Shen <lucidshenzhe@gmail.com>
…al reference, that is mpc_resampled_ref_trajectory). publish the mpc_data_traj_raw.lateral_err w.r.t. the raw planned path

Signed-off-by: Zhe Shen <lucidshenzhe@gmail.com>
@github-actions github-actions bot added the component:control Vehicle control algorithms and mechanisms. (auto-assigned) label Feb 1, 2024
@HansOersted HansOersted marked this pull request as ready for review February 1, 2024 04:33
@zulfaqar-azmi-t4
Copy link
Contributor

Confirmed that the parameter is added.

Screencast.from.2024.02.01.16.23.37.webm

@zulfaqar-azmi-t4
Copy link
Contributor

zulfaqar-azmi-t4 commented Feb 1, 2024

@HansOersted
Thank you very much for the PR.

Can you please update the documentation as well in the same PR so that if user read the documents, they will know what are the available topics they can use to debug, and what are the significance from observing the topic?

Signed-off-by: Zhe Shen <lucidshenzhe@gmail.com>
@github-actions github-actions bot added the type:documentation Creating or refining documentation. (auto-assigned) label Feb 9, 2024
@HansOersted HansOersted closed this Feb 9, 2024
@HansOersted HansOersted reopened this Feb 9, 2024
@HansOersted HansOersted self-assigned this Feb 9, 2024
@HansOersted
Copy link
Contributor Author

@HansOersted Thank you very much for the PR.

Can you please update the documentation as well in the same PR so that if user read the documents, they will know what are the available topics they can use to debug, and what are the significance from observing the topic?

description added a47aae1

@zulfaqar-azmi-t4 zulfaqar-azmi-t4 self-assigned this Feb 13, 2024
@HansOersted HansOersted added run:build-and-test-differential Mark to enable build-and-test-differential workflow. (used-by-ci) run:deploy-docs Mark for deploy-docs action generation. (used-by-ci) labels Feb 14, 2024
@HansOersted HansOersted changed the title feat(mpc_lateral_controller): visualize/correct the longitudinal and lateral deviations for pid and mpc feat(mpc_lateral_controller): visualize/correct the longitudinal and lateral deviations for pid and mpc Feb 14, 2024
Comment on lines 218 to 226
| The signal | Number |
| :------------------------------------------------------------- | :----- |
| final steering command (MPC + Clamp + LPF) | [0] |
| MPC result | [1] |
| MPC after Clamp (MPC + Clamp) | [21] |
| feedforward term (reference steering angle) | [2] |
| lateral error w.r.t the modified reference, feeding MPC module | [5] |
| lateral error w.r.t the original reference, feeding mpc.cpp | [22] |

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed in 6ba472a

Copy link

codecov bot commented Feb 14, 2024

Codecov Report

Attention: Patch coverage is 22.72727% with 17 lines in your changes missing coverage. Please review.

Project coverage is 14.79%. Comparing base (d5c7e61) to head (c7cef56).
Report is 2819 commits behind head on main.

Files with missing lines Patch % Lines
..._departure_checker_node/lane_departure_checker.cpp 0.00% 9 Missing ⚠️
...rture_checker_node/lane_departure_checker_node.cpp 0.00% 4 Missing ⚠️
control/mpc_lateral_controller/src/mpc.cpp 55.55% 0 Missing and 4 partials ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #6268   +/-   ##
=======================================
  Coverage   14.79%   14.79%           
=======================================
  Files        1917     1917           
  Lines      131985   132003   +18     
  Branches    39228    39234    +6     
=======================================
+ Hits        19522    19529    +7     
- Misses      90673    90684   +11     
  Partials    21790    21790           
Flag Coverage Δ *Carryforward flag
differential 14.46% <22.72%> (?)
total 14.79% <ø> (+<0.01%) ⬆️ Carriedforward from c36e2ef

*This pull request uses carry forward flags. Click here to find out more.

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

HansOersted and others added 3 commits February 26, 2024 16:57
Signed-off-by: Zhe Shen <lucidshenzhe@gmail.com>
Signed-off-by: Zhe Shen <lucidshenzhe@gmail.com>
HansOersted and others added 9 commits March 1, 2024 13:21
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>
@takayuki5168
Copy link
Contributor

@HansOersted
Let's run the internal scenario test before merging. I will teach how to do that next week.

Copy link

stale bot commented May 1, 2024

This pull request has been automatically marked as stale because it has not had recent activity.

@stale stale bot added the status:stale Inactive or outdated issues. (auto-assigned) label May 1, 2024
@xmfcx
Copy link
Contributor

xmfcx commented Dec 10, 2024

@HansOersted @takayuki5168 could you finish this task?

@stale stale bot removed the status:stale Inactive or outdated issues. (auto-assigned) label Dec 10, 2024
@takayuki5168 takayuki5168 marked this pull request as draft December 10, 2024 15:55
Copy link

stale bot commented Feb 8, 2025

This pull request has been automatically marked as stale because it has not had recent activity.

@stale stale bot added the status:stale Inactive or outdated issues. (auto-assigned) label Feb 8, 2025
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) run:deploy-docs Mark for deploy-docs action generation. (used-by-ci) status:stale Inactive or outdated issues. (auto-assigned) type:documentation Creating or refining documentation. (auto-assigned)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants