-
Notifications
You must be signed in to change notification settings - Fork 3
Ball Path Prediction
Eric Veilleux edited this page Feb 18, 2025
·
3 revisions
This feature gives you the predicted ball path of the next 6 seconds. While it accounts for the geometry of the field, it does not account for any other objects like cars.
Assume the following is written in a bot or script's get_output() function. It prints all the predicted locations of the ball.
from rlbot.flat import BallPrediction
# ...
for slice in self.ball_prediction.slices:
self.logger.info(f"Ball position at {slice.game_seconds} seconds: {slice.physics.location}")
# ...
class PredictionSlice:
game_seconds: float
"""
The moment in game time that this prediction corresponds to.
"""
physics: Physics
class BallPrediction:
"""
A prediction of a ball's trajectory, assuming no collision with cars.
"""
slices: Sequence[PredictionSlice]
"""
A list of predicted states of the ball at specific times in the future, assuming no collision with cars.
The beginning of the list is now, and the end is 6 seconds into the future.
The prediction is made at 120 Hz, resulting in 720 entries.
"""
class PredictionSlice:
game_seconds: float
"""
The moment in game time that this prediction corresponds to.
"""
physics: Physics
__match_args__ = (
"game_seconds",
"physics",
)
def __new__(
cls,
game_seconds: float = 0,
physics: Physics = Physics(),
): ...
def __init__(
self,
game_seconds: float = 0,
physics: Physics = Physics(),
): ...
def pack(self) -> bytes: ...
@staticmethod
def unpack(data: bytes) -> PredictionSlice:
"""
:raises InvalidFlatbuffer: If the `data` is invalid for this type
"""
def __str__(self) -> str: ...
def __repr__(self) -> str: ...
class BallPrediction:
"""
A prediction of a ball's trajectory, assuming no collision with cars.
"""
slices: Sequence[PredictionSlice]
"""
A list of predicted states of the ball at specific times in the future, assuming no collision with cars.
The beginning of the list is now, and the end is 6 seconds into the future.
The prediction is made at 120 Hz, resulting in 720 entries.
"""
__match_args__ = (
"slices",
)
def __new__(
cls,
slices: Sequence[PredictionSlice] = [],
): ...
def pack(self) -> bytes: ...
@staticmethod
def unpack(data: bytes) -> BallPrediction:
"""
:raises InvalidFlatbuffer: If the `data` is invalid for this type
"""
def __str__(self) -> str: ...
def __repr__(self) -> str: ...