Skip to content

Robocup Class Documentation

Elias Judin edited this page Jun 4, 2021 · 2 revisions

Robocup Class for Python - Contains world data, skills and wrapped functions.

Class Attributes
----------
Constant world model data defined in documentation.
FIELD_Y=20.0               | width of the field (sideline to sideline) (int)
FIELD_X=30.0               | length of the field (goal line to goal line) (int)
HALF_FIELD_Y = FIELD_Y/2.0 | half the width of the field (sideline to sideline) (int)
HALF_FIELD_X = FIELD_X/2.0 | half the length of the field (goal line to goal line) (int)
GOAL_Y = 2.1               | width of goal (int)
GOAL_X = 0.6               | length of goal (int)
GOAL_Z = 0.8               | height of goal (int)
HALF_GOAL_Y = GOAL_Y / 2.0 | half goal y (int)
FIELD_CENTER_X = 0.0       | x coordinate of field centre (int)
FIELD_CENTER_Y = 0.0       | y coordinate of field centre (int)

GOAL_LEFT_CENTRE_X = HALF_FIELD_X   | left goal line midpoint x (int)
GOAL_LEFT_CENTRE_Y = 0              | left goal line midpoint y (int)
GOAL_RIGHT_CENTRE_X = -HALF_FIELD_X | right goal line midpoint x (int)
GOAL_RIGHT_CENTRE_Y = 0             | right goal line midpoint y (int)


Instance Attributes
----------
Variable world  model data passed through wrapper:

__player_number : private int
    the player number for this agent

__play_mode : private int
    the play mode for this game

__side : private int
    the side for this agent's team

__player_pos : private [float x,float y, float z] list
    the agent's x,y,z coordinates on the field     

__ball_pos : private [float x,float y, float z] list
    the ball's x,y,z coordinates on the field    

__team_positions : private [ [[float x,float y, float z], int], [[float x,float y, float z], int], ..., [[float x,float y, float z], int] ] list of lists
    list of the agent's teammates' x,y,z coordinates on the field, paired with each agent's corresponding player number  

__opponent_positions : private [ [[float x,float y, float z], int], [[float x,float y, float z], int], ..., [[float x,float y, float z], int] ] list of lists
    list of the agent's opponents teammates' x,y,z coordinates on the field, paired with each agent's corresponding player number  

Wrapped C++ Functions passed through wrapper:

__team_dist_ball : private [ [float , int], [float , int], ..., [float , int] ] list of lists
    list of the agent's teammates' distance to the ball, paired with each agent's corresponding player number  

__opp_dist_ball : private [ [float , int], [float , int], ..., [float , int] ] list of lists
    list of the agent's opponents teammates' distance to the ball, paired with each agent's corresponding player number 


Methods
----------
Getters (for world model data):

playerNumber():
    returns self.__player_number

playMode():
    returns self.__play_mode

playerPos():
    returns self.__player_pos

gameSide():
    returns self.__side 

ballPos():
    returns self.__ball_pos        

teamPositions():
    returns self.__team_positions 

opponentPositions():
    returns self.__opponent_positions 

Getters with data handling:

teammateLocation(n): [float,float,float]
    returns list of x,y,z coordinates of teammate with player number n

opponentLocation(n): [float,float,float]
    returns list of x,y,z coordinates of opponent with player number n

Getters for Wrapped C++ functions:

teamDistBall(self):
    returns self.__team_dist_ball 

oppsDistBall(self):
    returns self.__opp_dist_ball 

Getters for Wrapped C++ functions with data handling:

teammateDistBall(n): float
    returns teammate with player number n's distance to ball

opponentDistBall(n): float
    returns teammate with player number n's distance to ball

Skills:

STAND():
    returns skill STAND in Doucmentation (player stands still)

GO_TO_POSITION(x,y):
    returns skill GOTO in Documentation, with target coordinate (x,y,0)

DRIBBLE(x,y):
    returns skill DRIBBLE in Documentation, with target coordinate (x,y,0)

SOFT_KICK(x,y):
    returns skill KICK in Documentation, with target coordinate (x,y,0)

HARD_KICK(x,y):
    returns skill KICK_IK in Documentation, with target coordinate (x,y,0)

SMART_GO_TO_POSITION(x,y):
    returns skill SMART_GO_TO_TARGET in Documentation, with target coordinate (x,y,0)

Clone this wiki locally