I was in a team of 5 that was competing in a robot competition, held at my university. The competition was similar to the famous robot firefighting contest held at trinity college. The goal of the competition was to build an autonomous robot that could navigate in a simple model of a building. The building consisted of four rooms. In one of the rooms, there was a lit candle. The robot’s task was to autonomously navigate the building and find the candle and put it out.

Even though we officially did not manage to put out the candle, we did pretty well and came second place in the competition. As you can see in the video below, the robot managed to put out the candle with some help. 😉

The mechanics

Another group member designed and 3d-printed the body of the robot. The robot also used special wheels called Mecanum wheel, which allows it to move in any direction and rotate on the spot. Each wheel was driven by its own stepper motor. To control the arm with the sponge, a small servo was used.

The electronics

The electronics used was a Raspberry Pi, an Arduino with a 3d-printer control card to control the stepper motors, 4 ultrasonic distance sensors to measure the distances to the walls and a camera with its IR-filter removed to detect the burning candle.

To power everything, a combination of USB-powerbanks and Li-Po batteries were used.

The software

For the Arduino, I wrote a custom program to control multiple steppers in parallel. I also used my knowledge in control theory to ensure smooth acceleration at all times. This was to avoid slippage of the wheels and thus improve the dead reckoning of the robot’s position. To achieve this, I put a digital low pass filter in front of the stepper velocity signal. Then I developed an LQ-controller around that to be able to control the absolute position of the steppers smoothly. The Raspberry Pi could then command the Arduino via serial to move the robot with constant velocity or to a specific absolute position.

On the Raspberry Pi, a rather involved software stack utilizing Linux, Docker and ROS2 was used. Different ROS2 nodes were used to control to interface with the hardware and Arduino. To explore the building, it was thought of as a maze and a graph was iteratively built up using a version of depth first search. Detection of cycles in the graph was done through the robot estimating its absolute position using dead reckoning of the stepper motors. When the robot was close to a node that it had already visited, a cycle in the graph was detected. This worked quite well in practice.

There were bonus points for starting the robot by it detecting a tone of a specified frequency. Using the principles of detection theory, I derived an optimal detector of a pure sine-wave with unknown amplitude and phase offset. The detection was tuned by setting a threshold for the percentage of the signal’s energy content was of the sine wave. This was implemented in a ROS2 node that was connected to a microphone, and this worked really well in practice.

For detecting the candle, a ROS2 node using OpenCV was used to detect round bright objects. This worked good in practice.