Skip to main content

Active Disturbance Rejection Control (ADRC)

This repository contains Python, C++, MATLAB, and Simulink implementation of Active Disturbance Rejection Control with Extended State Observer (ESO), Tracking Differentiator (TD), input delay compensation, control saturation, and support for optional use of the cascaded structure.

I've summarized a comprehensive note on the theoretical background of actve disturbance rejection controller and tracking differentiators. You can find it in here (I'll add the cascaded ADRC documentation as soon as possible).

Note: The Python version on Pypi (which can be installed with pip install adrc) is currently not the latest version. This is because access to the global internet has been cut off in Iran for the past two months! I'll update that as soon as possible. For now, I highly recommend using the implementation available on Github.

Note: Important notes for the Python, C++, Matlab, and Simulink implementations are given after the introduction!

New: Cascaded ADRC is now supported for all the environments as well.


Demo

Here are some figures showing the controller in action, in presence of time-varying referece signal, input delay, input saturation, etc.

alt text

alt text

alt text

alt text


Please pay attention to the following:

Python

Note: Good news! You can install the Python implementation using

pip install adrc

You can look at the project page on Pypi for more information. (Note: I recommend using the version on Github for now until I update the Pypi version)

Note: To be able to use all the Python codes, especially the demo script, you need to have the following packages installed:

  • numpy
  • scipy (only needed for the demo)
  • matplotlib (only needed for the demo)
  • python-control (only needed for the demo)

Simulink

Discrete controller implementations are available for first and second-order systems in simulink. There is also a continuous-time implementation for second-order systems. Continuous-time first-order systems will be added as well. Please pay attention to the following:

  • The model settings in all cases is set to variable step solver. I do encourage using this option, unless there is a specfic system you are working with and you know what you are doing.
  • In discrete-time simulations, it is necessary that you change the sample time not only where you pass it to the controller, but also in the two or three (depending on the system order) delay blocks that are present in the observer block. I am looking into a way to circumvent this, but for now, you have to change them manually.
  • I have added support for first-order and second-order cascaded ADRC as well. You can compare their performance against the standard ADRC in the two simulink files.
  • The Simulink files are generated using MATLAB 2025b. If you have an older version and need the files, you can contact me to export them for you. I will add automatic support for older versions as well in the future. You can caontact me via email at mrgilak02@gmail.com, but I might not be able to respond quickly due to frequent internet shutdowns in Iran :)

MATLAB

You can take a look at this file to see how the code works.

Note: I have tried to use the same names in MATLAB, Python, and C++; however, I still feel it's necessary to add proper documentation for each. This is in the TODOs.

  1. Sample Time: Controller sample time dT can differ from simulation time step dt. The controller should be called at rate dT.
  2. Delay Compensation: Input delay is specified in seconds and internally converted to discrete steps. Delay buffer maintains control history.
  3. Initialization: Always call initialize() before step(). The controller will throw an error if used uninitialized.
  4. TD Integration: When TD is enabled, it is automatically updated within step(). Manual reference derivatives can still be provided via varargin to override TD estimates.
  5. State Estimation: Access estimated states via getEstimatedStates() for monitoring or additional processing.

TODOs

  • add proper documentation for the Python and C++ versions as well
  • add theoretical background for cascaded ADRC
  • update Pypi
  • add a script to compare MATLAB and Simulink's output for any possible differences
  • add support for multiple generations of older Simulink versions (distant future!)
  • update the project website

This repo is maintained by me. Contributions are welcome as well.

References

  1. Han, J. (2009). "From PID to Active Disturbance Rejection Control". IEEE Transactions on Industrial Electronics.
  2. Gao, Z. (2006). "Active Disturbance Rejection Control: A Paradigm Shift in Feedback Control System Design". American Control Conference.
  3. Herbst, G. (2013). "A Simulative Study on Active Disturbance Rejection Control (ADRC) as a Control Tool for Practitioners". Electronics.
  4. Zheng, Q., Gao, Z. (2010). "On Practical Applications of Active Disturbance Rejection Control". Chinese Control Conference.
  5. Madoński, R., & Herman, P. (2015). Survey on methods of increasing the efficiency of extended state disturbance observers. ISA transactions, 56, 18-27.

Metadata

Release files for adrc 1.0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for adrc 1.0.3
File Size Uploaded
adrc-1.0.3.tar.gz 13.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for adrc 1.0.3
File Interpreter ABI Platform
adrc-1.0.3-py3-none-any.whl Python 3 none any Details

Total release size: 25.2 kB

Release files / adrc-1.0.3.tar.gz

Download URL adrc-1.0.3.tar.gz
Size 13.5 kB
Tags Source
SHA-256 checksum
How to use checksums
b80d11c98a051f4e143932f5624beac7ce4dd2af2b1a51a928c3a177dcfe2de1
BLAKE2b-256 checksum
How to use checksums
ac4980e1c8ee0d7599edeff4bb46a82083bf540b868f3498b8d51a694f1fe9b9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.7

Release files / adrc-1.0.3-py3-none-any.whl

Download URL adrc-1.0.3-py3-none-any.whl
Size 11.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d430a169032dfdf8faee11c4ef9c2505b42b30868486db701f1b86e04c74abc2
BLAKE2b-256 checksum
How to use checksums
1fb3a0acf547bb47536fb6f499337aeac294e4d8f5155d5096022eee60161644
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.7

Release history Release notifications | RSS feed

This release

1.0.3 This release

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page