The Goalie - northern-bites/nbites GitHub Wiki

General Information

The goalie is a player which works separately from the other players on the field most of the time. The goalie uses systems that were created for field players but also has specialized systems to better adapt to the needs of the goalie. The goalie has three general areas: Saving, Chasing, or Positioning. Most of the time the goalie is in one of these three roles. Most of the switches between roles happen after the counter has reached 4. This number is used because it worked well in testing. The number is a lot lower than the other field players because we want the goalie to be more sensitive to times when it should change.

The goalie has a GoalieTestState and pGoalieTest player which can be used to create small unit tests for the goalie. Most of the tests already in the file are meant to test the transitions or to test a certain sweetMove.

Objectives

Unlike other teams our goalie is designed to be aggressive. It chases the ball when it is close instead of waiting in the goal for someone to shoot. This decision was made because it is a effective way of dealing with uncertainty in ball measurements. The robot does not have to rely as heavily on velocity measurements in a chasing situation.

Saving

The goalie has two basic saves: Dive and Squat. It remains down in the save postions for 5 seconds (2011 Rules). The decision to save is made based on a "Heat" sensor. Heat is the term for when a robot is near the ball. Heat is a number ranging from 0-20. 0 is when the ball is not near the robot, 20 is when the ball is probably about to be kicked by a robot. When heat is above 10 or acceleration is less than -20 the goalie will prepare to save. The goalie waits until heat drops and velocity is high and moving towards the goalie to decide which way to save. The goalie will squat save if the ball is going to end up within 15 on either side of the goalie. It will dive is the ball is between 15 and 250 cm away. Farther than 250 the goalie will squat because the ball is probably really far away but just to be safe.

** NOTE: The goalie saving will get a lot better when the ball system improves. **

There are also testing saves that can be used to test the save decision. The goalie will point the direction the goalie would dive or it will point forwards if it would save center.

Dive

The goalie dive is a quick by safe motion for the robot which covers about half of the goal when the goalie is positioned in the center of the goal. The goalie can dive both right and left. Once the goalie dives it will remain on the ground for 5 seconds then do a "roll out" which just gets the goalie onto its back. Once on its back the goalie will get up using the normal back stand up.

Squat

The squat save is meant for balls that are close to the body (approximately 15 cm or less in either direction). This save creates an M shape with the goalies legs. This save has a special stand up that the goalie does after remaining in the squat position for 5 seconds.

Chasing

The goalie uses the same chase behavior as the other players on the field but it is monitored by a bunch of different transitions to keep the goalie from going to far. The goalie will not stop chasing when in a kicking state because we want the goalie to finish the kick.

The goalie starts chasing when:

  1. The ball is with in the chase limit.

The goalie stops chasing when:

  1. Ball has been off for a lot of frames

  2. The goalie is more than 1/4 of the way up the field.

  3. The goalie is outside of its box and the ball is past the chase limit

  4. Ball is past the chase limit or ball has a relX value too high.

Positioning

The goalie has two different positioning states. One of which is a special state for kick off. The positioning state is where the goalie should probably spend most of the game because if the ball is far away it should be just looking at it and finding the middle of the goal to stand at. The only difference between the kick off position and the normal position is that on the kick off position we assume we are in the correct position so we just take a couple steps forward and never try to reposition after that.

The goalie will position when:

  1. It should stop chasing.

  2. When it is done saving.

The goalie will stop positioning when:

  1. It should save.

  2. It should chase.