# Heading drift in acceleration mode in gz sim

**URL:** <https://discuss.px4.io/t/heading-drift-in-acceleration-mode-in-gz-sim/49452>\
**Category:** PX4 Autopilot\
**Created:** [September 3, 2026, 4:26pm UTC](https://discuss.px4.io/t/heading-drift-in-acceleration-mode-in-gz-sim/49452 "2026-09-03T16:26:33Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![dev](https://discuss.px4.io/letter_avatar_proxy/v4/letter/d/e8c25b/32.png) [@dev](https://discuss.px4.io/u/dev)\
**Post date:** [September 3, 2026, 4:26pm UTC](https://discuss.px4.io/t/heading-drift-in-acceleration-mode-in-gz-sim/49452/1 "2026-09-03T16:26:33Z")

</div>

Running make px4\_sitl gz\_x500

Using the offboard control in mavsdk and setting an acceleration setpoint of just 5 north and 0 down and 0 east, the drone heads in the correct direction but the heading drifts anticlockwise. Does anyone know how to fix this?

---

<div class="post-metadata">

**Author:** ![yigitcan-ozturk](https://discuss.px4.io/user_avatar/discuss.px4.io/yigitcan-ozturk/32/22039_2.png) [@yigitcan-ozturk](https://discuss.px4.io/u/yigitcan-ozturk)\
**Post date:** [October 3, 2026, 4:29pm UTC](https://discuss.px4.io/t/heading-drift-in-acceleration-mode-in-gz-sim/49452/2 "2026-10-03T16:29:28Z")

</div>

I would first separate the translational command from the yaw control path.

An acceleration setpoint of `(North=5, East=0, Down=0)` defines the desired translational acceleration, but it does not by itself necessarily define the vehicle heading.

I’d log/inspect:

**commanded acceleration → yaw/yaw-rate setpoint → vehicle yaw → yaw-rate → actuator/control response**

In particular, check what MAVSDK is actually sending for the yaw/yaw-rate field with your acceleration command. If heading is expected to remain fixed, make that yaw behaviour explicit rather than assuming the acceleration vector constrains it.

A useful isolation test would be:

1. hover and hold an explicit fixed yaw;
2. apply the same north acceleration;
3. check whether the yaw setpoint remains constant while the measured yaw begins drifting.

If the **yaw setpoint itself moves** , investigate the Offboard/MAVSDK command path. If the setpoint remains fixed but **vehicle yaw diverges from it** , then move downstream into the PX4 attitude/rate controller and simulator dynamics.

A short ULog from this minimal test would make the distinction very clear.
