|
Thunderbots Project
|
#include <ball_filter.h>
Public Member Functions | |
| BallFilter () | |
| std::optional< Ball > | estimateBallState (const std::vector< BallDetection > &new_ball_detections, const Rectangle &filter_area) |
Given ball data from SSL Vision, filters and returns the position/velocity of the "real" ball.
This ball filter stores a buffer of previous SSL Vision detections, and uses linear regression to find the path the ball is travelling on and estimate its position and velocity. This buffer/regression system was chosen because it results in a very stable output, particularly for the ball velocity. The data we receive isn't perfect (which is why we have a filter). If we receive a noisy position that is off the ball's current trajectory, it will have minimal impact. This means that as the ball is travelling, this filter will return a very steady velocity vector. This is important because small deviations in velocity orientation can have large effects when the AI tries to predict the future position of the ball. For example, consistently receiving a pass relies on the ball's velocity being very stable, otherwise the robot would "jiggle" back and forth as the estimated receiver position would keep changing.
|
explicit |
Creates a new Ball Filter
| std::optional< Ball > estimateBallState | ( | const std::vector< BallDetection > & | new_ball_detections, |
| const Rectangle & | filter_area | ||
| ) |
Update the filter with the new ball detection data, and returns the new estimated state of the ball given the new data
| new_ball_detections | A list of new Ball detections |
| filter_area | The area within which the ball filter will work. Any detections outside of this area will be ignored. |