📄 soccertypes.h
字号:
/*
Copyright (c) 2000-2003, Jelle Kok, University of Amsterdam
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
3. Neither the name of the University of Amsterdam nor the names of its
contributors may be used to endorse or promote products derived from this
software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/*! \file SoccerTypes.h
<pre>
<b>File:</b> SenseHandler.h
<b>Project:</b> Robocup Soccer Simulation Team: UvA Trilearn
<b>Authors:</b> Jelle Kok
<b>Created:</b> 28/11/2000
<b>Last Revision:</b> $ID$
<b>Contents:</b> This file contains the different enumerations and
constants that are important in the Soccer Server.
Furthermore it contains the class SoccerCommand which is
used to denote the different possible soccer commands and
the class SoccerTypes that contains all kind of static
methods to translate text strings that are received from
the server into the soccer types (=enumerations) that
are defined here. Finally it contains the Time class which
holds a two-tuple that represents the time in the soccer server.
<hr size=2>
<h2><b>Changes</b></h2>
<b>Date</b> <b>Author</b> <b>Comment</b>
28/11/2000 Jelle Kok Initial version created
</pre>
*/
#ifndef _SOCCERTYPES_
#define _SOCCERTYPES_
#include <iostream> // needed for output stream.
#include "Geometry.h" // needed for AngDeg
#include "ServerSettings.h"
/*****************************************************************************/
/********************* DEFINES ***********************************************/
/*****************************************************************************/
#define MAX_TEAMMATES 11 /*!< Maximum number of teammates */
#define MAX_OPPONENTS 11 /*!< Maximum number of opponents */
#define MAX_HETERO_PLAYERS 7 /*!< Maximum number of hetero players*/
#define MAX_MSG 4096 /*!< maximum message size from server*/
#define MAX_SAY_MSG 10 /*!< maximum size of say message */
#define MAX_TEAM_NAME_LENGTH 64 /*!< maximum length of teamname */
#define MAX_FLAGS 55 /*!< maximum number of flags on field*/
#define MAX_LINES 4 /*!< maximum number of lines on field*/
#define DEFAULT_TEAM_NAME "Team_L" /*!< default teamname for own team */
#define DEFAULT_OPPONENT_NAME "Team_R" /*!< default teamname for opponent */
#define PITCH_LENGTH 105.0 /*!< length of the pitch */
#define PITCH_WIDTH 68.0 /*!< width of the pitch */
#define PITCH_MARGIN 5.0 /*!< margin next to the pitch */
#define PENALTY_AREA_LENGTH 16.5 /*!< length of the penalty area */
#define PENALTY_AREA_WIDTH 40.32 /*!< width of the penalty area */
#define PENALTY_X (PITCH_LENGTH/2.0-PENALTY_AREA_LENGTH) /*!< penalty line of
the opponent team */
/*****************************************************************************/
/********************* CONSTANTS *********************************************/
/*****************************************************************************/
const double UnknownDoubleValue = -1000.0; /*!< indicates unknown double */
const AngDeg UnknownAngleValue = -1000.0; /*!< indicates unknown angle */
const int UnknownIntValue = -1000; /*!< indicates unknown int */
const int UnknownTime = -20; /*!< indicates unknown time */
const long UnknownMessageNr = -30; /*!< indicates unknown messagenr*/
/*****************************************************************************/
/********************** ENUMERATIONS *****************************************/
/*****************************************************************************/
/*! ObjectT is an enumeration of all possible objects that are part of the
RoboCup soccer simulation. The class SoccerTypes contains different methods
to easily work with these objects and convert them to text strings and text
strings to ObjectT. */
enum ObjectT { // don't change order
OBJECT_BALL, /*!< Ball */
OBJECT_GOAL_L, /*!< Left goal */ // 2 goals
OBJECT_GOAL_R, /*!< Right goal */
OBJECT_GOAL_UNKNOWN, /*!< Unknown goal */
OBJECT_LINE_L, /*!< Left line */ // 4 lines
OBJECT_LINE_R, /*!< Right line */
OBJECT_LINE_B, /*!< Bottom line */
OBJECT_LINE_T, /*!< Top line */
OBJECT_FLAG_L_T, /*!< Flag left top */ // 53 flags
OBJECT_FLAG_T_L_50, /*!< Flag top left 50 */
OBJECT_FLAG_T_L_40, /*!< Flag top left 40 */
OBJECT_FLAG_T_L_30, /*!< Flag top left 30 */
OBJECT_FLAG_T_L_20, /*!< Flag top left 20 */
OBJECT_FLAG_T_L_10, /*!< Flag top left 10 */
OBJECT_FLAG_T_0, /*!< Flag top left 0 */
OBJECT_FLAG_C_T, /*!< Flag top center */
OBJECT_FLAG_T_R_10, /*!< Flag top right 10 */
OBJECT_FLAG_T_R_20, /*!< Flag top right 20 */
OBJECT_FLAG_T_R_30, /*!< Flag top right 30 */
OBJECT_FLAG_T_R_40, /*!< Flag top right 40 */
OBJECT_FLAG_T_R_50, /*!< Flag top right 50 */
OBJECT_FLAG_R_T, /*!< Flag right top */
OBJECT_FLAG_R_T_30, /*!< Flag right top 30 */
OBJECT_FLAG_R_T_20, /*!< Flag right top 20 */
OBJECT_FLAG_R_T_10, /*!< Flag right top 10 */
OBJECT_FLAG_G_R_T, /*!< Flag goal right top */
OBJECT_FLAG_R_0, /*!< Flag right 0 */
OBJECT_FLAG_G_R_B, /*!< Flag goal right bottom */
OBJECT_FLAG_R_B_10, /*!< Flag right bottom 10 */
OBJECT_FLAG_R_B_20, /*!< Flag right bottom 20 */
OBJECT_FLAG_R_B_30, /*!< Flag right bottom 30 */
OBJECT_FLAG_R_B, /*!< Flag right bottom */
OBJECT_FLAG_B_R_50, /*!< Flag bottom right 50 */
OBJECT_FLAG_B_R_40, /*!< Flag bottom right 40 */
OBJECT_FLAG_B_R_30, /*!< Flag bottom right 30 */
OBJECT_FLAG_B_R_20, /*!< Flag bottom right 20 */
OBJECT_FLAG_B_R_10, /*!< Flag bottom right 10 */
OBJECT_FLAG_C_B, /*!< Flag center bottom */
OBJECT_FLAG_B_0, /*!< Flag bottom 0 */
OBJECT_FLAG_B_L_10, /*!< Flag bottom left 10 */
OBJECT_FLAG_B_L_20, /*!< Flag bottom left 20 */
OBJECT_FLAG_B_L_30, /*!< Flag bottom left 30 */
OBJECT_FLAG_B_L_40, /*!< Flag bottom left 40 */
OBJECT_FLAG_B_L_50, /*!< Flag bottom left 50 */
OBJECT_FLAG_L_B, /*!< Flag left bottom */
OBJECT_FLAG_L_B_30, /*!< Flag left bottom 30 */
OBJECT_FLAG_L_B_20, /*!< Flag left bottom 20 */
OBJECT_FLAG_L_B_10, /*!< Flag left bottom 10 */
OBJECT_FLAG_G_L_B, /*!< Flag goal left bottom */
OBJECT_FLAG_L_0, /*!< Flag left 0 */
OBJECT_FLAG_G_L_T, /*!< Flag goal left top */
OBJECT_FLAG_L_T_10, /*!< Flag left bottom 10 */
OBJECT_FLAG_L_T_20, /*!< Flag left bottom 20 */
OBJECT_FLAG_L_T_30, /*!< Flag left bottom 30 */
OBJECT_FLAG_P_L_T, /*!< Flag penaly left top */
OBJECT_FLAG_P_L_C, /*!< Flag penaly left center */
OBJECT_FLAG_P_L_B, /*!< Flag penaly left bottom */
OBJECT_FLAG_P_R_T, /*!< Flag penaly right top */
OBJECT_FLAG_P_R_C, /*!< Flag penaly right center */
OBJECT_FLAG_P_R_B, /*!< Flag penaly right bottom */
OBJECT_FLAG_C, /*!< Flag center field */
OBJECT_TEAMMATE_1, /*!< Teammate nr 1 */ // teammates 61
OBJECT_TEAMMATE_2, /*!< Teammate nr 2 */
OBJECT_TEAMMATE_3, /*!< Teammate nr 3 */
OBJECT_TEAMMATE_4, /*!< Teammate nr 4 */
OBJECT_TEAMMATE_5, /*!< Teammate nr 5 */
OBJECT_TEAMMATE_6, /*!< Teammate nr 6 */
OBJECT_TEAMMATE_7, /*!< Teammate nr 7 */
OBJECT_TEAMMATE_8, /*!< Teammate nr 8 */
OBJECT_TEAMMATE_9, /*!< Teammate nr 9 */
OBJECT_TEAMMATE_10, /*!< Teammate nr 10 */
OBJECT_TEAMMATE_11, /*!< Teammate nr 11 */
OBJECT_TEAMMATE_UNKNOWN, /*!< Teammate nr unkown */
OBJECT_OPPONENT_1, /*!< Opponent nr 1 */ // opponents 73
OBJECT_OPPONENT_2, /*!< Opponent nr 2 */
OBJECT_OPPONENT_3, /*!< Opponent nr 3 */
OBJECT_OPPONENT_4, /*!< Opponent nr 4 */
OBJECT_OPPONENT_5, /*!< Opponent nr 5 */
OBJECT_OPPONENT_6, /*!< Opponent nr 6 */
OBJECT_OPPONENT_7, /*!< Opponent nr 7 */
OBJECT_OPPONENT_8, /*!< Opponent nr 8 */
OBJECT_OPPONENT_9, /*!< Opponent nr 9 */
OBJECT_OPPONENT_10, /*!< Opponent nr 10 */
OBJECT_OPPONENT_11, /*!< Opponent nr 11 */
OBJECT_OPPONENT_UNKNOWN, /*!< Opponent nr unknown */ // 84
OBJECT_PLAYER_UNKNOWN, /*!< Unknown player */
OBJECT_UNKNOWN, /*!< Unknown object */
OBJECT_TEAMMATE_GOALIE, /*!< Goalie of your side */
OBJECT_OPPONENT_GOALIE, /*!< Goalie of opponent side */
OBJECT_ILLEGAL, /*!< illegal object */
OBJECT_MAX_OBJECTS, /*!< maximum nr of objects */ // 90
} ;
/*!The ObjectSetT enumerations holds the different object sets, which
consists of one or multiple ObjectT types. */
enum ObjectSetT
{
OBJECT_SET_TEAMMATES, /*!< teammates */
OBJECT_SET_OPPONENTS, /*!< opponents */
OBJECT_SET_PLAYERS, /*!< players */
OBJECT_SET_TEAMMATES_NO_GOALIE,/*!< teammates without the goalie */
OBJECT_SET_FLAGS, /*!< flags */
OBJECT_SET_LINES, /*!< lines */
OBJECT_SET_ILLEGAL /*!< illegal */
} ;
/*!The PlayModeT enumeration contains all playmodes of the soccer playmode.
The associated string values can be returned using the methods in the
SoccerTypes class */
enum PlayModeT {
PM_BEFORE_KICK_OFF, /*!< before_kick_off: before kick off */
PM_KICK_OFF_LEFT, /*!< kick_off_l: kick off for left team */
PM_KICK_OFF_RIGHT, /*!< kick_off_r: kick off for right team */
PM_KICK_IN_LEFT, /*!< kick_in_l: kick in for left team */
PM_KICK_IN_RIGHT, /*!< kick_in_r: kick in for right team */
PM_CORNER_KICK_LEFT, /*!< corner_kick_l: corner kick left team */
PM_CORNER_KICK_RIGHT, /*!< corner_kick_r: corner kick right team */
PM_GOAL_KICK_LEFT, /*!< goal_kick_l: goal kick for left team */
PM_GOAL_KICK_RIGHT, /*!< goal_kick_r: goal kick for right team*/
PM_GOAL_LEFT, /*!< goal_l: goal scored by team left*/
PM_GOAL_RIGHT, /*!< goal_r: goal scored by team righ*/
PM_FREE_KICK_FAULT_LEFT, /*!< free_kick_fault_l: free_kick to yourself */
PM_FREE_KICK_FAULT_RIGHT, /*!< free_kick_fault_r: free_kick to self */
PM_FREE_KICK_LEFT, /*!< free_kick_l: free kick for left team */
PM_FREE_KICK_RIGHT, /*!< free_kick_r: free kick for right team*/
PM_INDIRECT_FREE_KICK_RIGHT,/*!<indirect_free_kick_r: ind. free kick right */
PM_INDIRECT_FREE_KICK_LEFT,/*!< indirect_free_kick_l: ind. free kick left */
PM_BACK_PASS_LEFT, /*!< back_pass_l: left team passed back */
PM_BACK_PASS_RIGHT, /*!< back_pass_r: right team passed back */
PM_OFFSIDE_LEFT, /*!< offside_l: offside for left team */
PM_OFFSIDE_RIGHT, /*!< offside_r: offside for right team */
PM_PLAY_ON, /*!< play_on: play on (during match) */
PM_TIME_OVER, /*!< time_over: time over (after match) */
PM_PENALTY_SETUP_LEFT, /*!< penalty_setup_left left setups for penalty */
PM_PENALTY_SETUP_RIGHT, /*!< penalty_setup_right right setup for penalty*/
PM_PENALTY_READY_LEFT, /*!< penalty_ready_left ready for penalty l team*/
PM_PENALTY_READY_RIGHT, /*!< penalty_ready_right ready for pen r team */
PM_PENALTY_TAKEN_LEFT, /*!< penalty_taken_left penalty started left */
PM_PENALTY_TAKEN_RIGHT, /*!< penalty_taken_right penalty started right */
PM_FROZEN, /*!< game play is frozen */
PM_QUIT, /*!< quit */
PM_ILLEGAL /*!< unknown playmode */
} ;
/*! The RefereeT enumeration contains all messages that the referee can sent.
The SoccerTypes class contains different methods to convert these messages
to the corresponding playmode. */
enum RefereeMessageT {
REFC_ILLEGAL, /*!< unknown message */
REFC_BEFORE_KICK_OFF, /*!< before_kick_off: before kick off */
REFC_KICK_OFF_LEFT, /*!< kick_off_l: kickoff for left team */
REFC_KICK_OFF_RIGHT, /*!< kick_off_r: kickoff for right team*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -