What does Pre Arm leaning mean

Hey all.
I was just finalizing a new build with the latest gold code. All coming together nicely when I decide. Drum roll Maestro time to try arming.
It tossed a pre arm message at me. Not a big surprise use to that and working through anything giving the machine grief. But this time
I had no clue it said Pre Arm Leaning. huh. the copter was level, calibration was done.
I find no documentation on it so thought I would ask.
I got past it by setting the pre arm checks individually instead of setting to All

any thoughts.

Huh, that’s one I haven’t seen before. Searching the code reveals this:

    // check lean angle
    if ((checks_to_perform == ARMING_CHECK_ALL) || (checks_to_perform & ARMING_CHECK_INS)) {
        if (degrees(acosf(ahrs.cos_roll()*ahrs.cos_pitch()))*100.0f > copter.aparm.angle_max) {
            check_failed(ARMING_CHECK_INS, true, "Leaning");
            return false;

Looks like the FC thought the drone was leaning more than the ANGLE_MAX parameter. So I guess you should check two things: first, that ANGLE_MAX is set correctly (it’s in centi-degrees!), and that the drone actually thinks it’s level (check horizon in GCS).

Well I am glad It wasn’t me.
so the GCS is level that was the first thing I checked.
However the ANGLE_MAX I have not checked. Dumb question but whats a centi-degrees
So I happen to have pulled the config on the drone just before I shut it down and this is what the value is.
There is no way this machine was leaning 45 degree’s the GCS showed level.
It had just been calibrated for Accelerometer…so it knows what level is or at least in theory.

4500 centidegrees is 45 degrees, so yeah that’s fine.

What flight mode are you in? The only other possibility I can think of is that a related parameter like PSC_ANGLE_MAX, LOIT_ANGLE_MAX, or AVOID_ANGLE_MAX is not configured correctly. The documentation says the first two are in degrees, while AVOID is in centidegrees. Not sure if I believe that. Luckily, the first two can be set to 0 and be ignored, so maybe try setting them to 0 and setting AVOID to 4500, if they aren’t already.


Yeah I’m out of ideas. Lean angle being more than angle_max is the only reason that error would ever appear. You’re running Copter 3.6.10?

I will see what version it is but I am pretty sure it is 3.6.10 as that’s the gold version and this is a brand new build.
Also will see if I can pull a log and share that as well…assuming the problem remains.

In the mean time @Anubis thank you for jumping on this issue its appreciated.

Hi @rickyg32, just from reading the code, your fc “thinks” it is leaning more than 45deg. You might want to try to re-level and re-calibration? If. It shows the error again after reboot you might want to set angle_max to 2500?

P.S. maybe the gps puck got loose?

Well I tried it again this morning and no error. I didn’t change anything.
I will test it a bunch more before sunday to make sure I don’t have any issues because Sunday is fly day.

Great news @rickyg32, good luck.

What flight controller are you using?
It can be and intermittent sensor failure or initialization error, which can raise question about the the flight controller.

Pixhawk mini I believe is what it’s called.

It’s possible I did the calibration and needed to restart it. No idea…seems fine now.
Going to maiden it Sunday if its not raining.

I’m on copter 4.2.2. My Flight controller is Holybro Kakute H7. I thought Calibrate Level would fix my pre-arm leaning issue but that failed, as each time I ran the Calibrate Level command it completed with an error. I recalled my flight controller was mounted upside down. I then updated board orientation roll to 180 to reflect my FC being mounted upside down. After that, I successfully completed Calibrate Level and the pre arm leaning error was no more.