# Quad drifts randomly in Position Hold PX4

**URL:** <https://discuss.px4.io/t/quad-drifts-randomly-in-position-hold-px4/48559>\
**Category:** PX4 Autopilot\
**Created:** [February 26, 2026, 11:07am UTC](https://discuss.px4.io/t/quad-drifts-randomly-in-position-hold-px4/48559 "2026-02-26T11:07:03Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![Aijaz\_meEr](https://discuss.px4.io/user_avatar/discuss.px4.io/aijaz_meer/32/20935_2.png) [@Aijaz\_meEr](https://discuss.px4.io/u/Aijaz_meEr)\
**Post date:** [February 26, 2026, 11:07am UTC](https://discuss.px4.io/t/quad-drifts-randomly-in-position-hold-px4/48559/1 "2026-02-26T11:07:03Z")

</div>

Hello everyone,

When switching my quadcopter to **Position Hold** , the vehicle starts drifting away in a **random direction** instead of maintaining its position. This issue occurs consistently on **PX4 firmware** using a Cube Orange+. GPS lock is available before takeoff, compass calibration has been performed (both internal and external tested), and manual flight modes are stable. The drift begins immediately after engaging Position Hold, and the direction is not consistent between flights. Flight logs can be provided if required.

Logs: [https://drive.google.com/drive/folders/1\_OmhIa0NdYwwY2kl5\_cZIxRWhUvxwusv?ths=true](https://drive.google.com/drive/folders/1_OmhIa0NdYwwY2kl5_cZIxRWhUvxwusv?ths=true)

**If anyone can provide insights or help, it would be very helpful.**

---

<div class="post-metadata">

**Author:** ![donpournelle](https://discuss.px4.io/letter_avatar_proxy/v4/letter/d/e47c2d/32.png) [@donpournelle](https://discuss.px4.io/u/donpournelle)\
**Post date:** [February 27, 2026, 4:50am UTC](https://discuss.px4.io/t/quad-drifts-randomly-in-position-hold-px4/48559/2 "2026-02-27T04:50:52Z")

</div>

Maybe this is the same problem:

> [@Drone stability (drifting)](https://discuss.px4.io/t/drone-stability-drifting/48487):
>
> Greetings community, I am currently in the middle of my first drone (quadcopter) project, and I am looking for an expert opinion on whether everything is as it should be. After searching the internet, I chose the components and put everything together. I managed to make my first flights (and crashes). What bothers me is the constant drifting of the drone. When I release the roll/pitch command, the drone starts drifting in a random direction. I say random because the drift direction is not con…

Possibly a PX4 parameter problem:  
As I’ve said to him (twice)  
My simulations conclusively show that random  
drift can be caused by bad PID tuning.  
What parameters? I dont know. I changed too many of them.

---

<div class="post-metadata">

**Author:** ![sibujacob](https://discuss.px4.io/user_avatar/discuss.px4.io/sibujacob/32/9673_2.png) [@sibujacob](https://discuss.px4.io/u/sibujacob)\
**Post date:** [February 27, 2026, 1:34pm UTC](https://discuss.px4.io/t/quad-drifts-randomly-in-position-hold-px4/48559/3 "2026-02-27T13:34:57Z")

</div>

Hi,

How did you do the PID tuning. Was it in Automode. Also what is your PX4 version

---

<div class="post-metadata">

**Author:** ![donpournelle](https://discuss.px4.io/letter_avatar_proxy/v4/letter/d/e47c2d/32.png) [@donpournelle](https://discuss.px4.io/u/donpournelle)\
**Post date:** [February 27, 2026, 11:21pm UTC](https://discuss.px4.io/t/quad-drifts-randomly-in-position-hold-px4/48559/4 "2026-02-27T23:21:12Z")

</div>

Hi,  
If you follow the conversation links you will find a FlightReview log I have published and some description of my custom vehicle and custom PX4 version and parameters. PID tuning was by painful trial-and-error. If you read these you can see that the vehicle is very unusual, and you can see in the log that I have consequently arrived a very unusual set of PX4 parameters. I would be amazed if AutoTuning could find that.

---

<div class="post-metadata">

**Author:** ![Aijaz\_meEr](https://discuss.px4.io/user_avatar/discuss.px4.io/aijaz_meer/32/20935_2.png) [@Aijaz\_meEr](https://discuss.px4.io/u/Aijaz_meEr)\
**Post date:** [February 28, 2026, 11:30am UTC](https://discuss.px4.io/t/quad-drifts-randomly-in-position-hold-px4/48559/5 "2026-02-28T11:30:19Z")

</div>

Hi,

I have performed autotune in Altitude Hold mode, and the system behavior is good in non-GPS mode.

I am using PX4 version 1.16.1.

I am wondering whether the default parameters are correct, as there is only one H-frame option available: Airframe: BetaFPV Beta75X 2S Brushless Whoop, Quadrotor H.

---

<div class="post-metadata">

**Author:** ![sibujacob](https://discuss.px4.io/user_avatar/discuss.px4.io/sibujacob/32/9673_2.png) [@sibujacob](https://discuss.px4.io/u/sibujacob)\
**Post date:** [February 28, 2026, 12:13pm UTC](https://discuss.px4.io/t/quad-drifts-randomly-in-position-hold-px4/48559/6 "2026-02-28T12:13:23Z")

</div>

Dont use v1.16.x. use Px4 v1.15.4 or v1.15.2

---

<div class="post-metadata">

**Author:** ![Aijaz\_meEr](https://discuss.px4.io/user_avatar/discuss.px4.io/aijaz_meer/32/20935_2.png) [@Aijaz\_meEr](https://discuss.px4.io/u/Aijaz_meEr)\
**Post date:** [March 6, 2026, 7:21am UTC](https://discuss.px4.io/t/quad-drifts-randomly-in-position-hold-px4/48559/7 "2026-03-06T07:21:57Z")

</div>

I have tested on PX4 v1.15.4 as well, but the result is the same. I am not sure why this is happening, and I am new to PX4.

log file:[log file - Google Drive](https://drive.google.com/drive/folders/1_OmhIa0NdYwwY2kl5_cZIxRWhUvxwusv)

---

<div class="post-metadata">

**Author:** ![sibujacob](https://discuss.px4.io/user_avatar/discuss.px4.io/sibujacob/32/9673_2.png) [@sibujacob](https://discuss.px4.io/u/sibujacob)\
**Post date:** [March 6, 2026, 8:58am UTC](https://discuss.px4.io/t/quad-drifts-randomly-in-position-hold-px4/48559/8 "2026-03-06T08:58:45Z")

</div>

Now check if there is any loose arms which mounts the motor and propeller. Check if the GPS is mounted firmly without any vibration . Again do a Autotune for PID. Do not try to manually tune PID . Unlike Ardupilot , Px4 is quite capable of handling PID tuning well in Auto mode. Do the Autotune in Altitude mode and not in position mode.

---

<div class="post-metadata">

**Author:** ![Aijaz\_meEr](https://discuss.px4.io/user_avatar/discuss.px4.io/aijaz_meer/32/20935_2.png) [@Aijaz\_meEr](https://discuss.px4.io/u/Aijaz_meEr)\
**Post date:** [March 7, 2026, 7:31am UTC](https://discuss.px4.io/t/quad-drifts-randomly-in-position-hold-px4/48559/9 "2026-03-07T07:31:41Z")

</div>

There are no loose propellers or motors, and the GPS module is mounted firmly. Initially, I tried flying using the internal compass, but I encountered random drifting issues. I then switched to the external compass; however, the issue still persists.

The GPS is mounted on a stand more than 10 cm above the frame, so I am not sure why this is happening. I have also shared the log file for your reference.

Additionally, I receive a **“Disabling Compass”** message in QGC when switching to Position Hold mode but system is flying stable on Altitude hold mode.

---

<div class="post-metadata">

**Author:** ![sibujacob](https://discuss.px4.io/user_avatar/discuss.px4.io/sibujacob/32/9673_2.png) [@sibujacob](https://discuss.px4.io/u/sibujacob)\
**Post date:** [March 7, 2026, 7:46am UTC](https://discuss.px4.io/t/quad-drifts-randomly-in-position-hold-px4/48559/10 "2026-03-07T07:46:52Z")

</div>

I realize that you are having a cube orange + f.c. Never use the internal compass of the orange cube + . Kindly disable this and again recalibrate the whole drone , autotune and check.

---

<div class="post-metadata">

**Author:** ![Aijaz\_meEr](https://discuss.px4.io/user_avatar/discuss.px4.io/aijaz_meer/32/20935_2.png) [@Aijaz\_meEr](https://discuss.px4.io/u/Aijaz_meEr)\
**Post date:** [March 7, 2026, 9:17am UTC](https://discuss.px4.io/t/quad-drifts-randomly-in-position-hold-px4/48559/11 "2026-03-07T09:17:44Z")

</div>

Yes, I did that as well, but no luck. I am currently trying IMU temperature calibration and will check again.

---

<div class="post-metadata">

**Author:** ![emarcphera](https://discuss.px4.io/user_avatar/discuss.px4.io/emarcphera/32/21146_2.png) [@emarcphera](https://discuss.px4.io/u/emarcphera)\
**Post date:** [March 8, 2026, 10:17am UTC](https://discuss.px4.io/t/quad-drifts-randomly-in-position-hold-px4/48559/12 "2026-03-08T10:17:13Z")

</div>

Hi, I think it’s a mix of different problems, but for your flights on:  
25-02-2026  
it looks like the cube’s internal compass was being used for these flights such as this log:

> **[Flight Review](https://logs.px4.io/plot_app?log=2e2625f6-38dc-4f04-8247-f1e0ce5ad82f)**

its a bit hard to tell which compass is which, so I might also have it in reverse, but In this flight log your compass was likely suffering from emi, if its the external compass (im assuming you have a gps/compass module), make sure its mounted as far away from esc/motor lines and power supply lines. If the compass used in this log was the internal compass then that plot makes sense, always disable the internal compass. Putting the log in plot juggler we can see that the compass with device id 592929 was being used, if im decoding it right this corresponds to AK09916, the cubes internal compass. CAL\_MAG1\_ID param in this log is 592929 and CAL\_MAG1\_PRIO is 75, set it to 0, this should disable it from being used. CAL\_MAG0\_ID is 467729, this should correspond to RM3100, likely your external compass. in this log, and other logs,CAL\_MAG0\_PRIO is -1, set it higher than compass 1.

 ![image](https://discuss.px4.io/uploads/default/original/3X/c/8/c8330734381381ee045c9d0dcf9f84f31da376f8.png)

But looking at your recent flights on 05-03-2026 such as:

> **[Flight Review](https://logs.px4.io/plot_app?log=54b563f4-83d5-40c0-b14a-43589e3de0e0)**

 ![image](https://discuss.px4.io/uploads/default/original/3X/7/f/7f70882e178d52086c250b4e1ab8d62e44ed62c8.png)

The external compass is being used, which would explain a better thrust and magnetic field, though the spike at the end is a bit weird to me. Make sure the gps/compass module is not close to power regulators, esc/motor lines, power supply lines etc. also i noticed CAL\_MAG0\_ROT is 12, this is weird to me as usually the external compass is mounted facing in the direction of flight, most gps/compass modules have an arrow telling you the rotation of the compass, if it’s pointed in the direction of flight then CAL\_MAG0\_ROT should be 0.  
Here’s an example:

 ![image](https://discuss.px4.io/uploads/default/original/3X/6/7/67600172df0e36265460c5bb11cc339895a845d6.jpeg)

I also noticed in all of your flights, you have one imu that is experiencing significantly less vibration when looking at the vibration metrics, accel 2, it looks like this is the body fixed imu on the cube, i had a similar experience where the cube’s body fixed imu was performing significantly better on my frame, and I made it so that imu was prioritized instead which resulted in better flight. I recommend taking a look at these parameters: CAL\_ACC0\_PRIO, CAL\_ACC1\_PRIO, CAL\_ACC2\_PRIO, and CAL\_GYRO0\_PRIO, CAL\_GYRO1\_PRIO, CAL\_GYRO2\_PRIO.  
In your logs they’re all at 50, set CAL\_ACC2\_PRIO and CAL\_GYRO2\_PRIO to max or 75.  
I think you should revert the the autotune that was applied, unless you did it when vibration was fine. But I think your main issue is something to do with the compass, wrong rotations such as CAL\_MAG0\_ROT and SENS\_BOARD\_ROT, bad calibration etc, yaw related issues would be less prominent in modes like altitude mode because there isn’t heading hold, you control it manually. Heading issues would show up in modes like position mode because heading needs to be accurate in order for the drone to hold it’s heading correctly.

---

<div class="post-metadata">

**Author:** ![Aijaz\_meEr](https://discuss.px4.io/user_avatar/discuss.px4.io/aijaz_meer/32/20935_2.png) [@Aijaz\_meEr](https://discuss.px4.io/u/Aijaz_meEr)\
**Post date:** [March 9, 2026, 4:41pm UTC](https://discuss.px4.io/t/quad-drifts-randomly-in-position-hold-px4/48559/13 "2026-03-09T16:41:25Z")

</div>

I am using an in-house PCB that has a **u-blox GPS** and an **RM3100 compass**. During compass calibration, it automatically detects **SENS\_BOARD\_ROT as Pitch 180°**. I have verified this in **ArduPilot** , and the drone flies well there.

I also tried setting **CAL\_ACC2\_PRIO** and **CAL\_GYRO2\_PRIO** to **High (75)**, but I do not see any improvement.

Log files: [Log file - Google Drive](https://drive.google.com/drive/folders/1dCJy9a-YzXXIX--8R63N2mfCy1RBD3nQ)

---

<div class="post-metadata">

**Author:** ![emarcphera](https://discuss.px4.io/user_avatar/discuss.px4.io/emarcphera/32/21146_2.png) [@emarcphera](https://discuss.px4.io/u/emarcphera)\
**Post date:** [March 9, 2026, 8:15pm UTC](https://discuss.px4.io/t/quad-drifts-randomly-in-position-hold-px4/48559/14 "2026-03-09T20:15:26Z")

</div>

Hi, i think you meant CAL\_MAG0\_ROT as Pitch 180 right? If the orientations are detected correctly during the compass calibration routine then your rotation parameters are most likely correct, especially if it works in ardupilot. I did notice after setting CAL\_ACC2\_PRIO and CAL\_GYRO2\_PRIO to High , the post filtered gyro and accel values do look better to me, and consistent with moments in your previous flights where the estimator had this imu selected, these are good inputs for the estimator to have in general. I’ve never personally used ardupilot, but i’m assuming you chose frame class as quad and frame type as 3, i did skim through ardupilot’s src code and it’s setup for this configuration looks more simple than the H-frame config in PX4:  
snippet in ardupilot’s AP\_MotorsMatrix.cpp:

 ![image](https://discuss.px4.io/uploads/default/original/3X/a/3/a3f23bceca4d3aa9c5fd2b01218f9650ba223b5a.png)

I could be missing something but it looks like this is all ardupilot does.  
The H-frame config for px4 that you chose looks to be vehicle-specific  
possibly this:

> **[Beta75X Whoop Quadcopter (2S 12A ESC)](https://betafpv.com/products/beta75x-2s-whoop-quadcopter?srsltid=AfmBOopeptA0q1afQXv9HO6EYyjVZpFkL7wyn6wanD60C3VcFkJ6Cpo7)**
>
> We are sorry to announce that Beta75X (12A ESC) is discontinued and will not be available for sales anymore. We recommend you buy its great alternative Beta75X HD Digital VTX. USA frequency table below. The frequency in red item is invalid. This is a...

this is what happens when you choose BetaFPV Beta75X 2S Brushless Whoop, Quadrotor H:  
snippet from ROMFS/px4fmu\_common/init.d/airframes/4041\_beta75x:

# @name BetaFPV Beta75X 2S Brushless Whoop

param set-default CBRK\_SUPPLY\_CHK 894281

param set-default IMU\_GYRO\_CUTOFF 100

par@namem set-default IMU\_DGYRO\_CUTOFF 60

param set-default MC\_AIRMODE 2

param set-default MC\_PITCHRATE\_D 0.001

param set-default MC\_PITCHRATE\_I 0.5

param set-default MC\_PITCHRATE\_MAX 600

param set-default MC\_PITCHRATE\_P 0.075

param set-default MC\_PITCH\_P 6

param set-default MC\_ROLLRATE\_D 0.001

param set-default MC\_ROLLRATE\_I 0.4

param set-default MC\_ROLLRATE\_MAX 600

param set-default MC\_ROLLRATE\_P 0.075

param set-default MC\_YAWRATE\_I 0.3

param set-default MC\_YAWRATE\_MAX 400

param set-default MC\_YAWRATE\_P 0.12

param set-default MC\_YAW\_P 4

param set-default MPC\_MANTHR\_MIN 0

param set-default MPC\_MAN\_TILT\_MAX 60

param set-default SYS\_HAS\_BARO 0

param set-default SYS\_HAS\_MAG 0

param set-default BAT1\_N\_CELLS 2

# Square quadrotor X with reverse turn direction

param set-default CA\_ROTOR\_COUNT 4

param set-default CA\_ROTOR0\_PX 1

param set-default CA\_ROTOR0\_PY 1

param set-default CA\_ROTOR0\_KM -0.05

param set-default CA\_ROTOR1\_PX -1

param set-default CA\_ROTOR1\_PY -1

param set-default CA\_ROTOR1\_KM -0.05

param set-default CA\_ROTOR2\_PX 1

param set-default CA\_ROTOR2\_PY -1

param set-default CA\_ROTOR3\_PX -1

param set-default CA\_ROTOR3\_PY 1

param set-default PWM\_MAIN\_FUNC1 104

param set-default PWM\_MAIN\_FUNC2 101

param set-default PWM\_MAIN\_FUNC3 102

param set-default PWM\_MAIN\_FUNC4 103

But when I download your current parameters, it looks like you’ve already changed most of the parameters that the config defaults, I would compare your current param settings with the default params above. In your logs, your rate tracking does look bad, my new theory is that it’s likely bad tuning from an incorrect baseline configuration. It could explain why in some flights you got compass errors (when external compass was used), gnss fusion stopped, etc. Bad tuning would cause unpredictable motion that could spike ekf innovations and possibly result in that. This could also explain why ardupilot is fine, it’s baseline configuration for H-Frame looks to be much more simple, and your tuning from that point was correct. I think it might be worth to try starting from scratch (reset tuning parameters etc or even a complete reset). You could probably try quadrotor X configuration, and tune from there as this is what it does:

# Square quadrotor X PX4 numbering

param set-default CA\_ROTOR\_COUNT 4

param set-default CA\_ROTOR0\_PX 1

param set-default CA\_ROTOR0\_PY 1

param set-default CA\_ROTOR1\_PX -1

param set-default CA\_ROTOR1\_PY -1

param set-default CA\_ROTOR2\_PX 1

param set-default CA\_ROTOR2\_PY -1

param set-default CA\_ROTOR2\_KM -0.05

param set-default CA\_ROTOR3\_PX -1

param set-default CA\_ROTOR3\_PY 1

param set-default CA\_ROTOR3\_KM -0.05

you can probably copy the Betafpv H-Frame CA\_ROTOR params if you need it.

---

<div class="post-metadata">

**Author:** ![Aijaz\_meEr](https://discuss.px4.io/user_avatar/discuss.px4.io/aijaz_meer/32/20935_2.png) [@Aijaz\_meEr](https://discuss.px4.io/u/Aijaz_meEr)\
**Post date:** [March 10, 2026, 5:04pm UTC](https://discuss.px4.io/t/quad-drifts-randomly-in-position-hold-px4/48559/15 "2026-03-10T17:04:54Z")

</div>

Hy @emarcphera

Today, I switched from an H-frame to an X-frame and reset all parameters to their default values, but I still encountered the same issue. I also set the external compass as the primary sensor and set **CAL\_ACC2\_PRIO** and **CAL\_GYRO2\_PRIO** to **High (75)**, but this did not improve the behavior.

I have attached today’s log files and the frame photo in the link below for reference.

Log file; [log\_file\_10\_03 - Google Drive](https://drive.google.com/drive/folders/1fmTAiETBQQLjTbmd61h6QGqNjprTMVUu)

---

<div class="post-metadata">

**Author:** ![system](https://discuss.px4.io/uploads/default/original/3X/7/3/73ce918bdcd64854de904f0c8d9ab70ca9723f2a.png) [@system](https://discuss.px4.io/u/system)\
**Post date:** [June 8, 2026, 5:05pm UTC](https://discuss.px4.io/t/quad-drifts-randomly-in-position-hold-px4/48559/16 "2026-06-08T17:05:30Z")

</div>

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.
