RELbot

Universiteit Project

A ROS2-based robotics project using Raspberry Pi, Xenomai, FPGA motor control, computer vision and PID control to make a small robot follow a green ball in real time.

Over het project


In the Advanced Software Development for Robotics (202200109) course, we worked with the RELbot: a small robot car used in several robotics courses at the University of Twente. The hardware platform, low-level motor interface, real-time setup and development toolchain were already provided. This meant that the focus of the course was not on building the robot from scratch, but on designing and integrating the software components needed to make the robot perform a useful task. Which in this case was following a bright green ball.

Software overview

Fig. 1. Overview of the architecture and communication between components of the RELbot, reproduced from [1].

Fig. 1 shows the overall software and hardware architecture of the RELbot system. The robot is built around a Raspberry Pi 4B, where three CPU cores run a regular Ubuntu installation and one core runs Xenomai, a framework for integrating firm or hard real-time computing into a Linux environment. A firm real-time process running on the Xenomai core communicates over SPI with an FPGA mounted on top of the Raspberry Pi using a HAT. The FPGA was provided pre-programmed and handles the low-level motor interface: it drives the motors using PWM and direction signals and reports quadrature encoder counts back to the control software.

Our work focused on the design and implementation of the higher-level software pipeline in ROS2 Humble. We had to decide how to split the system into components, which information each component should publish or subscribe to and where responsibilities such as perception, setpoint generation, control and safety should live. One ROS2 node subscribes to the camera image topic and processes the image using OpenCV. By applying HSV thresholding, it detects green objects in the frame, selects the largest blob, calculates its center of gravity and publishes this position to another ROS2 topic. A setpoint generator then converts the detected ball position from image space into a movement setpoint based on the camera resolution and several tuning parameters.

The movement setpoints are sent through a pre-existing communication channel to the loop controller running as a firm real-time task on the Xenomai core. This loop controller receives encoder feedback from the FPGA and uses a 20-sim model of the plant with PID functionality to calculate motor commands at consistent time steps. The Xenomai process then forwards the appropriate PWM and direction signals to the FPGA, which drives the motors. We also implemented safety layers to limit PWM values and stop the robot whenever no ball is detected. The videos on this page show the system working in practice in the RAM lab. With more time, the PID parameters could probably have been tuned further to make the movement smoother; in its current form, the robot follows the ball successfully, but its motion is still somewhat crab-like.

The main challenge of this project was quickly getting up to speed with the existing robotics platform and deciding how to structure the software around it. It was a very interesting course and a valuable hands-on introduction to robotics software architecture and ROS2.

[1] J. P. de Rie, “The design and development of the RELbot add-on Scout: A modular sensing and computational platform,” Master’s thesis, University of Twente, Enschede, The Netherlands, Oct. 2025. [Online]. Available: https://purl.utwente.nl/essays/108887

Grade: 9.5