-
Notifications
You must be signed in to change notification settings - Fork 13.7k
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
mc_att_control: adjust attitude setpoint upon estimate reset #14738
Conversation
08f8fad
to
3056a47
Compare
http://ci.px4.io:8080/blue/organizations/jenkins/PX4_misc%2FFirmware-SITL_tests/detail/PR-14738/3/pipeline |
3056a47
to
6c5e266
Compare
6c5e266
to
d1ccc33
Compare
@dagar During SITL testing I found the following case is quite common: A new attitude setpoint that was generated with the old reference overwrites the old adapted one because they get processed in the same loop iteration. Easy fix, first check for setpoints then for resets -> 3rd commit. Doing above I found the far less common but still occuring case where there's a new attitude setpoint that was already generated with the new reference and it gets corrected again assuming it's an old one (see above). Since this is less likely I prefer the solution with the fix but it's annoying to not have all corner cases covered. |
The last attitude setpoint that is known from the position controller is now kept inside the AttitudeControl class such that we don't keep the whole vehicle_attitude_setpoint struct and always copy over from there to run an update step.
There was a gap where the attitude controller already used the estimate with a new reference but the last known attitude setpoint was still based on the old reference. This leads to a big glitch on reset because until the attitude setpoint gets updated the error is wrong and as large as the attitude delta of the reset.
d1ccc33
to
99b8e52
Compare
Describe problem solved by this pull request
When the attitude estimate quaternion is reset the attitude controller uses the new reference in the next loop iteration. But the attitude setpoint is not updates to the new reference until the position controller generates a new attitude setpoint but it runs in a much slower rate. As a result there are glitches in the output rate setpoint. See #14676 (comment)
Describe your solution
The internal setpoint copy is updated with the delta quaaternion upon attitude estimate reset. It will get overwritten with the next attitude setpoint change.
Test data / coverage
Completely untested, tests still REQUIRED.