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

Auto-tuning of angular rates and attitude controllers (MC version) #18311

Merged
merged 10 commits into from Oct 2, 2021

Conversation

bresch
Copy link
Member

@bresch bresch commented Sep 29, 2021

Describe problem solved by this pull request
Trial and error manual tuning requires good piloting skills and tuning experience. The new modulemc_autotune_attitude_control introduced in this PR is an attempt to address these issues by automating this tuning process.

More than this, the result of the system identification algorithm included in this module will be helpful to the control systems engineer to obtain a simple discrete-time model of the system that can be later used for offline controller design of more sophisticated controllers.

Describe your solution
The auto-tuning introduced in this PR is based on indirect (online closed-loop system identification + controller design) adaptive control theory. Running at relatively high speed in real time on a microcontroller, only recursive filters and estimators have been used. For the same reason, the PID designer (based on General Minimum Variance Control) uses a pre-computed closed-form solution to obtain the result of the optimization problem.

DeepinScreenshot_select-area_20210905105049

For more details, see:
MathieuBresciani_Controllers_auto-tuning_for_multirotors_and_fixed-wing_vehicles.pdf
and the recorded presentation (PX4 Dev Summit 2021):
https://www.youtube.com/watch?v=Yzhjlo5FnCU&t=2s&ab_channel=PX4Autopilot-OpenSourceFlightControl.

How to use it?
IMPORTANT: moving the roll/pitch stick of the remote during identification will immediately abort the process. It can be started again using the MC_AT_START parameter.

It will soon be a single click on a button in the "Tuning" tab of QGC (but it isn't upsreamed at the moment) but for now, it can be triggered manually via the parameter MC_AT_START (set to 1, it'll automatically go back to 0 when done). For the rest, follow the documentation in the Skynode manual:
https://docs.auterion.com/skynode/advanced-configuration/controllers-auto-tuning

Test data / coverage
SITL jMavSim on this branch:
https://logs.px4.io/plot_app?log=d305531b-5462-4b1c-949f-7f89c2beefab

Result in autotune_attitude_control_status.msg
From top to bottom:

  • current state of the state machine
  • value of the estimated coefficients (discrete-time transfer function)
  • signal injected to the input of the rate controller (for system identification)
  • PID gain generated using the current model and desired meta-parameters
    DeepinScreenshot_select-area_20210929151049

Replayed on offline Python tool (soon available):
DeepinScreenshot_urxvt_20210929151343

Test on a X500 (same algorithm but different branch):
https://logs.px4.io/plot_app?log=7a2a60fd-dfba-4356-b92b-5dfd687bd579

TODO:

  • add module to all targets
  • find a way to send back the current status to QGC through mavlink (@dagar we used to have a progress field in the ACK message but it's apparently not there anymore)

@dagar
Copy link
Member

dagar commented Oct 2, 2021

I'll see if I can get this building everywhere.

@dagar dagar force-pushed the pr-autotune branch 3 times, most recently from 0f61201 to 6d1a9b6 Compare October 2, 2021 17:59
 - adjust flash constrianed targets to fit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants