Skip to content
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

Free Mag alignment with cli not possible #5405

Closed
brainbubblersbest opened this issue Feb 12, 2020 · 8 comments
Closed

Free Mag alignment with cli not possible #5405

brainbubblersbest opened this issue Feb 12, 2020 · 8 comments

Comments

@brainbubblersbest
Copy link

brainbubblersbest commented Feb 12, 2020

Since a few Days, multiple Problems occured in Inav Facebook Group.
Problem: Users who mounting Magnetometer with Compass on a 30degree Tilt Angle Backwards, are not able to get this working with set mag_align_tilt = 300 or -300.

Or Simply cannot calibrate it if it's mounted flat anyway.

Lot of them build a dozen quads with inav and tiltet/flat mount mag/gps. And now got it only working with a flat mount magnetometer. (EG bn880 with cw270 flip and mag_align_pitch = -300

Or mean this:
// on-board mag alignment. Ignored if externally aligned via *DeciDegrees.

That cw270flip would be ignore and you need to set
Mag_align_pitch = -300
mag_align_roll = 1800
mag_align_yaw = 2700

Or if mag is mounted with cw270 flip
Flip is now roll and values are mean sensor axis itself?

Screenshot_20200212_214547_com facebook katana

shellixyz@1f8d73c

@Bednarov
Copy link

Bednarov commented Feb 12, 2020

I also have this problem with magnetometer. I want to mount it on a quadcopter. Angled backwards so when I fly the GPS looks directly up. It allows the unit to see more satelites constantly.

When the GPS+Compass unit (BN-880) is flat, it works perfectly. When it's tilted backwards, after calibration the heading readings are messy.

I tried setting align_mag_pitch to -300, 300 (for 30* angle that I have), calibrating after every change. Also i tried replicating the "CW270Flip" setting, in case that it's ignored when using the pitch angle cli command. Nothing works. I tried current firmware and also INAV 2.2.0

I was calibrating on a 2m cable, so no interference during calibration, also no interference from the quad, because when mounted flat in the same spot mag works perfectly. The tilt is the problem.

@brainbubblersbest
Copy link
Author

brainbubblersbest commented Feb 16, 2020

Hello, just wanna say. I found this in the betaflight Code.
That mean: eg a BN880 with cw270flip results in following values:
flip over pitch axis 180degree and rotate over Yaw axis 270degree=

set mag_align_pitch = 1800
set mag_align_yaw = 2700
save

Means for 30degree backwards tilted, reduce roll at value -300

set mag_align_roll = -300
save

Because Roll Axis of Magnetometer is in relative to pitch axis of FC and vice versa

Also use:
set align_mag = custom
save

#define CUSTOM_ALIGN_CW0_DEG ((sensorAlignment_t){ .values = { .roll = 0, .pitch = 0, .yaw = 0 }})
#define CUSTOM_ALIGN_CW90_DEG ((sensorAlignment_t){ .values = { .roll = 0, .pitch = 0, .yaw = 90 }})
#define CUSTOM_ALIGN_CW180_DEG ((sensorAlignment_t){ .values = { .roll = 0, .pitch = 0, .yaw = 180 }})
#define CUSTOM_ALIGN_CW270_DEG ((sensorAlignment_t){ .values = { .roll = 0, .pitch = 0, .yaw = 270 }})
#define CUSTOM_ALIGN_CW0_DEG_FLIP ((sensorAlignment_t){ .values = { .roll = 0, .pitch = 180, .yaw = 0 }})
#define CUSTOM_ALIGN_CW90_DEG_FLIP ((sensorAlignment_t){ .values = { .roll = 0, .pitch = 180, .yaw = 90 }})
#define CUSTOM_ALIGN_CW180_DEG_FLIP ((sensorAlignment_t){ .values = { .roll = 0, .pitch = 180, .yaw = 180 }})
#define CUSTOM_ALIGN_CW270_DEG_FLIP ((sensorAlignment_t){ .values = { .roll = 0, .pitch = 180, .yaw = 270 }})

void buildRotationMatrixFromAlignment(const sensorAlignment_t* alignment, fp_rotationMatrix_t* rm);
void buildAlignmentFromLegacyRotation(sensorAlignment_t

@brainbubblersbest
Copy link
Author

brainbubblersbest commented Feb 16, 2020

Maybe this short hint can be added to the inav Wiki?
Added this short Explanation to the INAV Wiki, so other Users get information of that function.

Can be closed

@brainbubblersbest brainbubblersbest changed the title Mag alignment with cli not possible Free Mag alignment with cli not possible Feb 17, 2020
@alienwaredream
Copy link

Hello everyone!
I found something not right in the those CLI
in INAV2.5.0 should be :
set align_mag_roll = 300
set align_mag_yaw = 900
set align_mag_pitch = 1800

@brainbubblersbest
Copy link
Author

And what value is wrong?

@alienwaredream
Copy link

align_mag_roll
mag_align_roll

As a rookie, I am a little confused. @@!

@brainbubblersbest
Copy link
Author

brainbubblersbest commented Jun 12, 2020

Im confused too because These cli variables at betaflight are correct. So it seems inav use the variables as you describe. Why i didnt notice that? I Look about that tomorrow.

@brainbubblersbest
Copy link
Author

Should be correct now
Bf use also mag_align "custom" which is not existent in inav. Some Times it's confusing if you use multiple inav and bf fcs 😅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants