Differential: Fix PID implementation and adjust speed setpoint based on yaw rate setpoint #23928
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Solved Problem
This PR address these 2 problems:
The integral limits are implemented wrong due to the fact that the limit is taken prior to the multiplication with$k_i$ . To fix this the integral limits need to be divided by $k_i$ .
The controller prioritizes yaw rate over forward speed. A high yaw rate setpoint can therefor make the forward speed setpoint infeasible due to actuator limitations. This leads to the integrator of the speed controller to build up. This can be fixed by adjusting the speed setpoint based on the amount of control effort that is “occupied” by the yaw rate setpoint.
Test coverage