Player - northern-bites/nbites GitHub Wiki

The Player is an FSA that coordinates many of the other behavioral systems in a meaningful way. For instance, in the ScanFindBall state, the player will tell the Head Tracker to start panning and the Navigator to stop walking. Kick Decider operations are also executed here. Playbook information is also used for various positioning behaviors encoded into the states of the player FSA. Think of this system as a coordination control. The player isn't meant to do any computation on a lower level, but simply pass control to various subsystems at the right times and in the right way. The player can be broken down into three parts when we are playing: chase, find ball, and playbook position. When we are not playing, the states are pretty trivial.

Chase

The chase part of the player describes the behavior of the robot when it sees the ball and the playbook tells it to be the chaser. States include positionForKick, kickBallExecute, orbitBall, etc. Essentially how it works now is that the 'chase' state is the super state for the subsection. Any behavior wishing to use the chase capabilities should enter the 'chase' state. From there, there is a special case for a "dangerous ball" defined as any ball that we could easily score an own goal on when trying to position on it (just behind our feet for example). This state and transition to this state needs some work and seems to be only applicable to The Goalie.

If we don't go to a dangerous ball, we will enter the 'positionForKick' state. Here we will coordinate the head and the walk to get us to the ball. Try exploring the function calls yourself because it's one of the simpler pathways to follow at this point. Ask a veteran for help if you don't know where to start or where to go. Once we start this process we will decide which kick to do. We will re-decide the kick if the ball moved or things like that. Occasionally we will decide that we don't have good enough information to choose the kick. In that case, we will choose a "Null Kick" which signals the player to provide more information. To do this, we will do a high pan with the head. If there is still not enough information, we orbit the ball a set amount, then do another pan and repeat the process. While this system isn't perfect, it works most of the time.

Once we have a kick and the ball is in the correct location, we actually execute the kick. The 'kickBallExecute' is a very simple state that performs the kick we selected. The 'afterKick' state, on the other hand, is very heuristic heavy. We try to do as many heuristics as we can to ensure that 1) we don't wiff a kick and 2) we look in the right direction after we kick the ball. Once we are done with the 'afterKick' state, we get kicked back up to 'chase' to start the process over again.