Trajectory Prediction - Linear Regression
![Image](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjUMijZZKMSJvxf_sWua8QIgdpVOz0gPdVfP3p_RkJ9pJTGu2FvWTyX-GGrPhxkYWUppp3uRW11uI2j7AlHwmFCSjjkuaoFqeXG55kc5YjScph_LCVHObPy7eE6vMLwNKIPUB35gtGVwAPx/s640/53855773_606017063154961_6944060153025003520_n.jpg)
Hi, If I know the coordinate of the puck within a period of time, I can calculate the change of the puck's y-coordinate in respect to its x-coordinate. Plotting multiple puck's positions in a graph shows the puck's direction of travel and most importantly, I can estimate a future position using the line of best fit, also called regression line. Below is an example of how I can predict the trajectory of the puck using equation: Y = mX + b Where; Y = mean of all y-coordinates X = mean of all x-coordinates m = slope of the line b = intercept point of line in the Y-axis Applying the knowledge gained of calculating linear regression using the least-square method and wonderful tutorials online, I have created a function to calculate m and b to predict a y-coordinate given an x-coordinate. Video of softbots playing with each other using two different methods The video below shows the paddles moving autonomously. Note that the paddle on the left i...