Can You Beat Foosbar, the Foosball Robot?
Constructed from a myriad of servo motors and cameras, Foosbar's lightning-fast reaction times and accuracy are hard to match.
The challenges (and fun) of foosball
Foosball, similar to ping pong or air hockey, is another one of those tabletop party games that has been adapted from an existing sport- in this case, soccer. The goal is to move four rows of players with the objectives of defending, passing to your other players, and scoring a goal in the opponent's side. Due to the myriad of techniques and sheer complexity when moving players, not many people have been able to automate it, at least until Xander Naumenko (From Scratch on YouTube) created his Foosbar robot.
A concept
Other attempts to build an autonomous foosball opponent have typically resulted in a merely reactive robot that waits until the ball gets close to a scoring location on its own. However, Naumenko had a more ambitious set of goals in mind, namely, making the robotic opponent perform passes, react to the human player, and line up optimal shots. One half of the table would require a set of robotic actuators to move the players, as well as some kind of sensor array to track the ball's location at all times.
Creating the control scheme
Each row of plastic players is comprised of a single rod that can move laterally in axis perpendicular to the field and rotate around that same axis for a total of two degrees of freedom. The requirement for ultra-fast reaction times and ample force to hit the ball meant the usual stepper motor would have to be swapped for a beefed-up servo motor. Naumenko opted for several Teknic ClearPath-SC high-performance servos that each has a built-in controller and can communicate directly with a host PC over USB thanks to the SDK. For a given rod, one servo controls the roll while the other motor moves the entire assembly forwards and backwards. Optionally, a Teensy 4.1 can be added to show the current score on an e-ink display.
Ball localization
Before the system can start passing the ball around, it first has to know where the ball is located on the field. Naumenko's initial attempt involved setting up a clear playing surface so the ball could be seen by a camera underneath the field, but the supports and odd ripples in the acrylic caused the ball to behave unpredictably. Rather, he replaced the single camera with a Qualisys 3D motion tracking system that is both fast and accurate thanks to the total of five infrared cameras and precise calibration, and with the ball's surface coated in a retro-reflective material, it can be seen nearly all of the time.
Some more improvements
By far, the most challenging part of the build process was programming since foosball has so many moving pieces and strategies. Based on certain rules and states, Foosbar will use its speed advantage to block passes and scoring attempts near its own goal. Otherwise, it goes on the offensive to pass the ball towards the human player's goal, line up a shot, and score. It took Naumenko several months to get countless edge-cases and strategies dialed-in, but once it worked, Foosbar was a force to be reckoned with.
Playing foosball
After beating Naumenko's younger brother 10-9, Foosbar got an upgrade in the form of an internet-connected mobile app that could display a digital twin of the foosball table. Through it, players can control the robotic rods via a Bluetooth-enabled controller anywhere in the world. To see more about this project, you can watch Naumenko's video here on YouTube or visit Foosbar's project repository here on GitHub.
IoT, web, and embedded systems enthusiast. Contact me for product reviews or custom project requests.