Linear Regression - Bounce Trajectory 1

Hi,

In the previous post, I described a method for predicting a future puck position by using linear regression to calculate the slope between at least two points when the puck passes a specified x-coordinate.

This method works well in simulation as the paddle could move instantaneously to intercept the puck at any given time. However, in the real-world, the ABB might not be able to move as quickly or as safely as I would want it to like the simulation.

Therefore, instead of predicting the trajectory of a puck when it passes an x-coordinate, a possible solution is to predict as soon as the puck is moving towards the ABB so that the ABB does not have to move as fast. The problem with this method is handling possible bounces when the puck hits the table edges before a point that the ABB can intercept the puck.

A possible solution to handle bounce trajectories is shown below.

This method works by swapping the axis of the table and finding out the point that the slope intercepts the Y-axis. In my function that implements the equation Y=mX + b for trajectory prediction, b is the point that the slope intercepts the Y-axis.

There are two conditions for this method, as shown in the image above.

In the first case:
1. If m < 0, so a negative correlation.
2. Iterate each y position in list and find the absolute difference between y and b.
3. Add the difference to b with respect to its corresponding x position. 

In the second case:
1. If m > 0, so a positive correlation.
2. Predict y position, given an x-coordinate, in this case 50 which is the end of the table.
3. Iterate each y position in list and find the absolute difference between y and predicted y position.
4. Add the difference to the predicted b with respect to its corresponding x position

Both cases will created new points for y coordinates.

Immanuel

Comments

Popular posts from this blog

Introduction

Test - Relationship between Accuracy and Angle