Robot Air Hockey Player Predicts Your Next Move

Air hockey is a fun game, but it’s one you can’t play by yourself. That is, unless you have a smart robot hockey player to act as your rival. [Zeroshot] built exactly that.

The build is based around a small 27-inch air hockey table—not exactly arcade-spec, but big enough to demonstrate the concepts at play. The robot player moves its mallet in the X and Y axes using a pair of NEMA17 stepper motors and an H-belt configuration. To analyze the game state, there’s a Raspberry Pi 3B fitted with a camera, and it has a top-down view of the board. The Pi gives the stepper motors commands on how to move the mallet via an Arduino that communicates with the stepper drivers.  The Pi doesn’t just aim for the puck itself, either. With Python and OpenCV, it tries to predict your own moves by tracking your mallet, and the puck, too. It predicts the very-predictable path of the puck, and moves itself to the right position for effective defence.

Believe it or not, we’ve featured quite a few projects in this vein before. They’ve all got their similarities, and their own unique quirks. Video after the break.

[Thanks to hari wiguna for the tip!]

21 thoughts on “Robot Air Hockey Player Predicts Your Next Move

  1. A lot of people do, search for the agbot challenge (there are others as well that is just an easy one to find because Purdue puts it on). Don’t blame others if you don’t even know about these things.

    On a side note to actually do intelligent ag robots the dollar amount invested is insanely higher than what was done here even at the smallest levels.

    1. i’m not about to search the video for a description of these things but it seems pretty obvious to me…

      first off, the “H kinematics” requires a pretty long belt, and long belts just tend to amplify all of the slop in shorter belts. also, it’s fundamentally a percussive game…impact is not the strength of this sort of system, and if any part of the system can stretch or wear or wobble, that will definitely show up here. and plus it’s obviously a prototype so it wouldn’t surprise me if the belt started out taut but then the machine had to be disassembled and re-assembled a bunch of times and the operator simply got sloppy with repetition.

      the other thing is, it simply doesn’t matter. it might even be desirable, to absorb some of the shock. it seems like it is (or should be) closed-loop control, since it has the camera. so like on my old worn-out 3d printer, it is open-loop control. to get to like a 2cm movement, it commands the exact number of steps, and if there was any slop or skipped step or skipped tooth, then everything is ruined. but with closed-loop control, it doesn’t have to have a firm connection between the number of steps and the location…if the mallet doesn’t wind up where it’s supposed to be, it just keeps commanding more steps until it does.

      there definitely is a lot of multi-faceted slop but i don’t think it’s a game stopper at all, assuming the control software is good enough. but i watched just enough of the video to see that “attacking” isn’t a feature yet…so i suspect the software is the limiting factor all around. it might not correctly compensate for slop, either.

      that attack feature would have been the interesting part from my perspective. it should know where your mallet is and be able to decide between tactics like aiming for the furthest path away from your mallet, or psyching you out with a return directly to your mallet, or so on.

    2. Exactly, he compensated for it by slowing the accel way down. A cursory glance at core-XY printers would reveal that belt tension is critical. His tension is just nonexistent. How are you even going to get a solid shot off with that much compliance and rebound in the motion system, let alone getting there in time?

    3. I suspect his mechanical design skills aren’t as good as his programming skills. There are a number of structural/mechanical issues with this design that make this design less robust (and probably make achieving is end goal harder), but it still works. Plus the walls of the air hockey table are not very rigid, which isn’t helping.

      If the maker reads this and wants feedback, I would suggest;

      Add snubber pulleys to the stepper and idler pulleys so increase the contact angle of the belt against the pulleys. You don’t have a stiff enough base structure (hockey table) to add a lot of tension to the belts, so increasing belt teeth in contact with your pulleys is your next best bet.
      Take as much slack out of the belt as possible. A mechanical tensioner would help.
      Make your connections to the table walls as rigid as you can, you want all the stepper effort going into the belt, not the frame.
      The carriages supporting your y-axis are racking under load. That’s either because your sleeves bearing area sloppy (unlikely) or, more likely, your sleeve bearings aren’t stiffly held in their supports. I re-watched and noticed you pressed your sleeve bearings into a support tube with a full length slot. That’s probably the issue, the whole tube is flexing under load. Don’t bother with the slot, just measure your bearing, upsize the hole in the support by 0.2-0.3mm and pressure fit the sleeve into place. Beef up whole assembly and add some adhesive to the interface between the bearing block and the idler pulley carriage (the white and orange parts).
      Actually, beef up all you printed parts that are stationary. Everything that doesn’t move should be as stiff as is reasonable.

      1. I’ll add to this (as someone who’s designed a few corexy printer gantries) you need to

        Keep belt tension high enough, and consistent between belts if using a 2 belt system like corexy ( this has just 1 belt)
        Use a belt path (like corexy) that balances your forces in the sides if the gantry. H bot belt pattern does not do this. As a result, the gantry will tram itself sideways when accelerating. Sometimes it’s the accuracy loss you care about there, but it also can cause bearings to bind up on the sides.

        Longer belt path is totally worth it if it balances forces out on the gantry ends. Gantry tramming from unmatched forces is a lot more movement than belt stretch (timing belts are glass fiber reinforced. They stretch very little)

        Your pullys on the gantry need to eb aligned with the pullys on the ends. Otherwise the belt makes a triangle that changes size as the gantry moves, and this will change your belt tension as the gantry moves. (Makes it impossible to keep constant tension)

        Just from the thumbnail I can see that he missed all these 3. I guess it still works, but don’t use it as an example of how to build a gantry like this

    4. I suspect that it is a bait for viewers to leave a comment since this is a way to imprive a video visibility. The goal of a youtuber is not allways to show what he builds but sometimes to have an income.

  2. I have no reason to spent MY free time on any of that. I’m already working 5 days a week for a environmental research company. But please, show off what you have done in those fields in your free time. The submit button is at the top of the page.

    And this could help lonely people that still want to play games.

  3. Completely agree. Legos, crayons, trainer wheels and 3D printers for beginners should be banned.
    It is a scandal that some people, especially young ones, waste 100s of hours playing with those instead of making useful stuff and money.
    /s

  4. hack value: n.

    Often adduced as the reason or motivation for expending effort toward a seemingly useless goal, the point being that the accomplished goal is a hack. For example, MacLISP had features for reading and printing Roman numerals, which were installed purely for hack value. See display hack for one method of computing hack value, but this cannot really be explained, only experienced. As Louis Armstrong once said when asked to explain jazz: “Man, if you gotta ask you'll never know.” (Feminists please note Fats Waller's explanation of rhythm: “Lady, if you got to ask, you ain't got it.”)

    Source: The Jargon File

  5. “Children should spent their time laying bricks, writing code and curing cancer, none of this wasteful playing with toys to development motor planning, self-regulation and social interaction.” You can’t do anything until you learn how and play is our first method as children, and still a powerful force for developing skills as adults. This project benefits the maker, who may apply they learned to other “important” problems later.

    Also, you might be lingering at the wrong website if you are only interested in human endeavors that provide unambiguous positive benefit to all humanity.

  6. I think what’s probably up is that certain segments of YouTube cater to this.

    Remember guys, youtube is entertainment.
    Take it as such.

    I personally wish more people did blogs these days instead of youtube. Helps filter out the ones who are just making projects to make entertainment off of documenting them. Lot of that on youtube.

    (Of course it’s not black and white; a lot of youtubers are somewhere in between. But there’s definitely more of that on youtube than there was in this community before youtube became the default)

Leave a Reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.