Why Can’t It Win All The Time?
I’ve watched the robot play a bit more and I’ve noticed a few tendencies that are preventing it from winning more often.
- Predictions are sometimes skewed by initial guesses. The farther away the ball is, the worse the predictions tend to be. Sometimes there will be a batch of outliers that will pull the prediction just far enough up or down so the paddle just barely misses the ball.
- Possible solution:Â Use a rolling window of the last N predictions for the average.
- Downside:Â Prediction will be more susceptible to outliers within the window.
- The paddle can’t get across the screen fast enough. When the paddle misses the ball at the bottom of the screen, the serve will usually occur toward the top of the screen, and even at its fastest, the paddle doesn’t get there in time.
- Possible solution: Make it move faster. Possibly even take into account the ball’s distance from the target point when determining the paddle speed.
- Downside: The faster it moves, the less control it has. It might be overshooting the target more often than it hits it.
- Prediction history will sometimes carry over after a point is scored. When this happens, you have all the points where the ball was going, which are heavily weighing down the points of where the ball is going. It usually ends up with the prediction point somewhere in the middle of the screen and nowhere near where the ball actually is. And, of course, the robot tracks the predicted point and misses the ball entirely. There’s already logic to throw out the history after a point is scored, but it’s based on the number of “unrecognized frames”, and it’s not always accurate.
- Possible solution: The history window will help this problem immensely, but won’t make it go away. The history should also be thrown out if the position of the ball jumps more than 25% of the screen width in a short period of time.
- Downside: This kind of calculation can run into a number of false positives. The recognition is occasionally flaky, and the ball might become the paddle briefly and trigger this solution based on that.
Additionally, I’ve noticed that when the robot misses the ball once, it usually misses the ball several more times. These second and third misses are usually the direct result of one of the problems listed above. If I can correct those issues, then missing one ball won’t turn into missing three balls, which means that the robot stands a much better chance of winning. A score of 21-20 that was decided on the last ball will turn into a score of 21-10, which is a much nicer victory to see.
0 comments
Kick things off by filling out the form below.
Leave a Comment