Following the STP structure, the Play is the module where decisions are made. Therefore the location where a role should go should be decided in the Play as well. However, the definition for a decision in the situation of position can be vague. It can be augmented that the decision should be the area where a robot resides during a play and that a Tactic should decide where the best location is in that area. Take a Receiver robot:

  • The Play determines the area to which the robot should restrict its calculations.
  • The Tactic determines the actual location in that area that has the highest score (determined by different factors like, line of sight to the ball, vision on the goal, etc.)

This structure seems logical as finding a suitable location can be classified as a Tactic, however, a problem occurs when implementing it in a team play. As the calculations are made in the Tactic (which is Role/Robot specific) the Play should not need access to this data, though this calculation is needed to determine where the Passer should pass to. If the best location is calculated and the Receiver drives towards it, the Passer will only have the information that the Receiver is currently, instead of the location to where the Receiver calculated the best location is. As a result, Passer is restricted to the present situation whilst the future position of the Receiver is more valuable. A solution could be to again calculate the best ‘pass to’ location for the Passer, which leads to computations that overlap in the result.

The chosen solution to this problem was to have the AI completely calculate the best location for each robot to be positioned. This results in a vector containing all the best locations paired with a score rating. This information can then be used by the next play to determine which Robot the Passer should pass.

The same train of thought can be said when play requires a position structure like a defense wall. Instead of each Defender calculating the best location for himself in the wall, the Play calculates all the locations of the wall and gives these to the Roles.

In an effort to make the positioning of a play more generalized, a new module was added that would be able to effectively place a robot based on the state of the world (replacing the hard-coded method). The module was made as a framework where new parts could easily be added without the need of adjusting code in the plays, in other words; a building block for the play.

Getting a position for a robot now requires only 2 parameters: the desired area (grid) the robot needs to be placed in and the type of location (profile) the robot should have. With this as input, the position algorithm returns a position associated with a score.

The current implementation of positioning requires a significant amount of processing power to handle all the computations. The goal of the module was to reduce the number of computations whilst still allowing for a decent working positioning system. More work can be put in optimizing this system and some suggestions are noted on section 5.2 on page 26.

First, the different parts and terminology of this module will be explained, followed by the implemented factors which can be used as examples if any additions are made to the module.

These factors all get a score which is based on computations done in the PositionComputation module and the associated position evaluations. An example, when looking at the line of sight to the ball, the computation part gathers the information about the angle to the ball from that position and all enemy robots, and their distances. In the evaluation part, these values are used to make a score based on if the angle of an enemy robot is too close to the angle of the position.

Grid One of the inputs of the function is the area in which the best location should be selected. Serious performance issues would occur if there was no definition in what resolution the calculations should be made. To narrow the search, a grid system is used which is a collection of points. The grid is generated with as input the position of the grid, height and width and the segments in the height and width directions. Points are located at the intersection of the segments. This method of generating points in an area can be improved upon but will suffice for now 11. All the points in the grid are evaluated for the scores that are required.

Profile Different roles have different desires when being positioned. An offender that is preparing to shoot at the goal needs to have visibility of the enemy goal but the possibility of a successful pass also needs to be taken into consideration. This can be linked to a Role, however, roles have overlapping desires and copy-pasting the weights of factors to each Play is inefficient. For this reason, profiles were designed.

A profile has a descriptive name with the collection of weights of each factor. This allows for easy usage inside a play without the need of figuring out what each factor implies. An example of a profile is the GoalShoot, which has a higher weight for the factors goal vision and line of sight than the openness of a position. This profile is saved in the module and can be accessed by all Plays.

In addition to the ease of expanding the playbook, adding extra factors for the position calculations does not require going through all Plays by changing input parameters, as this can be done in the Profile.

Saving information Within every tick the world state stays the same, this means that all computations and evaluations are the same for that tick. To reduce the number of computations, the computations made are saved linked to a position in its raw form (score and not the score multiplied by the weight). If the score of a position is demanded, the code will check if the computations for the required factor was already made this tick and takes that value, or if not, compute the score of the position for that factor. This is less important during the plays, as overlapping position grids will not likely occur. However, when switching between plays and accessing the score of a certain play which can be based on positioning, these computations can overlap. The system will therefore reduce the number of computations needed when expanding the number of plays.

Defence is the best offence, or is it the other way around? Nevertheless, a good defence is crucial for the RoboCup. One of the biggest limitations for defence is that the ball position and directional velocity are hard to retrieve and all information is relayed to the robots with a slight delay. This consequently means that actively trying to block a ball that has been shot might not be the best method of defending. Therefore, passive methods have been designed to ensure a low likelihood of shooting into the goal if the ball will be shot. Making a wall infront of the ball and between the goal is a straightforward method of doing just that.

Defenders are restricted from entering the defence area (the rectangular area around the goal), which gives a rectangle that can be used for the backline of defence, in addition to active Roles that actively try to steal the ball or block robots. A wall can be formed at the outside of the rectangle such that no ball should be able to go through. This technique was implemented.

It takes the outside borders of the defence area and a line of the ball to the centre of the goal. These lines should return a single intersect (provided that the ball is not behind the goal or inside the defence area) which marks the centre of the wall. Around this point, circles are drawn with a radius that equals the desired spacing between the robots. Every intersection of the circle with the borders a position that needs to be filled for the wall. Odd and even numbers of robots in a wall have different cases where the initial border and ball line intersect should be a location or that the first circle should start with a radius half of the desired spacing respectively. This implementation is a effective and low cost method of achieving a decent defence, compared to other methods which could use the vision visibility of the goal to fill in the gaps.