Playbook - northern-bites/nbites GitHub Wiki

The playbook system is responsible for giving the robot a position to go on the field based on the field conditions provided by the localization system. It is the most decision-tree-like system we have. The utility functions are all in GoTeam.py, which is our current (and only) playbook.

Calling the strategize() method sets the process in motion and, after some heuristics are passed to cut down processing time, a strategy is decided on. Control then gets passed to the appropriate strategy in Strategies.py. The strategies are chosen based on how many players are active (not penalized) field players (not the goalie). This information is provided by the comm system. If the robot is not communicating with its team, the playbook will not function correctly. The strategies' job is to assign the robot a formation based on field conditions like if we just kicked off, or if the ball is in a certain part of the field. Once the control is passed to a formation in Formations.py, our goal is to give the robot the correct role. The role is chosen based on field conditions again like where the ball is, where we are, and where our teammates are. We try to give the robots the role that reduces required movement across the whole team. This decision is again dependent on comm and loc. Next control gets passed to a role in Roles.py including goalie, chaser, defender, etc. The job of these roles is to determine a subrole based on various field conditions. The goalie and chaser are special cases from here on out, but other roles use ball position and thresholds to determine which subrole to be in. Once control is in a subrole in (you guessed it!) SubRoles.py, we have to compute the robot's target (x, y, h) position. Each subrole has it's own way of doing that.

This system should probably be moved to C++ for speed.

There is a perl script contained in noggin/util/ called mapPB.pl similar to mapFSA.pl script. You can run it by:

$ perl mapPB.pl <path/to/Strategies.py>

You can run it on Strategies, Formations, or Roles. However, most useful is probably Strategies. This script can be nice to visualize the different connections.