Wiki source code of Ball Physics
Version 5.1 by stu104225 on 2020/03/04 17:18
Hide last authors
| author | version | line-number | content |
|---|---|---|---|
| |
5.1 | 1 | The **ball physics model** is meant to do things ... [TODO] |
| 2 | |||
| |
1.1 | 3 | \\ |
| 4 | |||
| 5 | |||
| 6 | |||
| |
5.1 | 7 | {{toc/}} |
| 8 | |||
| |
4.1 | 9 | == Ball trajectory == |
| |
1.1 | 10 | |
| |
5.1 | 11 | ---- |
| 12 | |||
| |
4.1 | 13 | The trajectory of a ball can be modeled to be parabolic. |
| |
5.1 | 14 | \\\\\\like so: .... [TODO] |
| |
4.1 | 15 | |
| |
1.1 | 16 | == Configuration == |
| 17 | |||
| |
5.1 | 18 | ---- |
| |
1.1 | 19 | |
| |
5.1 | 20 | === Prediction parameters === |
| 21 | |||
| 22 | |=((( | ||
| 23 | Parameter | ||
| 24 | )))|=((( | ||
| 25 | Description | ||
| 26 | )))|=((( | ||
| 27 | Default value | ||
| 28 | ))) | ||
| 29 | |((( | ||
| 30 | PREDICTION_FRAME | ||
| 31 | )))|((( | ||
| 32 | window size for prediction - How far | ||
| 33 | |||
| 34 | into the future are predctions calculated at most. | ||
| 35 | )))|((( | ||
| 36 | 70ms | ||
| 37 | ))) | ||
| 38 | |((( | ||
| 39 | PREDICTION_STEP_SIZE | ||
| 40 | )))|((( | ||
| 41 | size of the steps for the forward search | ||
| 42 | )))|((( | ||
| 43 | 10ms | ||
| 44 | ))) | ||
| 45 | |((( | ||
| 46 | REFINEMENT_FACTOR | ||
| 47 | )))|((( | ||
| 48 | The prediction step size for the reverse search is | ||
| 49 | PREDICTION_STEP_SIZE divided by REFINEMENT_FACTOR. | ||
| 50 | )))|((( | ||
| 51 | 10 | ||
| 52 | ))) | ||
| 53 | |||
| 54 | with the default values up to 7 predictions are calculated if the ball is not predicted to be in flipper range roughly within the next two frames. | ||
| 55 | |||
| 56 | \\ | ||
| 57 | |||
| 58 | So this number is also the worst case number of predictions calculated during the reverse search part of the prediction process. | ||
| 59 | |||
| 60 | \\ | ||
| 61 | |||
| 62 | === Flipper range === | ||
| 63 | |||
| |
4.1 | 64 | The model of the area, where the the flippers can hit a ball is computed from a set of five points. These points are set to real world coordinates in meter |
| |
1.1 | 65 | |
| |
4.1 | 66 | and should not need further adjustment after the camera is correctly calibrated (see [[doc:World Coordinate System]]). |
| 67 | |||
| |
5.1 | 68 | The values for the left flipper are set to be symmetrical. |
| 69 | |||
| |
1.1 | 70 | [[image:attach:physics_points.png]] |
| 71 | |||
| |
5.1 | 72 | (% class="wrapped" %) |
| |
4.1 | 73 | |=((( |
| 74 | Point# | ||
| 75 | )))|=((( | ||
| 76 | Description | ||
| 77 | ))) | ||
| 78 | |((( | ||
| 79 | 1 | ||
| 80 | )))|((( | ||
| 81 | center point of the circle that the flippers tip moves o | ||
| 82 | ))) | ||
| 83 | |((( | ||
| 84 | 2 | ||
| 85 | )))|((( | ||
| 86 | highest point a ball can be at when it hits the resting flipper | ||
| 87 | ))) | ||
| 88 | |((( | ||
| 89 | 3 | ||
| 90 | )))|((( | ||
| 91 | lowest point a ball can be at when it hits the resting flipper | ||
| 92 | ))) | ||
| 93 | |((( | ||
| 94 | 4 | ||
| 95 | )))|((( | ||
| 96 | lowest point a ball can be at when it hits the fully triggered flipper | ||
| 97 | ))) | ||
| 98 | |((( | ||
| 99 | 5 | ||
| 100 | )))|((( | ||
| 101 | highest point a ball can be at when it hits the fully triggered flipper | ||
| 102 | ))) | ||
| |
1.1 | 103 | |
| 104 | \\ | ||
| 105 | |||
| |
5.1 | 106 | From these points an area, where the ball is deemed to be hittable, is computed. |
| |
4.1 | 107 | |
| |
1.1 | 108 | [[image:attach:physics2.png]] |
| 109 | |||
| 110 | \\ | ||
| 111 | |||
| 112 | === Inlane Area === | ||
| 113 | |||
| |
5.1 | 114 | Since the trajectory prediction does not consider collisions in general, we need a different kind of predictions for the inlanes, |
| 115 | i.e. the path feeding a falling ball from the playfield to the flippers, behind the slingshot. | ||
| 116 | A ball is considered to be in an inlane, when it is in a rectangualar area, with one edge given by the begin of the flipper | ||
| 117 | and the other by a point at highest, outermost position of the angled part of the inlane. | ||
| |
4.1 | 118 | |
| |
1.1 | 119 | [[image:attach:physics_inlane.png]] |