Err EKF_PRIMARY (internal compass and visual odometry only)

Hi all,

I’ve try to fly today with my drone and it was impossible, I’ve got a lot of ekf primary change very fast, I’ve looked in my log and I have this error Err: EKF_PRIMARY -1 and -0.
So in flight my drone was not stable in AltHold he doesn’t maintain altitude the drone was falling by itself this is strange. I’ve looked in log my BARO pressure if I have glitch or something but for me nothing stange, if someone with good skills in log reading can check my bin anf help me to isolate the problem


How did the compass calibrations go? I think you’re getting throttle interference into your compass.

I noticed that your pitch and roll P&I values are different. Usually P&I are the same values. I don’t know if that will feed into the EKF issues but it likely had something to do with the oscillations.

For my compass calibration it will be good but I didn’t do a compensation with motor running should I do?

Yep this is strange I’ll check why P&I are different maybe an error when I did my tuning

You are only using the FC internal compass? Those typically perform poorly.

Yes I only use the internal compass inside the Orange Cube. Is it better to add an external compass?

In almost all craft definitely. What about GPS? Missing that too?

I don’t have gps. For loiter mode I have an intel t265. Loiter mode works fine. And do you have any advice about an external compass?

The GY-271 boards have worked well for some.

Ok I’ll try to add it on my drone. For now I’ll redo a compass calibration and try a compensation motor after I hope it will remove warning/error about ekf

I have done naother fly today I got again the same error in log Err : EKF_PRIMARY -1 and Err : EKF_PRIMARY 0 I did coompass calibration with QGroundControl and I was in the green section. I’ve followed tuning process I have no vibration this is smoth but in AltHold the drone doesn’t maintain weel the altitude, he climbs alone and if I touch the throttle very very little he falls very rapidly I need to put throttle to avoid collision with the ground.
First seconds of flight works well, I don’t touche anything and the drone suddenly begin to climbs. It seems my throttle is very sensitive

I’m a little bit freaked out, I don’t really know what to do :roll_eyes:

BIN file
another BIN file with same issue

If we look in CTUN.DAlt and CTUN.Alt I don’t like what I see, Alt is not linear as DAlt this is not smoth as here

Should I reduced PSC_POSZ_P and PSC_VELZ_P. by 50% as described here

1st try lowering MOT_SPIN_MIN and lower MOT_SPIN_ARM below that. Currently it’s higher.

I don’t think the internal compass will work for you whether you do a Compass Mot procedure or not.

Ok thanks I’ll try it. But a better compass help to improve AltHold? It’s not only the accelerometer and the baro ?
But a better compass should improve my error about ekf primary that’s right?

No, I don’t think it has anything to do with the AltHold problem. That’s most likely just tuning. You should set Rate P&I equal as @Allister suggested.

Hopefully yes unless it’s also a combined problem with your tracking camera and the general position estimate is bad. Not sure about this though not having experience with those cameras.

Why are you not using EK3?

Yep this is not the case ? Beceause when I’m going in Extended tuning in Rate Roll and Rate Pitch I have the same values,
are we talking about the same thing?

Fot the camera it will be very good it’s work well I very satisfy with it.

Hmm I don’t know good question I’ll use it I think this is better. I’ve maybe followed a outdated tutorial

This is what I see:
Same for Roll

I think so. But even the setting for EK2 in the Wiki are not configured correctly. Set it up for EK3 from here:

1 Like

yep thanks a lot for your help @dkemxr. For now I have removed my t265 I’m focus on AltHold I want a good AltHold. So right now I think I’ll search an other tutorial to configure good enough EKF3. I thought EKF3 was only use for GPS/Odometry flight :blush:

I’ve followed all of your advices this morning and this is better really better thanks to you @Allister and @dkemxr. My AltHold is much better I think I need to update again my pid but in log file this is better, desired alt and alt are almost the same :slight_smile: just little oscillation again but I think this is just pid tuning
And I have add EKF3. So I added my bin file if you want to look if you see something wrong in my configuration. I ordered a GY271 to add an external compass
my bin

1 Like