Control a ROS-enabled UAV (Concept)

This content has 8 years. Please, read this page keeping its age in your mind.

One of the popular and traditional methods of tele-operating a quad copter is using a Remote Control (RC). It is a well-established and tested method, which has its origin before the era of the UAV. Nowadays, advanced UAVs are equipped with many sensors and specific purpose equipment such as cameras or radiation spectrometers. An alternative method of getting high bandwidth data from a UAV, which is also convenient, is using telemetry. This method uses a client application, installed in a ground computer, in order to present all the data transmitted from the UAV.
The approach, which has been developed for this project, is based on the utilisation of smart devices. These devices are equipped with powerful CPUs, extreme visualisation capabilities and a wide range of connectivity options. Needless to say that they are very popular and almost everyone in the developed countries has one of them.

The communication between the iPhone and the UAV is accomplished via wireless connection (Wi-Fi). I have chosen this method because TCP/IP is the
native communication protocol supported in ROS ecosystem and a wireless connection will be available in the next generation AARM system since it is going to have a companion computer.

Since I chose the communication method the next step was to decide the format in which the data should be encoded in and exchanged between peers. The selection of JSON (Javascript Object Notation) is a commonly accepted method. JSON is a lightweight data interchange format, easy for people to write and read yet, at the same time, it is easy for machines to parse and generate. In addition, there is a wide variety of available libraries that can be utilised to provide apparent and reliable implementations.

A. UAV Peer
In the side of the UAV there is one important requirement that has to be satisfied: UAV should be ROS-enabled. This is not restrictive because ROS is a very popular and trustworthy action plan in robotics’ communities. Moreover, as it has been implemented in this project for safety and convenience reasons, it is possible to use a simulator for the development. The advantage here is that in ROS systems the same code can be used with a real robot without any change.


In a ROS system there is a messaging mechanism called topics (fig.1). The data from the installed on-board devices which are publicised in relevant topics and control commands related to the linear and angular velocities are also accepted from the appropriate receivers using associated topics accordingly. These topics should be available to the iPhone in order to have access to the data and control commands. At this point a specific ROS package comes to play. Rosbridge which provides a JSON API to ROS functionality for non-ROS programs. This sounds ideal for the requirements of my project. Rosbridge provides a wide range of supporting interfaces. For my case, it was important that it included a WebSocket server for web browsers’ interaction. The WebSocket Protocol is a network protocol designed for the web that enables browsers to have bi-directional communication with a server. Using this package, communication mechanisms can be provided to the non-ROS systems following a ROS-style approach. It supports topic publishing and subscribing, service request and response as serialized JSON objects.

One of the advanced equipment that a UAV could carry is a camera. It is extremely helpful and interesting to have real-time streaming of the video to the application. While Rosbridge allows streaming videos, seeing as it is just another message type from ROS, I preferred to use a different component. MJPEG (Motion JPEG) server (Pitzer, 2011), which is a ROS package, optimised for efficiently transferring stream images in binary format. Consequently, an additional communication channel was used to increase performance and enable clients to request specific video quality and frame size according to their needs.

B. iOS device peer
On the other side there is a native iOS application developed using Objective C. As with the ROS side, the application should leverage the appropriate libraries to gain access in the data generated in the ROS ecosystem as well as to send compatible data. For this case, a WebSocket library should be used. SocketRocket is an objective C WebSocket client library useful in native mobile applications. By using WebSockets, existing tools built for the web can be easily reused for the mobile applications. It is similar to how most mobile applications reuse HTTP for their APIs. One level deeper in the architecture, there is the powerful RBManager library for communicating between iOS and ROS. This library is a wrapper for the SocketRocket WebSocket library in iOS. This approach follows the standard publisher,subscriber and service call architecture to send packets compatible with the Rosbridge protocol. It is well structured and easily expandable. It allows adding new message types and building on top of that. It has a simple syntax as long as the developer knows ROS.

Regarding the processing of the streaming video the case is simpler. The stream of the MJPEG server is essentially a video sequence in which each frame is separately compressed as a JPEG image. In the iOS library there is a UIWebView component available that enables the embedding of web content in iOS native applications.