Added the Active Disturbance Rejection Control (ADRC) Algorithm#12648
Added the Active Disturbance Rejection Control (ADRC) Algorithm#12648div-dev123 wants to merge 11 commits intoTheAlgorithms:masterfrom
Conversation
|
@cclauss can you approve this if its okay? |
| """ | ||
|
|
||
|
|
||
| class ADRC: |
There was a problem hiding this comment.
Optional: This might be simpler as a dataclass. https://docs.python.org/3/library/dataclasses.html
| self.z2 = 0.0 # Estimated system velocity | ||
| self.z3 = 0.0 # Estimated total disturbance | ||
|
|
||
| def compute(self, measured_value: float, dt: float) -> float: |
There was a problem hiding this comment.
| def compute(self, measured_value: float, dt: float) -> float: | |
| def control_output(self, measured_value: float, dt: float) -> float: |
or get_control_output() or calculate_control_output()
| return control_output | ||
|
|
||
| def reset(self): | ||
| """Reset the estimated states.""" |
There was a problem hiding this comment.
As discussed in CONTRIBUTING.md, all methods need one or more doctests.
| """Reset the estimated states.""" | |
| """Reset the estimated states. | |
| >>> adrc = ADRC(0.0, 0.0, 0.0) | |
| >>> adrc.z1, adrc.z2, adrc.z3 = 1.1, 2.2, 3.3 | |
| >>> adrc.reset() | |
| >>> adrc.z1, adrc.z2, adrc.z3 | |
| (0.0, 0.0, 0.0) | |
| """ |
Co-authored-by: Christian Clauss <cclauss@me.com>
There was a problem hiding this comment.
Click here to look at the relevant links ⬇️
🔗 Relevant Links
Repository:
Python:
Automated review generated by algorithms-keeper. If there's any problem regarding this review, please open an issue about it.
algorithms-keeper commands and options
algorithms-keeper actions can be triggered by commenting on this PR:
@algorithms-keeper reviewto trigger the checks for only added pull request files@algorithms-keeper review-allto trigger the checks for all the pull request files, including the modified files. As we cannot post review comments on lines not part of the diff, this command will post all the messages in one comment.NOTE: Commands are in beta and so this feature is restricted only to a member or owner of the organization.
|
|
||
|
|
||
| class ADRC: | ||
| def __init__(self, error_correction: float, disturbance: float, acceleration: float, target: float = 0.0): |
There was a problem hiding this comment.
Please provide return type hint for the function: __init__. If the function does not return a value, please provide the type hint as: def function() -> None:
| self.z2 = 0.0 # Estimated system velocity | ||
| self.z3 = 0.0 # Estimated total disturbance | ||
|
|
||
| def compute(self, measured_value: float, dt: float) -> float: |
There was a problem hiding this comment.
As there is no test file in this pull request nor any test function or class in the file control_algorithms/adrc.py, please provide doctest for the function compute
| control_output = self.z2 - self.z3 | ||
| return control_output | ||
|
|
||
| def reset(self): |
There was a problem hiding this comment.
As there is no test file in this pull request nor any test function or class in the file control_algorithms/adrc.py, please provide doctest for the function reset
Please provide return type hint for the function: reset. If the function does not return a value, please provide the type hint as: def function() -> None:
Co-authored-by: Christian Clauss <cclauss@me.com>
There was a problem hiding this comment.
Click here to look at the relevant links ⬇️
🔗 Relevant Links
Repository:
Python:
Automated review generated by algorithms-keeper. If there's any problem regarding this review, please open an issue about it.
algorithms-keeper commands and options
algorithms-keeper actions can be triggered by commenting on this PR:
@algorithms-keeper reviewto trigger the checks for only added pull request files@algorithms-keeper review-allto trigger the checks for all the pull request files, including the modified files. As we cannot post review comments on lines not part of the diff, this command will post all the messages in one comment.NOTE: Commands are in beta and so this feature is restricted only to a member or owner of the organization.
|
|
||
|
|
||
| class ADRC: | ||
| def __init__(self, error_correction: float, disturbance: float, acceleration: float, target: float = 0.0): |
There was a problem hiding this comment.
Please provide return type hint for the function: __init__. If the function does not return a value, please provide the type hint as: def function() -> None:
| self.system_velocity = 0.0 # Estimated system velocity | ||
| self.total_disturbance = 0.0 # Estimated total disturbance | ||
|
|
||
| def compute(self, measured_value: float, dt: float) -> float: |
There was a problem hiding this comment.
As there is no test file in this pull request nor any test function or class in the file control_algorithms/adrc.py, please provide doctest for the function compute
| control_output = self.z2 - self.z3 | ||
| return control_output | ||
|
|
||
| def reset(self): |
There was a problem hiding this comment.
As there is no test file in this pull request nor any test function or class in the file control_algorithms/adrc.py, please provide doctest for the function reset
Please provide return type hint for the function: reset. If the function does not return a value, please provide the type hint as: def function() -> None:
for more information, see https://pre-commit.ci
Co-authored-by: Christian Clauss <cclauss@me.com>
There was a problem hiding this comment.
Click here to look at the relevant links ⬇️
🔗 Relevant Links
Repository:
Python:
Automated review generated by algorithms-keeper. If there's any problem regarding this review, please open an issue about it.
algorithms-keeper commands and options
algorithms-keeper actions can be triggered by commenting on this PR:
@algorithms-keeper reviewto trigger the checks for only added pull request files@algorithms-keeper review-allto trigger the checks for all the pull request files, including the modified files. As we cannot post review comments on lines not part of the diff, this command will post all the messages in one comment.NOTE: Commands are in beta and so this feature is restricted only to a member or owner of the organization.
| self.system_velocity = 0.0 # Estimated system velocity | ||
| self.total_disturbance = 0.0 # Estimated total disturbance | ||
|
|
||
| def compute(self, measured_value: float, dt: float) -> float: |
There was a problem hiding this comment.
As there is no test file in this pull request nor any test function or class in the file control_algorithms/adrc.py, please provide doctest for the function compute
| # Control Law (Nonlinear State Error Feedback - NLSEF) | ||
| return self.z2 - self.z3 | ||
|
|
||
| def reset(self): |
There was a problem hiding this comment.
As there is no test file in this pull request nor any test function or class in the file control_algorithms/adrc.py, please provide doctest for the function reset
Please provide return type hint for the function: reset. If the function does not return a value, please provide the type hint as: def function() -> None:
|
@cclauss Sorry for so many commits! I dont have much experience contributing so i did make a few mistakes! Please check if any more changes are required! |
|
Can this be merged or are there any changes required? |
Describe your change:
Fixes #12622
Checklist: