---
description: Connect a remote controller to Ubuntu for manual control
---

# Remote control setup on ROS2

To manually control a robot, we can use either the FlySky FS-i6 or the Logitech F310 game controller.

In this tutorial, we will explain how to connect these RC devices to Ubuntu 22.04 desktop machine to control a simulated robot in Gazebo. Then, we will explain how to use the FlySky FS-i6 remote controller in NAVQ.

<div><figure><img src="https://3991116448-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M8v3AGPa-j5DtYx8zqd%2Fuploads%2F98LFa7QJNkNlmv96A01Q%2FMicrosoftTeams-image%20(3).png?alt=media&#x26;token=243cc62a-8e73-453a-8248-f89778228189" alt=""><figcaption><p>Logitech F310 game controller</p></figcaption></figure> <figure><img src="https://3991116448-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M8v3AGPa-j5DtYx8zqd%2Fuploads%2Fsqf4Wsy4ryZNX2tG4BMa%2FMicrosoftTeams-image%20(1).png?alt=media&#x26;token=30df48d2-02a4-48eb-be78-1f2db3237dae" alt=""><figcaption><p>FlySky FS-iA6</p></figcaption></figure></div>

## Requirements

To follow this tutorial, you need:

* Logitech F310 game controller: this controller can be connected only via USB (more details are [here](https://www.logitechg.com/en-sg/products/gamepads/f310-gamepad.940-000112.html))
* FlySky FS-i6 controller: this controller can be connected via USB or via radio communication (in this case we need to connect the transmitter, see below for more details)
* Ubuntu desktop 22.04
* Navq board

## Ubuntu desktop setup

### Software setup

* With kernel version above 5.4, the driver is already included. For versions below, follow this guide to manually install the driver:&#x20;

{% embed url="https://notsyncing.net/?p=blog&b=2018.linux-fsia6b" %}

* Install the joystick tester: &#x20;

```
sudo apt install jstest-gtk –y
```

* Launch jstest-gtk GUI tool: you should see your controller show up as "FS-iA6B iBus RC receiver" in the list of detected devices.

<figure><img src="https://3991116448-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M8v3AGPa-j5DtYx8zqd%2Fuploads%2FzyZfvdDesyPAes1ngCwZ%2FPicture1.png?alt=media&#x26;token=1df68105-2ae2-4de6-99f5-6f5d5ef7d6ee" alt=""><figcaption><p>jstest-gtk GUI tool</p></figcaption></figure>

* When you move the control sticks, the bar graphs should change accordingly.

<figure><img src="https://3991116448-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M8v3AGPa-j5DtYx8zqd%2Fuploads%2FfDRzdNS0wi5fzYh2UyAb%2FPicture2.png?alt=media&#x26;token=2c8fe4c7-feb5-4c07-8e1e-8c9a83f85f26" alt=""><figcaption><p>jstest-gtk GUI too</p></figcaption></figure>

Now your RC transmitter is connected to Ubuntu. You can use existing simulators like [FlightGear](https://www.flightgear.org/), but here, we will focus on our ROS2 simulation.&#x20;

Let's start by configuring the RC transmitters.

### RC configuration

Some buttons should be at specific position to be able to control the simulated robot.

#### Logitech F310 buttons’ configuration

Make sure that the button in the back is pointed to X and not to D.

<figure><img src="https://3991116448-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M8v3AGPa-j5DtYx8zqd%2Fuploads%2FepTh3ST6spKGoESbfpd8%2FPicture3.jpg?alt=media&#x26;token=b22e6129-ba78-49ea-896e-316aa1fec035" alt=""><figcaption><p>Logitech F310 back button</p></figcaption></figure>

The picture below shows the functionality of each button we need in simulation.

<figure><img src="https://3991116448-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M8v3AGPa-j5DtYx8zqd%2Fuploads%2Fg2y1m5SIGs7uc29r9Skx%2FPicture5.jpg?alt=media&#x26;token=6ed15989-c9d7-4a2c-a14b-efdeb5b8a5f9" alt=""><figcaption><p>Logitech F310 front buttons</p></figcaption></figure>

#### FlySky FS-i6 buttons' configuration

For Gazebo simulation, you need first to configure the SWx buttons as follows:&#x20;

* SWA down&#x20;
* SWB middle&#x20;
* SWC middle&#x20;
* SWD up&#x20;

<figure><img src="https://3991116448-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M8v3AGPa-j5DtYx8zqd%2Fuploads%2F60F3z9h93VN961XSK0M4%2FPicture6.jpg?alt=media&#x26;token=3abfb144-e7b7-48ee-a156-3322b650a5cb" alt=""><figcaption><p>FlySky FS-i6 front buttons</p></figcaption></figure>

The arming button is in the back left. The right back button is for disarming.

<figure><img src="https://3991116448-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M8v3AGPa-j5DtYx8zqd%2Fuploads%2FpWJrrJUWOmIgjRKa7v9c%2FPicture7.jpg?alt=media&#x26;token=607f6df3-186f-41c9-a0c4-23c816c22876" alt=""><figcaption><p>FlySky FS-i6 back button</p></figcaption></figure>

#### Running a simulation

* Run the Gazebo simulation:&#x20;

```
ros2 launch mrbuggy3_gz_bringup gz_nav2.launch.py
```

* In another terminal, run the node “joy”:&#x20;

```
ros2 run joy joy_node
```

* You must see the message below:

<figure><img src="https://3991116448-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M8v3AGPa-j5DtYx8zqd%2Fuploads%2FgiWpt7sTHmdpCWNYu4H0%2FPicture9.png?alt=media&#x26;token=24b8a168-9fab-4434-a739-822af0a8b179" alt=""><figcaption></figcaption></figure>

* To see the topic messages, run the following command in another terminal:

```
ros2 topic echo /joy
```

* To control your simulated robot with the RC transmitter you need to arm the vehicle using the corresponding button. Also, make sure that the mode is “manual”. You can see arming and mode status in the Cerebri terminal.

<figure><img src="https://3991116448-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M8v3AGPa-j5DtYx8zqd%2Fuploads%2FgjnSvf0N5S00yHS3eH4k%2FPicture8.png?alt=media&#x26;token=6fc2879e-5b4a-45ec-a006-620163c0d014" alt=""><figcaption><p>Cerebri terminal</p></figcaption></figure>

## NAVQ setup

The Logitech F310 game controller and FlySky FS-iA6 remote controllers can also be used with NavQPlus.

#### Using Logitech F310 game controller

To connect the Logitech F310 game controller to NavQPlus board, use the USB Hub with USB-C connector similar to the photo below.

<figure><img src="https://3991116448-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M8v3AGPa-j5DtYx8zqd%2Fuploads%2F0vkn5a1xGFsEFsWn7bBP%2FPicture15.jpg?alt=media&#x26;token=4d478cdb-5cfd-45d2-b0aa-046019bf8258" alt=""><figcaption><p>USB Hub</p></figcaption></figure>

#### Using FlySky FS-iA6



{% hint style="info" %}
The FlySky FS-iA6 Remote controller can be connected to NAVQ since the Ubuntu release 22.04.3
{% endhint %}

Connect the FSia6b receiver to NavQPlus using UART connection (you need to make new cable as the one in the photo below).

<figure><img src="https://3991116448-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M8v3AGPa-j5DtYx8zqd%2Fuploads%2Fzp9Ydu9TqRTGOpRza8NB%2FPicture14.jpg?alt=media&#x26;token=c695e20d-3f8b-474c-85f4-99c3787a8fac" alt=""><figcaption><p>FSia6b to NavQPlus</p></figcaption></figure>

Connect to NavQPlus using ssh and tap the following command:

```
sudo inputattach --fsia6b /dev/ttymxc2
```

{% hint style="info" %}
You can add & at the end of this command to run it on background and avoid opening a new terminal for the next command.
{% endhint %}

#### Use RC with ROS2

Connect to your NavQPlus through ssh, then run the joy node:

```
ros2 run joy joy_node
```

Open a new ssh connection, and run the following command:

```
ros2 launch ros2_orchestrator orchestrate.launch.py 
```

You can now change the light intensity and control the motors using your remote controller.

&#x20;
