-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Allow aligning the mag to any rotation #2833
Conversation
Closes #2014 |
src/main/sensors/compass.c
Outdated
.angles.yaw = DECIDEGREES_TO_RADIANS(compassConfig()->yawDeciDegrees), | ||
}; | ||
|
||
rotateV(&v, &r); |
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.
rotateV
is quite expensive because it builds rotation matrix every time.
@digitalentity Just moved the matrix computation to compass initialization. I'm wondering if we should do this also for on-board mag alignment. The 9 mul + 6 add used by the rotation might be faster than the current branching + muls used by |
61efa9b
to
4a55873
Compare
Introduce 3 new variables which allow setting the decidegrees for the mag sensor alignment. When any of these 3 variables are non-zero, mag is assumed to be mounted off-board and "align_mag" as well as the board alignment are ignored. Settings are named align_mag_roll, align_mag_pitch and align_mag_yaw. Fixes #86 Fixes #1029
Introduce rotateByMatrix(), which rotates a vector by the given matrix. Initialize the matrix on mag initialization, so it's not recalculated on every mag reading.
4a55873
to
fb08194
Compare
Introduce 3 new variables which allow setting the decidegrees
for the mag sensor alignment. When any of these 3 variables
are non-zero, mag is assumed to be mounted off-board and
"align_mag" as well as the board alignment are ignored.
Settings are named align_mag_roll, align_mag_pitch and
align_mag_yaw.
Fixes #86
Fixes #1029