Communications Overview

Communications Overview

It is important to draw the distinction between interfaces and protocols: interfaces being the physical and logical channels over which communication occurs (e.g. BLE, WiFi, UART) and protocols being the coding of messages flowing over these channels.

Summary

Interface

LL Protocol(s)

App Protocol

WiFi

TCPIP, etc

HTTP/REST <-> RICREST

WiFi

WebSocket/RICSERIAL

Any App - ROSSerial, etc

BLE

RICSerial

Any App - ROSSerial, etc

Raw UART

RICSerial

Any App - ROSSerial, etc

I2C

I2C

Hardware dependent

USB UART

human-readable 7-bit ASCII serial + 8th bit set ProtocolOverASCII

Serial terminal / RICREST GET immediate mode / ESP32 bootloader programming / ProtocolOverASCII

Interfaces

RIC provides the following interfaces:

  • 1 x USB UART - used for programming, diagnostics, RICREST GET commands (immediate mode), ProtocolOverAscii

  • 1 x Raw UART - general purpose interface using RICSerial (LL) with any App protocol as payload

  • 2 x I2C - specialised protocols depending on the hardware connected (SmartServos, IMUs, etc)

  • BLE - general purpose interface using RICSerial (LL) with any App protocol as payload

  • WiFi

    • HTTP - REST protocol interface supporting RICREST App protocol

    • WebSockets - general purpose interface using RICSerial (LL) with any App protocol as payload

Protocol levels and groups

Protocols are referred to based on their “notional” level in a manner somewhat consistent with the ISO-OSI model. The only levels referred to are LL (Lower Layer - protocol(s) below the application layer which are responsible for moving data around and ensuring flow control, integrity checks, etc), and App (Application - an application layer protocol which is used to convey top-level messaging between applications - e.g. between an iPad app and the firmware).

The protocols used in RIC are:

  • RICSerial (LL) - a Lower-Layer protocol that can be used over any point-to-point, 8-bit serial interface (LL) and can carry a variety of payloads including ROSSerial (App) and RICREST. The goal of RICSerial (LL) is to have a consistent protocol irrespective of which interface is used. Since some interfaces are more capable than others this results in a lowest-common-denominator approach. This LL protocol is based on HDLC, assumes an 8bit serial connection at a minimum, incorporates start/end codes and ensures all other codes transmitted are escaped so start/end cannot be misinterpreted. There is also a CRC to allow message validity checks at this level.

  • RICFrame (LL) - very similar to RICSerial but used when framing is already provided by the lower layer. RICSerial is almost always used instead of RICFrame because many network transports split up frames in undesirable ways and RICSerial ensures that these are re-assembled.

  • RICJSON (LL) - even more pared-back than RICFrame. RICJson just contains pure JSON ascii data in the payload of each message with no overhead. RICJson can only be used when there is no danger of packets being split up.

  • RAWCMDFRAME (LL) - nothing but the raw bytes sent to/from the application.

  • ROSSerial (App) is a protocol defined as part of ROS1 and this is used to publish data out from the robot.

  • RICREST (App) - a protocol that looks like a web REST interface. The goal of including this protocol is to make some commands available using a human-readable protocol. These include setting the WiFi credentials and basic robot motion. In addition to the standard GET semantics, RICREST provides the means for file transfer and POST. RICREST is also used for file transfer and streaming.

BLE

The BLE interface provides a RICSerial protocol only. There is a single GATT service with 2 main GATT characteristics:

  • Tx - a characteristic used to send RICSerial data

  • Rx - a characteristic used to receive RICSerial data

WiFi

WiFi connections include the following possibilities:

  • HTTP over TCP:

    • RICREST (like a web REST protocol)

  • WebSockets (also over TCP):

    • RICSerial (LL) protocol as standard (with any App payload)

RAW UART

This serial interface is intended to be connected to a more powerful control computer such as a Raspberry Pi.

  • RICSerial (LL) protocol

USB UART

The USB interfaces passes through a CP2102N USB to Serial converter, and so becomes another serial interface. This interface will be used via a terminal-emulator program (human-readable) and/or other dedicated-purpose serial software such as the ESP IDF flash programming software. This interface is generally used for:

  • ESP32 reprogramming (with auto-reset circuitry)

  • Diagnostics

  • Immediate mode commands which are the subset of the RICREST commands which can be carried over an HTTP GET and are limited to just the request URL element of the HTTP GET request. So, for instance, a RICREST GET URL might be http://<ipaddress>/filerun/no.raw and this could be executed via immediate mode by typing filerun/no.raw. Other useful commands include setting WiFi credentials.

  • ProtocolOverASCII - this is a protocol run over the same USB uart but using the 8th bit of each byte set (it is always clear for plain ASCII) - it allows USB UART to directly support RICSerial protocol

I2C

It is not expected that I2C will be used for higher-level communication with RIC (only for controlling and reading sub-systems such as smart servos, accelerometer and power level sensors).

Task Runner