# Sensor Orientation

By default the flight controller (and external compass(es), if present) should be placed on the frame top-side up, oriented so that the arrow points towards the front of the vehicle. If the board or an external compass are mounted in any other orientation then you will need configure this in the firmware.

## Calculating Orientation

ROLL, PITCH and/or YAW offsets of the flight controller are calculated relative to the vehicle around the forward (x), right (y), down (z) axes.

![Frame Heading](https://4155462212-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LArEa7z2SPawfl3HpCD%2Fuploads%2Fgit-blob-876dc871bd8e4bf6a90e52519d87d9a6cf6833b8%2Fframe_heading.png?alt=media)

The axes to rotate around stay the same from one rotation step to the next one. So the frame to perform the rotation in stays fixed. This is also known as *extrinsic rotation*.

![](https://4155462212-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LArEa7z2SPawfl3HpCD%2Fuploads%2Fgit-blob-e68cafc8b3edb2ca9a79c6cd3ba179a9b91accb0%2Ffc_orientation_1.png?alt=media)

For example, the vehicles shown below have rotations around the z-axis (i.e. yaw only) corresponding to: `ROTATION_NONE`, `ROTATION_YAW_90`,`ROTATION_YAW_180`,`ROTATION_YAW_270`.

![Yaw Rotation](https://4155462212-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LArEa7z2SPawfl3HpCD%2Fuploads%2Fgit-blob-2464a5527e62c74271391d6cf37c0635d2a1c12b%2Fyaw_rotation.png?alt=media)

:::note For a VTOL Tailsitter airframe set the vehicle orientation according to its multirotor configuration (i.e. relative to the vehicle during, takeoff, hovering, landing) for all sensor calibrations.

The axis are normally relative to the orientation of the vehicle during steady forward flight. For more information see [Basic Concepts](https://px4.gitbook.io/px4-user-guide/getting_started/px4_basic_concepts#heading-and-directions). :::

## Setting the Orientation

To set the orientations:

1. Start *QGroundControl* and connect the vehicle.
2. Select the **Gear** icon (Vehicle Setup) in the top toolbar and then **Sensors** in the sidebar.
3. Select the **Set Orientations** button.

   ![](https://4155462212-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LArEa7z2SPawfl3HpCD%2Fuploads%2Fgit-blob-74928dfebcab37da6b2692b8a9755069d48b9891%2Fsensor_orientation_set_orientations.jpg?alt=media)
4. Select the **AutoPilot Orientation** (as [calculated above](#calculating-orientation)).

   ![](https://4155462212-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LArEa7z2SPawfl3HpCD%2Fuploads%2Fgit-blob-698feafb0f6d712585985f3b23a27f2b0a6c64bd%2Fsensor_orientation_selector_values.jpg?alt=media)
5. Select the **External Compass Orientation** in the same way (this option will only be displayed if your vehicle has an external compass).
6. Press **OK**.

## Fine Tuning

You can use [Level Horizon Calibration](https://px4.gitbook.io/px4-user-guide/config/level_horizon_calibration) to compensate for small miss-alignments in controller orientation and to level the horizon in flight view.

## Further Information

* [Advanced Orientation Tuning](https://px4.gitbook.io/px4-user-guide/advanced_config/advanced_flight_controller_orientation_leveling) (advanced users only).
* [QGroundControl User Guide > Sensors](https://docs.qgroundcontrol.com/master/en/SetupView/sensors_px4.html#flight_controller_orientation)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://px4.gitbook.io/px4-user-guide/config/flight_controller_orientation.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
