# Flight controller connection and config

## Connection to the flight controller

{% hint style="info" %}
Follow these instructions to connect to the flight controller from [Mission Planner](https://ardupilot.org/planner/docs/mission-planner-installation.html) or [QGroundControl](https://docs.qgroundcontrol.com/master/en/getting_started/download_and_install.html) from the host PC.
{% endhint %}

**There are three preferred ways to connect to the flight controller:**

* UDP ( Wi-Fi connection)
* UDP ( through micro-USB cable plugged into the USB\_DEV connector on the DroneCore.Pilot board )
* USB ( directly connected from the host PC to the flight controller )

{% tabs %}
{% tab title="UDP (USB)" %}

* Assumed user logged in to Jetson (read [Connection test section](https://gitlab.com/airvolute-drones/DroneCore.Suite_documentation/-/blob/devel_tomas/Documentation/airvolute-dronecore.suite/first-time-setup/Connection-test.md) to connect to Nvidia Jetson)
* Open /etc/profile configuration file `sudo nano /etc/profile`
* Find and set MAVROS\_GCS\_URL as `export MAVROS_GCS_URL="udp-b://192.168.55.1@"`
* Execute command to run mavros: `roscd mavros && roslaunch mavros apm.launch`
* Run QGroundControl or Mission Planner on the host PC, and it should automatically connect

{% hint style="warning" %}
If there are issues with connecting from a Windows host, there is likely a problem with the firewall or antivirus software
{% endhint %}
{% endtab %}

{% tab title="UDP (Wi-Fi)" %}

* Assumed DroneCore.Pilot assembled with a Wi-Fi card and connected to the same network as the host PC
* Assumed known IP address of Jetson in the network ( to find IP address, execute `ifconfig` on Jetson and check IP of wlan0 connection )
* Connect to Jetson through ssh (read [Connection test section](https://gitlab.com/airvolute-drones/DroneCore.Suite_documentation/-/blob/devel_tomas/Documentation/airvolute-dronecore.suite/first-time-setup/Connection-test.md) to connect to Nvidia Jetson)
* Open /etc/profile configuration file `sudo nano /etc/profile`
* Exchange IP address of MAVROS\_GCS\_URL to the wlan0 one `export MAVROS_GCS_URL="udp-b://x.x.x.x@"`
* Execute command to run mavros: `roscd mavros && roslaunch mavros apm.launch`
* Run QGroundControl or Mission Planner on the host PC, and it should automatically connect

{% hint style="info" %}
If Jetson is set up as a Wi-Fi access point, the IP address is standardly *10.42.0.1*
{% endhint %}

{% hint style="warning" %}
If there are issues with connecting from a Windows host, there is likely a problem with the firewall or antivirus software
{% endhint %}
{% endtab %}

{% tab title="USB directly" %}

* Connect the USB cable from the host PC directly to the flight controller

<figure><img src="https://test-airvolute.gitbook.io/test-airvolute-docs/~gitbook/image?url=https%3A%2F%2F341257526-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FkuuT7PXOBpck5wDlb6XM%252Fuploads%252Fgit-blob-e34de04f56c198fa024ea953afe32fd37efe6498%252FIMG_20211222_102145.jpg%3Falt%3Dmedia%26token%3D22627ad2-7c7d-425c-ae4f-d67a36b0f8fa&#x26;width=768&#x26;dpr=3&#x26;quality=100&#x26;sign=499950b4&#x26;sv=2" alt="" width="375"><figcaption><p>Flight controller USB port location</p></figcaption></figure>

* Open QGroundControl or Mission Planner and connect to the corresponding COM port
  {% endtab %}
  {% endtabs %}

## Flight controller configuration

In order to perform the first flights, the flight controller must be configured for the vehicle. Typically, one should follow the instructions for their type of vehicle and the used firmware.

In case of default DroneCore.Suite, the flight controller is Cube orange with Arducopter 4.1. configured for use on the Quadcopter Discovery UAV by Airvolute, and this manual is optimised for the aforementioned configuration.

Basically, the user ought to follow the instructions in the flight controller firmware manual. However, there are some specific settings needed to run DroneCore.Suite correctly.

If you use a different vehicle type or autpilot, please read the section Specifics.

**Default settings**

The Cube Orange supplied with the DroneCore.Suite is already loaded with firmware and settings. If, in any case, the default configuration has to be restored, it is recommended to follow the firmware update manual and load the settings from this **settings file** according to Load presaved part of the [**Mission Planner Configuration and Tuning**](https://ardupilot.org/planner/docs/mission-planner-configuration-and-tuning.html).

**Ardupilot configuration (based on Ardupilot documentation)**

* Use the GCS software to connect to ArduPilot via [USB, UART or UDP connection](https://ardupilot.org/copter/docs/common-connect-mission-planner-autopilot.html)
* [Get familiar with your peripherals and input and output systems](https://ardupilot.org/copter/docs/common-basic-operation.html)
* Ensure you are using the correct ESC configuration for your motor if FOC ESCs are used
* Set up your vehicle [frame type](https://ardupilot.org/copter/docs/frame-type-configuration.html)
* Assign the [motors to the outputs](https://ardupilot.org/copter/docs/frame-type-configuration.html).
* If using CAN ESCs, configure the CAN communication accordingly
* Test your motor settings.
* If you are also using radio control, [configure and calibrate it](https://ardupilot.org/copter/docs/common-radio-control-calibration.html).
* [Calibrate the accelerometer.](https://ardupilot.org/copter/docs/common-accelerometer-calibration.html)
* [Calibrate the compass.](https://ardupilot.org/copter/docs/common-compass-calibration-in-mission-planner.html#common-compass-calibration-in-mission-planner)
* If using GPS, [mount and configure the GPS module](https://ardupilot.org/copter/docs/common-installing-3dr-ublox-gps-compass-module.html).
* [Set transmitter modes. ](https://ardupilot.org/copter/docs/common-rc-transmitter-flight-mode-configuration.html)These will serve for manual control of the drone. The flight mode can be changed externally via MAVLINK, which is also the case in autonomous control from the flight computer Xavier NX (check wording consistency).
* Based on the ESC you are using, consider [calibrating also your ESCs](https://ardupilot.org/copter/docs/esc-calibration.html). This is not needed in the case of DroneCore.Power, which has a separate section
* Activate the failsafe mechanism according to your needs. We recommend at least these options: battery, radio (if using R/C control), EKF, vibration, and crash
* Follow the [first flight instructions](https://ardupilot.org/copter/docs/common-tuning.html) to make your first flight, tune PID settings and related

#### **Specifics**

**COM settings**

* Serial 2 protocol is reserved for the flight computer and must be set to *Mavlink 2*
* Board-to-board interconnection between The Cube on DroneCore.Pilot and DroneCore.Power is using the CAN1 interface


---

# 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://docs.airvolute.com/autopilots/dronecore-2/getting-started/flight-controller-connection.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.
