-
Notifications
You must be signed in to change notification settings - Fork 17.2k
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
AP_Math: add +- 45 roll rotations, use 32 digit constants, AP_Compass support auto orientation for +-45 roll #18098
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.
Slight review only
libraries/AP_Math/quaternion.cpp
Outdated
@@ -21,6 +21,11 @@ | |||
#include "AP_Math.h" | |||
#include <AP_InternalError/AP_InternalError.h> | |||
|
|||
#define HALF_SQRT_2_PlUS_SQRT_2 0.92387953251128673848313610506011 // sqrt(2 + sqrt(2)) / 2 | |||
#define HALF_SQRT_2_MINUS_SQTR_2 0.38268343236508972626808144923416 // sqrt(2 - sqrt(2)) / 2 | |||
#define HALF_SQRT_HALF_TIME_TWO_PLUS_SRT_TWO 0.65328148243818828788676000840496 // sqrt((2 + sqrt(2))/2) / 2 |
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.
Static constexpr ftype ?
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.
These are a define because the existing HALF_SQRT_2
was, I'm not really sure the benefit either way.
f135265
to
d3d560c
Compare
I have tested auto rotation at few orientations, including the two new ones. Compass mounted physically at no rotation, then changing |
@IamPete1 the problem with having all the 45 degree rotations in mag cal is it makes it more likely that the auto-orientation code will pick the wrong orientation. That code doesn't have a lot of margin. |
@tridge Were already doing auto orientation for the 45 deg yaw rotations, I don't see why it would be worse for roll than it is for yaw? I agree that we should not do combined 45's like 45 yaw 45 roll. |
Were also currently auto rotating some of the more wacky ones, like |
for some of them, yes, but I'd prefer to remove those from the auto-rotation list rather than adding more. |
@@ -63,10 +63,12 @@ enum Rotation : uint8_t { | |||
ROTATION_ROLL_270_PITCH_270 = 35, | |||
ROTATION_ROLL_90_PITCH_180_YAW_90 = 36, |
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.
This one is the same as ROLL_270_YAW_270, admittedly that is not one that we have, but is is much easier to understate as two numbers rather than 3.
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 think COMPASS_AUTOROT should be extended to be "only 90s" or "90s and 45s"
2cb9fb5
to
17cec01
Compare
Thanks to @Gone4Dirt for helping me with the quaternions.