A Raspberry will compose the center piece of the robot. The PI will take care of all the high-level computation and handling of the rover tasks applying a ROS-based script running constantly as a background service. Communication between the PI and other components like Arduino will be used to transfer information to the low-level hardware that will take care of different tasks in the rover (like handling the motors or the RX communication).

OS

The chosen OS will be Ubuntu Server 22.04 LTS, as it should provide a stable framework to build all the different tools. This will allow for interoperability in case of future upgrades to different hardware based in Linux. C++ will be used to implement all ROS functionalities.

GPIO Communication

The chosen protocol for communication for the initial comms between Arduino and the Raspberry will be I2C. In the future, since the target is to use ESP32 for the comms, WiFi protocols could be applied for easier hardware implementation.

ROS 2 Implementation

For the initial version of the ROS environment used as the central hub for the rover control, a very simple implementation is used. This implementation will consist on a central node responsible to behave as the centre point of the rover software structure. For v0.1, this central node will correspond to the “motor controller”. The central node sends I2C messages to the corresponding topic, from which the I2C manager will send the corresponding controls to the Arduino attached to the motor controllers.

For v0.1, an additional package will be created to handle keyboard input. This node will publish data regarding the input of the motors. The goal of this package is to provide a placeholder for the future implementation of the ELRS input module (NOTE: ELRS control has been discarded for version 0.1).

However, by default, the input node automatically deployed within the Raspberry is a Bluetooth Manager that handles communication received from the Windows GUI deployed in the operator’s system.

rover_ros_0_1.png

Keyboard Input Manager

Very simple temporary package to register keyboard input from the terminal in order to control rover movement. Initial placeholder for control input implementation, kept in this version for future implementation as required. At the moment, the module simply takes input from “WASD” keys for “forward-left-backward-right” movements, “Z” as a stop command and “Q” as a quit command to stop the node.

BT Manager

The Bluetooth Manager is responsible for handling the BT server to which the GUI’s BT client can connect to in order to send control commands. On startup, the BT Manager will await connection from a client, and the server will be locked once a client has connection (not more than 1 client can connect at a time). Upon client disconnection, the server opens for connections again.

The BT manager implements the BT standard message used for communication.

Motor Manager

As of version 0.1, this node behaves as the central node for the logic of the rover. At the moment, it has been decided that the logic regarding motor speed (i.e. encoding of direction commands into individual motor speeds/movement) will be handled by the ROS implementation at the Raspberry. In the future, it is possible that this logic is moved into the Arduino scripts for higher complexity control approaches and/or additional sensors that allow close-loop control of the motors.

The module receives the direction commands parsed by the keyboard input manager, and translates these commands into the corresponding values of motor speed for each of the 4 motors being used in the rover. These speeds are sent to the I2C Manager node to send the information to the Arduino in charge of motor control.

I2C Manager

The I2C manager node receives messages to be sent via the I2C interface. Since right now the only data that needs to be sent using I2C is motor speeds, it directly receives an array with these speeds to write the raw bytes to the Arduino’s address.

The manager implements previously defined libraries for the I2C drivers that rely on pigpio’s I2C functionality. As such, upon startup the node stores a bus object that represents the connection with the Arduino, and data is directly sent as raw bytes.

Interfaces