-
Notifications
You must be signed in to change notification settings - Fork 17.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
AC_AttitudeControl: keep _euler_angle_target up to date with _attitude_target quaternion in attitude_controller_run_quat #26253
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like it when I see a change like this and I slap my head :)
This is a great suggestion because it replaces 8 other times we do this:
https://github.com/lthall/Leonard_ardupilot/blob/9986fb972635016171235750a465adc0d0174ba0/libraries/AC_AttitudeControl/AC_AttitudeControl.cpp#L253
https://github.com/lthall/Leonard_ardupilot/blob/9986fb972635016171235750a465adc0d0174ba0/libraries/AC_AttitudeControl/AC_AttitudeControl.cpp#L277
https://github.com/lthall/Leonard_ardupilot/blob/9986fb972635016171235750a465adc0d0174ba0/libraries/AC_AttitudeControl/AC_AttitudeControl.cpp#L328
https://github.com/lthall/Leonard_ardupilot/blob/9986fb972635016171235750a465adc0d0174ba0/libraries/AC_AttitudeControl/AC_AttitudeControl.cpp#L387
https://github.com/lthall/Leonard_ardupilot/blob/9986fb972635016171235750a465adc0d0174ba0/libraries/AC_AttitudeControl/AC_AttitudeControl.cpp#L429
https://github.com/lthall/Leonard_ardupilot/blob/9986fb972635016171235750a465adc0d0174ba0/libraries/AC_AttitudeControl/AC_AttitudeControl.cpp#L549
https://github.com/lthall/Leonard_ardupilot/blob/9986fb972635016171235750a465adc0d0174ba0/libraries/AC_AttitudeControl/AC_AttitudeControl.cpp#L549
https://github.com/lthall/Leonard_ardupilot/blob/9986fb972635016171235750a465adc0d0174ba0/libraries/AC_AttitudeControl/AC_AttitudeControl.cpp#L623
If we delete those 8 lines then I think this is a no-brainer.
0f8d03a
to
6af433f
Compare
@lthall This is a more complete re-work. I'm fairly sure we now keep There are a couple of places in your list where we can't remove completely as the value is used in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry it took me a while to review this. Great work.
6af433f
to
3647ad0
Compare
…e_target quaternion in attitude_controller_run_quat
Thanks to #26266 this now a much smaller change. We just set |
Added a minor tidy up to use the vector method for euler to quaternion. So:
becomes:
|
I have spotted a bug in this (I removed a update that we need). I think it might be clearer to just remove the copy in one go. To make that a little easyer I have done this PR which removes a lots of uses of the euler target in heli. |
I have marked as draft for now. |
This ensures
_euler_angle_target
is updated to stay in sync with the_attitude_target
quaternion in theattitude_controller_run_quat
call.This should mean its a better representation of what is actually going on, otherwise the
_euler_angle_target
is updated in the "input..." methods meaning its actually the target from the last loop when fetched for logging ect.Really I think we should look to remove the
_euler_angle_target
completely, and pull it out of the quaternion when we need it. But that is a much bigger re-work that will also cost some extra computation each time. It will however guarantee both values are always in sync.