Level horizon not staying calibrated

Hi all,

I am using a Pixracer flight controller in a Spedix S250 quad. I am using PX4 version 1.5.0 and QGC version 3.0.2. The frame is set as a generic 250 racer.

For some reason, the level horizon will not stay level. When I go out and do test flights, the quad is always drifting to the left, and experiences oscillation on punch-outs. When I just plugged in the quad, I noticed that, on a level surface, the quad thinks that it is rolled slightly to the right.

I have tried to recalibrate the level horizon several times, any even tried to recelibrate the ESCs, but that did not help.

Does anyone know what exactly the problem is? Is my Pixracer just a little broken?

Thanks

ezra

Should I just try and recalibrate all of the sensors?

I just tried a flight test after recalibrating all of the sensors, but the problem persists.

Plugging it up after the test, the quad is not moving on the level surface it was just calibrated on, but the compass moved a little and the quad thinks that it’s not level.

@ezra After dong the level calibration and verifying that the horizon is level can you make a note of the parameters SENS_BOAR_ROT_X and SENS_BOARD_ROT_Y. Those are the ones defining the correction rotation. After rebooting the system check if they still are the same value. If that looks fine you may have some issue with some sensors. A log file would help.

@ezra Actually after reading your post for I second time I asked myself if the level horizon calibration works at all for you? After the calibration, does your HUD show perfectly level attitude?
BTW, the oscillations on punch-up has nothing to do with that, there is something implemented in the flight stack which could help you there. It’s called TPA or something like that an the expert to ask is @Mark_Whitehorn

After calibration, the HUD displays pretty level, but I think that it may have shifted up a little.

I could not find SENS_BOARD_ROT_X, but the SENS_BOARD_X_OFF reads 0.093 degrees in yellow font. The SENS_BOARD_Y_OFF reads 0.616 degrees, also in yellow font.

I unplugged and replugged the quad and the SENS_BOARD_Y_OFF and SENS_BOARD_X_OFF values remained the same.

I just took it out for a flight test and the values for the SENS_BOARD_Y_OFF and SENS_BOARD_X_OFF are the same, but the compass is drifting slightly and the level horizon is leaning off to the right on a level surface.

I am also having control lag at higher altitude (70-100ft) and random drift on the yaw axis. I am using Spektrum DX6 and a DSM2 satellite receiver. Are all of these issues connected somehow?

I just realized that I have had my transmitter trimmed 30 points to roll right, but that shouldn’t be affecting the quad’s level horizon.

@ezra If you are using ekf2 as state estimator then it could be that a bad mag setup gives you the attitude issues. In order to check this you can set EKF2_MAG_TYPE parameter to 1 which will only use the mag for correcting heading but not tilt. Can you please share a log, it’s really hard to speculate on something if you don’t have data.

http://logs.uaventure.com/view/MpTM8N8SNNAHEWyQgagnQ
Here’s a log in Log Muncher. This was a really short flight, I just armed, punched up, and came back down.

@ezra You have a very strong coupling between thrust and your magnetic field http://logs.uaventure.com/logmuncher/charts/MpTM8N8SNNAHEWyQgagnQ/Thrust.png

What exactly does that mean?

I looked in the parameters in QGC for EKF2_MAG_TYPE and what I found was EFK2_REC_RPL, which did something related to replaying the log. Under which parameter tab is EFK2_MAG_TYPE?

Opening the EFK2 tab, I only have the EFK2_REC_RPL parameter. On the devguide, it says that there are a whole lot of EFK2 parameters, including the EFK2_MAG_TYPE, but I don’t have any of them. I am not using a GPS module, just the Pixracer. Would that take away the EFK2 parameters?

Referring to my last comment. Probably the magnetometer you are using (internal or external) is affected by the magnetic field created by the current flowing through your wires or other sources. You should either use an external mag and place if far enough from any source of magnetic interference.

It seems like you are not using ekf2 but rather LPE (another state estimator). The parameter SYS_MC_EST_GROUP should tell you more about that.

I had a similar Problem with 1.5.1RC1 that after reconfiguring (since installing 1.5.1RC1 erased all config) I had the problem after powering on again that the horizon was not level. So I did a Level Calibration. To my surprise the Horizon was not level afterward (without moving the vehicle) but tilting to the other side. So I did it again. Resulting in horizon not being level again tilting to the first side again. Finally after 3 times the Horizon was level.

Still currently I don’t have too much confidence in the current Code/Config and the Horizon in particular.

If your config got reset and your horizon is not level you likely need to calibrate the sensors - just doing the horizon levelling will not fix it.

Of course I did a complete reconfiguration as RC / Flight Modes / Sensors were red in QGC.

I did the whole config yesterday. Today I wanted to try some other things and saw that the Horizon is a few degrees off (which can not only be explained with unlevel Surfaces yesterday or today).

Even if the Stand of the UAV was not level, why did I have to do it 3x in order to get a level Horizon? It was tilted in the roll axis left / right.