Pixhawk 6X (v1.17.0): horizontal drift in Altitude and Stabilised mode

Hi all,

I am testing an X500 V2 indoors and outdoors and have a repeatable difference between modes that I would like help understanding, plus a Level Horizon calibration that will not converge.

Setup: Pixhawk 6X, PX4 v1.17.0 (ver_sw_release 17891583) in Holybro X500 V2 frame

What I observe:

Altitude mode: altitude is held correctly with respect to the throttle stick, but the vehicle drifts horizontally and does not stop.(both indoors and outdoors)

Stabilized mode: altitude is not maintained — it sinks. Over 5 Stabilized segments mean vz is +0.064 m/s (descending) and mean altitude change −0.71 m, versus Altitude mode at vz −0.008 m/s and +0.32 m.(both indoors and outdoors)

Position mode is stable at outdoors, since indoors GPS do not get the fix.

For magnitude reference, hands-off drift rates measured on earlier sessions of the same airframe that did have a GPS fix (sticks centred, airborne, xy_valid 100%, dead_reckoning 0%, segments ≥3 s):

Altitude mode is ~15x worse than Position on the same airframe.

Effect of Level Horizon accuracy:

I have two videos showing the difference.

  1. With a good level horizon calibration value takeoff is vertical and clean, and drift is present but slow.

    stable_levelhorizon

  2. With an incorrect level horizon calibration value (each time it will vary during calibration, observation is explained below in the specific section)takeoff is unstable, it departs horizontally, and the drift is much faster.

    VID-20261021-WA0002 (1)

The logs confirm it — peak tilt and peak body rate in the first 6 s after takeoff:

What I have already checked:

  • Residual tilt correlates with drift rate (r = 0.75, n = 7), but does not explain the magnitude: at 0.11° residual, g·tan(0.11°) = 0.019 m/s² predicts 0.24 m over 5.1 s, while 2.01 m was measured (~8x). On another segment observed acceleration was 0.338 m/s² versus 0.082 m/s² implied by attitude (4.1x), with xy_valid 100% and GPS velocity innovations of only 0.05–0.08 m/s.
  • From FlightTaskManualAltitude.cpp, Altitude and Stabilized have no horizontal position or velocity hold by design — the task writes only _acceleration_setpoint.xy() and never sets _position_setpoint(0/1) or _velocity_setpoint(0/1). My logs confirm those setpoints are non-finite 100% of the time. So I expect coasting; my question is the magnitude and what else contributes.
  • Drift bearings have a circular mean of 41° with concentration R = 0.49, i.e. a loose directional preference rather than a fixed bias.
  • hover_thrust_estimate measures 0.536 while MPC_THR_HOVER is set to 0.5. In the Stabilized segments the throttle stick averaged 0.414 on the 0–1 scale, below the 0.536 needed to hover, so the sink may be stick position combined with the 0.5 vs 0.536 mismatch rather than a mode fault.

Questions

  1. What are the contributing factors to horizontal drift in Altitude and Stabilized mode specifically, when Position mode is stable on the same airframe? Beyond residual level-calibration error, what else should I look at — IMU/accel bias, thrust-curve linearity, motor/ESC mismatch, CG offset, indoor recirculation?
  2. Is ~0.5 m/s hands-off drift acceptable for Altitude mode on a correctly calibrated multirotor, or does it indicate a fault worth chasing?
  3. Are there parameters I should tune or modify to reduce the drift and make the vehicle stable in both Altitude and Stabilized mode? I have already set MPC_MAN_TILT_MAX 20. Would THR_MDL_FAC, MPC_MANTHR_MIN, MPC_VELD_LP or the rate-loop gains be relevant?
  4. For the Stabilized sink: should MPC_THR_HOVER be set to the measured hover_thrust_estimate of 0.536 instead of 0.5? Does MPC_USE_HTE 1 affect manual-throttle modes at all, or only the position controller? Is a mid-stick sink expected whenever MPC_THR_HOVER is below the true hover thrust?
  5. Level Calibration at bench gives different value each time, why is it so?

Separate concern: Level Horizon does not converge

Each time doing level calibration in QGC it drifts the level horizon (i.e., SENS_BOARD_OFFESTS)

Bench test, bare board on the surface, never armed, never airborne, stationary (peak gyro 4.3 deg/s), SDLOG_MODE 2, 155 s, 13 Level Horizon runs back-to-back in QGC about 10 s apart, no reboot, board untouched. Values taken from PX4’s own Updating SENS_BOARD_* log messages:

It took 12 runs to settle. Spread: X_OFF 2.46°, Y_OFF 8.76° (−0.28° to +10.49°). A 10.5° offset is not physically possible for a board lying flat on a bench, so this is not a mounting problem.

The values do not wander randomly — they oscillate and overshoot. Y_OFF: 1.7 → 7.5 → 10.5 → 6.9 → 3.9 → 2.9 → 7.2 → 10.3 → 7.2 → 6.0 → 6.9 → 6.83 → 6.78. The estimated pitch swings with it (+5.8°, +0.3°, −3.7°, +1.5°, +3.4°, −1.9°, finally −0.01°) while the board is physically motionless.

In level_calibration.cpp the calibration is incremental — it samples the estimated attitude (vehicle_attitude, i.e. EKF output, not raw accel) for only 500 ms, subtracts the existing offset, and writes the result, with no wait for the EKF to re-converge:

Logs attached:

  1. https://logs.px4.io/plot_app?log=db2699f3-5d27-4029-ad1c-05de3e1875c0 bench test, bare board on the surface, never armed. Contains all 13 consecutive Level Horizon calibrations, which gave different value of SENS_BOARD_OFFEST_X and Y.
  2. https://logs.px4.io/plot_app?log=cf87e535-5e53-4254-bf9f-7f24082b2105— good level horizon calibration value. Pre-takeoff residual tilt 0.00°, peak tilt 1.3°, peak body rate 9 deg/s. This is the clean vertical takeoff in my first video.
  3. https://logs.px4.io/plot_app?log=079ad835-fc28-4d8a-8d11-6ee3e94d1377 — incorrect level horizon calibration value . Pre-takeoff residual tilt 3.27°, peak tilt 16.6°, peak body rate 313 deg/s. This is the unstable takeoff in my second video.
  4. https://logs.px4.io/plot_app?log=dea31054-2717-4fd8-80ac-4e7959e50c46— Stabilized mode altitude sink. Altitude change −2.10 m, mean vz +0.125 m/s (descending).
  5. https://logs.px4.io/plot_app?log=1302bc3e-4005-4652-8779-fccec23409d5— Stabilized sink confirmation. Altitude change −1.09 m, mean vz +0.178 m/s. Also ends with a kill switch.

Thanks in advance!

Hi Rathi,

Thank you for the detailed measurements and for separating the horizontal drift, Stabilized-mode descent, and Level Horizon calibration behaviour.

I checked src/modules/commander/level_calibration.cpp in PX4 v1.17.0. I think the Level Horizon repeatability issue deserves priority because it could affect the interpretation of the subsequent flight tests.

The implementation uses vehicle_attitude rather than raw accelerometer samples, collects attitude measurements over a 500 ms window, and checks motion primarily through the roll/pitch variation within that window.

I do not see an explicit estimator-settling stage after updating the board offsets.

This makes estimator convergence and calibration feedback worth investigating, although it does not yet establish the root cause of the oscillation you observed.

I would suggest three separate investigations.

1. Level Horizon calibration

For the bench log, align each calibration event with:

  • SENS_BOARD_X_OFF and SENS_BOARD_Y_OFF changes.

  • Estimated roll and pitch before and after each calibration.

  • Estimator status, innovation behaviour and any attitude resets.

  • IMU/accelerometer measurements and vibration indicators.

An important question is whether each calibration begins before the estimator has settled following the previous offset update.

A useful regression test would repeat Level Horizon calibration on a stationary simulated vehicle and check whether the resulting offsets converge consistently.

2. Altitude/Stabilized horizontal drift

Your observation that these modes do not command horizontal position or velocity hold is important.

Therefore, comparing their hands-off drift directly against Position mode does not establish a controller fault.

However, the difference between expected acceleration from residual tilt and measured horizontal displacement is worth investigating.

I would compare estimated horizontal velocity against independent position measurements where available, and examine actual attitude, thrust, wind/airflow, vehicle balance and motor behaviour.

I would avoid changing rate-loop gains or thrust-curve parameters until those contributions are better isolated.

3. Stabilized-mode descent

In Stabilized mode, throttle is manually commanded rather than being controlled by an altitude-hold loop.

The observed mean throttle value below the estimated hover thrust is consistent with descent, but the relationship between stick position and actual thrust depends on the configured throttle mapping.

I would not assume that changing MPC_THR_HOVER alone will eliminate the descent.

Before further flight testing, I would recommend restoring a verified calibration and confirming stable attitude estimation on the bench.

The 13-run Level Horizon dataset looks particularly useful for a focused upstream issue or regression test.

Best regards,
Yiğitcan Öztürk
PAMILANGA LIMITED