Table Hockey Robot — 12 Motors and Webcam Are a Worthy Rival
This automated game of table hockey uses machine learning to recognize players and make gameplay decisions.
Andrew Khorkin is on a mission, and he's not taking no for an answer. For the past 18 months, he's been working to automate a game of table hockey.
This might be harder than it sounds; there's quite a bit of mechanical complexity going on in this game. A player needs to be able to move six rods in and out to position the little hockey players, then rotate these rods to take a shot. By itself this movement is difficult to automate, but throw the complexity of computer vision and gameplay into the mix and you've got one heck of an engineering challenge.
Khorkin is handling the articulation of the control rods with 12 stepper motors: two for each rod. One motor moves the rod in and out using a drawer slide as a carriage, and the other is mounted on the carriage for rotating the rod. These motors each have a dedicated stepper motor driver which are connected to an Arduino Mega for control.
After getting the mechanics sorted, Khorkin tackled the brains of the machine. First, he had to be able to track the position of the players and puck on the field. Using an HD webcam mounted above the rink, Khorkin painstakingly gathered images of the players and puck to train a machine learning model using TensorFlow. This effort paid off, as the recognition seems to work flawlessly.
With position tracking working, Khorkin had to train the gameplay mechanics as well. He doesn't go into much detail about this process, but he does mention that it took six months of training and tuning to get it right. A desktop computer is running the object detection and gameplay models, then sends instructions to the Arduino about how to move the motors. Khorkin says he'd like to switch to a smaller computer, so he chose less processor-intensive machine learning models so this change would be easier down the road.
You can see Khorkin's robot in action here.