{"id":338,"date":"2009-09-08T13:29:42","date_gmt":"2009-09-08T20:29:42","guid":{"rendered":"https:\/\/mathpirate.net\/log\/?p=338"},"modified":"2009-09-08T13:29:42","modified_gmt":"2009-09-08T20:29:42","slug":"why-cant-it-win-all-the-time","status":"publish","type":"post","link":"https:\/\/mathpirate.net\/log\/2009\/09\/08\/why-cant-it-win-all-the-time\/","title":{"rendered":"Why Can&#8217;t It Win All The Time?"},"content":{"rendered":"<p>I&#8217;ve watched the robot play a bit more and I&#8217;ve noticed a few tendencies that are preventing it from winning more often.<\/p>\n<ul>\n<li><em>Predictions are sometimes skewed by initial guesses.<\/em>\u00c2\u00a0 The farther away the ball is, the worse the predictions tend to be.\u00c2\u00a0 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.\n<ul>\n<li>Possible solution:\u00c2\u00a0 Use a rolling window of the last N predictions for the average.<\/li>\n<li>Downside:\u00c2\u00a0 Prediction will be more susceptible to outliers within the window.<\/li>\n<\/ul>\n<\/li>\n<li><em>The paddle can&#8217;t get across the screen fast enough.<\/em>\u00c2\u00a0 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&#8217;t get there in time.\n<ul>\n<li>Possible solution:\u00c2\u00a0 Make it move faster.\u00c2\u00a0 Possibly even take into account the ball&#8217;s distance from the target point when determining the paddle speed.<\/li>\n<li>Downside:\u00c2\u00a0 The faster it moves, the less control it has.\u00c2\u00a0 It might be overshooting the target more often than it hits it.<\/li>\n<\/ul>\n<\/li>\n<li><em>Prediction history\u00c2\u00a0will sometimes carry over after a point is scored.<\/em>\u00c2\u00a0 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.\u00c2\u00a0 It usually ends up with the prediction point somewhere in the middle of the screen and nowhere near where the ball actually is.\u00c2\u00a0 And, of course, the robot tracks the predicted point and misses the ball entirely.\u00c2\u00a0 There&#8217;s already logic to throw out the history after a point is scored, but it&#8217;s based on the number of &#8220;unrecognized frames&#8221;, and it&#8217;s not always accurate.\n<ul>\n<li>Possible solution:\u00c2\u00a0 The history window will help this problem immensely, but won&#8217;t make it go away.\u00c2\u00a0 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.<\/li>\n<li>Downside:\u00c2\u00a0 This kind of calculation can run into a number of false positives.\u00c2\u00a0 The recognition is occasionally flaky, and the ball might become the paddle briefly and\u00c2\u00a0trigger this solution\u00c2\u00a0based on that.<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p>Additionally, I&#8217;ve noticed that when the robot misses the ball once, it usually misses the ball several more times.\u00c2\u00a0 These second and third misses are usually the direct result of one of the problems listed above.\u00c2\u00a0 If I can correct those issues, then missing one ball\u00c2\u00a0won&#8217;t turn into missing three balls, which means that the robot stands a much better chance of winning.\u00c2\u00a0 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.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I&#8217;ve watched the robot play a bit more and I&#8217;ve noticed a few tendencies that are preventing it from winning more often. Predictions are sometimes skewed by initial guesses.\u00c2\u00a0 The farther away the ball is, the worse the predictions tend to be.\u00c2\u00a0 Sometimes there will be a batch of outliers that will pull the prediction [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[24],"tags":[15],"_links":{"self":[{"href":"https:\/\/mathpirate.net\/log\/wp-json\/wp\/v2\/posts\/338"}],"collection":[{"href":"https:\/\/mathpirate.net\/log\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mathpirate.net\/log\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mathpirate.net\/log\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/mathpirate.net\/log\/wp-json\/wp\/v2\/comments?post=338"}],"version-history":[{"count":2,"href":"https:\/\/mathpirate.net\/log\/wp-json\/wp\/v2\/posts\/338\/revisions"}],"predecessor-version":[{"id":340,"href":"https:\/\/mathpirate.net\/log\/wp-json\/wp\/v2\/posts\/338\/revisions\/340"}],"wp:attachment":[{"href":"https:\/\/mathpirate.net\/log\/wp-json\/wp\/v2\/media?parent=338"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mathpirate.net\/log\/wp-json\/wp\/v2\/categories?post=338"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mathpirate.net\/log\/wp-json\/wp\/v2\/tags?post=338"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}