# Mounting the GPS/Compass

GPS/Compasses should be mounted on the frame as far away from other electronics as possible, with the direction marker pointing towards the front of the vehicle. If mounted in this way you can immediately proceed to [compass calibration](https://px4.gitbook.io/px4-user-guide/config/compass#performing-the-calibration).

The diagram below shows the heading marker on the Pixhawk 4 and compass.

![Connect compass/GPS to Pixhawk 4](https://4155462212-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LArEa7z2SPawfl3HpCD%2Fuploads%2Fgit-blob-8d6be4177e8fdd5d1a2a19e98a989decd118bb1c%2Fpixhawk4_compass_gps.jpg?alt=media)

## Compass Orientation

The compass can be mounted in any of the standard MAVLink orientations defined in [MAV\_SENSOR\_ORIENTATION](https://mavlink.io/en/messages/common.html#MAV_SENSOR_ORIENTATION). The orientation follows the same frame convention as when [orienting the flight controller](https://px4.gitbook.io/px4-user-guide/config/flight_controller_orientation#calculating-orientation).

If you're using the normal [Compass Calibration](https://px4.gitbook.io/px4-user-guide/config/compass) process (with parameter [SENS\_MAG\_AUTOROT](https://px4.gitbook.io/px4-user-guide/advanced_config/parameter_reference#SENS_MAG_AUTOROT) enabled), the orientation should be detected automatically. Otherwise you can directly select the appropriate value in [CAL\_MAGn\_ROT](https://px4.gitbook.io/px4-user-guide/advanced_config/parameter_reference#CAL_MAG1_ROT) for up to three compasses.

:::warning You must mount the compass in a supported orientation!

If you mount the compass at an orientation that isn't supported, for example `Yaw 30`, PX4 will detect the closest supported value. This will result in errors/warnings, even if the calibration appeared to succeed. :::


---

# 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/assembly/mount_gps_compass.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.
