Skip to content

Routines

Virx edited this page Oct 23, 2020 · 9 revisions

util/routines.py

Aerial(self, intercept_time, targets=None, fast_aerial=True)

Double jumps then boosts up into the air on a flight path towards intercept_time and hits it towards the target. If no target is defined, then the bot will just hit the ball.

Can hit the ball above 300uus.

Uses a lot of boost. Depending on the situation, it can hit the ball very hard. Fairly accurate, but it might hit the ball a little higher than expected.

  • intercept_time - A number.
  • targets - A tuple of Vectors that are the left-most target and the right-most target. If no target is given, then it will hit the ball straight.
  • fast_aerial - A boolean. When True, a double jump will be performed to takeoff. When False, the dodge is saved for when the bot nears the ball.

update(self, shot)

This updates the current shot with new target location information.

shot - An instance of Aerial

double_jump(self, intercept_time, targets=None)

Uses both the initial jump and the dodge to gain height, then hits the ball at intercept_time towards the target. If no target is defined, then the bot will just hit the ball.

Can hit the ball when it's between 250uus and 551uus.

Uses a modest amount of boost, but boost isn't required. When available, it will use it to get to the ball faster and hit it harder. Can't hit the ball very hard. Isn't very accurate.

  • intercept_time - A number.
  • targets - A tuple of Vectors that are the left-most target and the right-most target. If no target is given, then it will hit the ball straight.

update(self, shot)

This updates the current shot with new target location information.

shot - An instance of double_jump

jump_shot(self, intercept_time, targets=None)

Uses the initial jump to gain height (if needed) then uses it's dodge to hit the ball with power in a certain direction at intercept_time towards targets. If no target is defined, then the bot will just hit the ball.

Can hit the ball from the ground up to 300uus, and can hit the ball while driving backwards.

Uses a modest amount of boost, but boost isn't required. When available, it will use it to get to the ball faster. Will hit the ball very hard, if given the opportunity. Extremely accurate, when given enough time.

  • intercept_time - A number.
  • targets - A tuple of Vectors that are the left-most target and the right-most target. If no target is given, then it will hit the ball straight.

update(self, shot)

This updates the current shot with new target location information.

ground_shot(self, intercept_time, targets=None)

Drives at the ball and hits it. It doesn't get any simpler! This routine is much more reliable than short_shot.

  • intercept_time - A number.
  • targets - A tuple of Vectors that are the left-most target and the right-most target. If no target is given, then it will hit the ball straight.

update(self, shot)

This updates the current shot with new target location information.

shot - An instance of jump_shot

short_shot(self, target)

Uses flips, boost and throttle to driving at the ball and hit it. Estimates a intercept location on it's own, and it will climb walls to reach the ball.

It can only hit the ball when it's very close to the ground.

Uses a modest amount of boost, but boost isn't required. When available, it will use it to get to the ball faster. Will hit the ball semi-hard if it's lucky. If it's on the right side of the ball, it's kind of accurate.

  • target - A tuple of Vectors that are the left-most target and the right-most target.

atba(self, exit_distance=500, exit_flip=True)

Removed. Use short_shot instead.

goto(self, target, vector=None, brake=False)

Goes towards the stationary target, and tries to face vector. Brakes to slow down the bot right on the location, if brake is True.

  • target - A Vector.
  • vector - A Vector. If None, then the bot will just go towards target.
  • brake - A boolean. If True, it will do a bit of math to determine the exact point to start braking that will have the bot stop extremely close to target.

retreat(self)

Brings the bot back to it's goal. If there's more than 1 bot on it's team, it will compensate.

shadow(self)

If used in the offensive zone, it puts the bot in the ideal position to put the ball into the goal.

If used in the defensive zone, it puts the bot in the ideal position to prevent the ball from going into the goal.

goto_boost(self, boost)

Uses goto's pathfinding, but has a few extra triggers related to boost pads.

generic_kickoff(self)

Drives at the ball with a full throttle while boosting. Flips into it when it gets close. Pops after 3 seconds.

wave_dash(self, target=None)

Does a wave dash towards direction of target. If a target isn't specified, it will default to a forwards wave dash.

Diagonal wave dashes aren't supported.

target - A Vector in local coordinates to wave dash towards. See local_location under car_object in util/agent.py.

flip(self, vector, cancel=False)

Flips towards vector.

face_target(self, target=None, ball=False)

Has the bot jump and face target, or the ball if ball is True.

You only need to define target or set ball to True.

  • target - A Vector.
  • ball - A boolean.

boost_down

Faces down (but slightly towards the ball) and boosts.

ball_recovery(self)

Uses recovery, but has it face the ball instead of a static target.

recovery(self, target=None)

Orients the bot for a clean landing on the ground or the ceiling, and facing target.

  • target - A Vector. If not defined, then the bot will simply right itself. Default is None.

brake()

Applies a throttle in the opposite direction of the car's forward velocity.

Clone this wiki locally