> For the complete documentation index, see [llms.txt](https://docs.arkelectron.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.arkelectron.com/products/gps/ark-rtk-gps/ardupilot-instructions.md).

# ArduPilot Instructions

## Firmware Setup

The ARK RTK GPS ships with PX4 CANnode firmware by default. For use with ArduPilot, we recommend flashing [AP\_Periph](https://ardupilot.org/dev/docs/ap-peripheral-landing-page.html) (ArduPilot Peripheral) firmware. AP\_Periph is the well-tested configuration for DroneCAN GPS modules with ArduPilot.

To flash it over CAN or with an ST-LINK, and to flash the AP\_Periph bootloader, see [Updating to AP\_Periph](/products/gps/ark-rtk-gps/firmware.md#updating-to-ap_periph).

***

## Single GPS Configuration

Connect the ARK RTK GPS to the autopilot's CAN port using a standard 4-pin JST-GH cable. Set the following parameters on the autopilot:

| Parameter         | Value | Description                 |
| ----------------- | ----- | --------------------------- |
| `CAN_P1_DRIVER`   | 1     | Enable CAN port 1 driver    |
| `CAN_D1_PROTOCOL` | 1     | Set protocol to DroneCAN    |
| `GPS1_TYPE`       | 9     | DroneCAN                    |
| `GPS_AUTO_CONFIG` | 2     | Auto-configure DroneCAN GPS |

{% hint style="info" %}
`GPS_AUTO_CONFIG=2` is correct here because the ARK RTK GPS runs AP\_Periph firmware, which supports ArduPilot's DroneCAN parameter auto-configuration. If your GPS module is not running AP\_Periph firmware, leave `GPS_AUTO_CONFIG` at its default value of 1 — setting it to 2 on non-AP\_Periph firmware will block GPS data.
{% endhint %}

Reboot the autopilot. The GPS should appear as a DroneCAN node and begin reporting position data.

***

## Dual GPS Heading Configuration

Two ARK RTK GPS modules can provide compass-free yaw estimation using the GPS moving baseline technique. This uses the relative position between two GPS antennas to determine heading, eliminating the need for a magnetometer.

{% hint style="info" %}
The L1L5 variant does **not** support moving baseline heading. For dual-GPS heading use the standard L1/L2 ARK RTK GPS, or see the [ARK G5 RTK Heading GPS](/products/gps/ark-g5-rtk-heading-gps.md) for a dual-antenna solution.
{% endhint %}

### Hardware Setup

* Connect both ARK RTK GPS modules to the same CAN bus using a CAN splitter
* Mount the antennas with a minimum of **30 cm separation** (more is better for heading accuracy)
* The antenna connected to GPS1 (base) should be positioned ahead of or to the side of GPS2 (rover) — the offset between them is configured in the parameters below

### Autopilot Parameters

#### EKF Configuration

| Parameter       | Value | Description                                  |
| --------------- | ----- | -------------------------------------------- |
| `AHRS_EKF_TYPE` | 3     | Use EKF3                                     |
| `EK2_ENABLE`    | 0     | Disable EKF2                                 |
| `EK3_ENABLE`    | 1     | Enable EKF3                                  |
| `EK3_SRC1_YAW`  | 2     | GPS yaw (or 3 for GPS with compass fallback) |

#### GPS Configuration

| Parameter         | Value | Description                          |
| ----------------- | ----- | ------------------------------------ |
| `GPS1_TYPE`       | 22    | DroneCAN moving baseline base        |
| `GPS2_TYPE`       | 23    | DroneCAN moving baseline rover       |
| `GPS_AUTO_CONFIG` | 2     | Auto-configure DroneCAN GPS          |
| `GPS_AUTO_SWITCH` | 1     | Use best GPS (do NOT set to 2/Blend) |

#### CAN Node Identification

| Parameter         | Description                                                                                |
| ----------------- | ------------------------------------------------------------------------------------------ |
| `GPS1_CAN_OVRIDE` | CAN node ID of the base GPS (auto-populated at boot from detected nodes, or set manually)  |
| `GPS2_CAN_OVRIDE` | CAN node ID of the rover GPS (auto-populated at boot from detected nodes, or set manually) |

#### Moving Baseline Offsets

| Parameter       | Description                                         |
| --------------- | --------------------------------------------------- |
| `GPS1_MB_TYPE`  | Set to 1 to enable moving baseline offsets          |
| `GPS1_MB_OFS_X` | Antenna offset from base to rover, forward (meters) |
| `GPS1_MB_OFS_Y` | Antenna offset from base to rover, right (meters)   |
| `GPS1_MB_OFS_Z` | Antenna offset from base to rover, down (meters)    |

{% hint style="warning" %}
Do **not** set `GPS_AUTO_SWITCH` to 2 (Blend). Blending is not compatible with the moving baseline configuration.
{% endhint %}

For the full parameter reference, see the [ArduPilot GPS for Yaw documentation](https://ardupilot.org/copter/docs/common-gps-for-yaw.html#dual-dronecan-f9p-gps).

***

## Tips

* See our [GPS Placement](/knowledge-base/knowledge-base/gps-placement.md) guide for mounting best practices, interference sources, and antenna positioning
* Mount GPS modules on a mast above the frame whenever possible — even 5-10 cm of vertical separation significantly reduces RF and magnetic interference
* Keep GPS antennas away from USB 3.0 cables, ESCs, and radio antennas
* Ensure the GPS antenna has a clear view of the sky — avoid placing batteries, carbon fiber, or other conductive materials above or beside it

***

## Troubleshooting

* **Antenna spacing** — for dual GPS heading setups, ensure a minimum of 30 cm between antennas. Greater separation improves heading accuracy.
* **Test outside** — GPS modules need a clear sky view to get a good fix. Indoor testing will not produce reliable results.
* **Enable logging before arming** — set `LOG_DISARMED` to 1 so GPS data is captured in logs before arming. This helps debug fix quality and satellite count issues.
* **Verify Fix2 messages** — use the [DroneCAN GUI Tool](/knowledge-base/knowledge-base/dronecan-gui-tool-guide.md) Bus Monitor to confirm that `Fix2` messages are being sent by the GPS node(s). If Fix2 messages are absent, check firmware version and CAN wiring.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

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

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.arkelectron.com/products/gps/ark-rtk-gps/ardupilot-instructions.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
