Linear Regression - Bounce Trajectory 2
![Image](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiu5S356gp2UKGJrWXhOPc9oxCWiFZtPxIUSqLMrljrfytPpmoWGMTFmXY7sFQOwLNMExOq0MG7Vti6nZ_WC7vuoAD1JVKLuxWX-gG098vr4JxIANl8x8hcsjfICEU58kfJz2ABpXWYTnOw/s640/Trajectory+Prediction+bounce.png)
Hi, In the previous method, I described a method for handling bounce trajectories using Linear Regression. Below is an image showcasing another way to predict a bounce without swapping the axis and the need of creating new coordinates from the point that the slope intercepts the Y-axis. Code explained: 1. Calculate slope between atleast two points, as soon as the puck changes direction and is moving towards the ABB. 2. Using the slope, I predict the y position of the puck at the centre of the table. 3. If the prediction is greater than the table height,the error is calculated. 4. A new trajectory called Yc is created by reflecting the error from the end of the table. Video of two softbots playing with each other using two different methods Immanuel