|
Now, when you open the Soccer map, you don't have the ball anymore. You have to create it (spawn) like any other robot. So, you can use this command:
INIT {ClassName USARBot.SoccerBall}{Name SB}{Location 0,0,-0.04}
This will create the ball in the middle field. The location is expressed in meters. The Name parameter is optional, however I suggest to use it.
Important: When the ball is created, you can spawn the AIBO robots. If you spawn AIBOs before creating the ball, they will not see it.
The command to set the ball location is:
SETBALL {Location x,y,z}
X, Y, Z are in meters and Z will typically be -0.04. Examples:
The command to kick the ball is:
SETBALL {Kick <Y/B>}[{Speed s}]
Y stands for yellow goal and B for blue goal. Speed is an optional parameter that controls the ball speed. It can range from 1 to 3. Examples:
The SoccerBall is smart enough to position itself in the middle field (or other location) if one of these 2 events occur:
The reposition feature can be controlled by a bunch of parameters in the [USARBot.SoccerBall] section of the USARBot.ini file:
enableReposition=[false|true], enables or disables the reposition feature.
outRepositionTime=T (seconds), time to wait before reposition if the ball is out of the field.
inRepositionTime=T (seconds), time to wait before reposition if the ball is in the field and not moving.
movementTolerance=S (uu), movement tolerance of the ball in uu.
frontierX=S (uu), frontierX defines the filed X extension (-frontierX<-> frontierX).
frontierY=S (uu), frontierY defines the filed Y extension (-frontierY<-> frontierY).
targetPos=(X,Y,Z) (uu), where the ball will be repositioned.
The default values are:
enableReposition=True
outRepositionTime=1
inRepositionTime=10
movementTolerance=5
frontierX=700
frontierY=500
targetPos=(X=0,Y=0,Z=10)
movementTolerance and inRepositionTime are related and can be interpreted this way:
Vt = movementTolerance / inRepositionTime
If the ball speed is greater then Vt than the ball is moving, if the speed is below Vt then it's considered still and will reposition after inRepositionTime seconds.