12.5 Initial Agent Placement (BEAM)

Of the multitiude of aspects that haven’t be covered yet, the one that you might of noticed already in play is that of the initial agent placements. This process does not happen within the selectSkill() method but is a previous initalisation process that occurs through the use of the beam method. The beam function is defined as follows:

void NaoBehavior::beam( double& beamX, double& beamY, double& beamAngle) 

This takes in references to 3 variables, those being the beamX and beamY being the X and Y coordinates as well as beamAngle being the angle you want the agent to face when you first place them on the field. Inorder to set the position and angle we simply assign values to these variables as follows:

 if(worldModel->getUNum() == 1){
            beamX = -HALF_FIELD_X +1;
            beamY = 0;
            beamAngle = 0;
        }
    else if(worldModel->getUNum() == 2){
            beamX = -HALF_FIELD_X;
            beamY = 0;
            beamAngle = 0;
    }

Here we can see we assign different initial positions to different agents in the same way as we assigned different tasks to different agents using worldModel->getUNum()


This is one formation that can be used with each agent in the center of the field as a result of ```beamY. Another formation that is slightly more realistic could be something like the following:

 if(worldModel->getUNum() == 1){
            beamX = -HALF_FIELD_X +5;
            beamY = -5;
            beamAngle = 0;
        }
    else if(worldModel->getUNum() == 2){
            beamX = -HALF_FIELD_X +5;
            beamY = 5;
            beamAngle = 0;
    }