# 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="/files/NzzJNEoHgEFbyMC7lmMd" alt=""><figcaption><p>Logitech F310 game controller</p></figcaption></figure> <figure><img src="/files/cRkBXlHRMzEmKnyrNpEw" 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="/files/3uzs8S9bOYrkc33zq76J" 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="/files/UZV7gd947bxSFmE50JSM" 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="/files/LQOHHbW1OrW3WBUkfeZL" 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="/files/JSeClU4lsmXQa8oFIub2" 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="/files/YrtkrnsaZ51bzoda6JTg" 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="/files/Oak9EAQHtACWrfQIKkCB" 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="/files/5kjj6haEtY0sYvLJo98Q" 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="/files/x3nRj74QfnzxQiyCztmE" 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="/files/l3KXTL1kNCIvzFOPWt6w" 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="/files/ZmfuAUgwFUF2MJagOjsC" 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;


---

# 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://nxp.gitbook.io/mobilerobotics/ros2-specific-enablement/remote-control-setup-on-ros2.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.
