⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 situation.h

📁 浙江大学 RoboCup3D 2006 源代码
💻 H
字号:
/*************************************************************************** *   Copyright (C) 2004 - 2006 by ZJUBase                                  *
 *                                National Lab of Industrial Control Tech. * *                                Zhejiang University, China               * *                                                                         * *   Achievements of ZJUBase in RoboCup Soccer 3D Simulation League:       *
 *    In RoboCup championship,                                             *
 *      - June 2006 - 3rd place in RoboCup 2006, Bremen, Germany (lost     * *        the semi-final with a coin toss)                                 *
 *      - July 2005 - 3rd place in RoboCup 2005, Osaka, Japan (share the   * *        3rd place with team Caspian)                                     *
 *    In RoboCup local events,                                             *
 *      - April 2006 - 2nd place in RoboCup Iran Open 2006, Tehran, Iran   * *        (lost the final with a coin toss)                                *
 *      - December 2005 - 2nd place in AI Games 2005, Isfahan, Iran        *
 *      - July 2005 - champion in China Robot Competition 2005, Changzhou, * *        China                                                            *
 *      - October 2004 - champion in China Soccer Robot Competition 2004,  * *        Guangzhou, China                                                 *
*                                                                         * *   Team members:                                                         *
 *    Currently the team leader is,                                        * *           Hao JIANG (jianghao@iipc.zju.edu.cn; riveria@gmail.com)       *
 *    In the next season, the leader will be                               * *           Yifeng ZHANG (yfzhang@iipc.zju.edu.cn)                        *
 *    ZJUBase 3D agent is created by                                       * *           Dijun LUO (djluo@iipc.zju.edu.cn)                             *
 *    All the members who has ever contributed:                            * *           Jun JIANG                                                     *
 *           Xinfeng DU (xfdu@iipc.zju.edu.cn)                             *
 *           Yang ZHOU (yzhou@iipc.zju.edu.cn)                             *
 *           Zhipeng YANG                                                  *
 *           Xiang FAN                                                     *
 *                                                                         *
 *   Team Manager:                                                          *
 *      Ms. Rong XIONG (rxiong@iipc.zju.edu.cn)                            *
 *                                                                         *
 *   If you met any problems or you have something to discuss about        * *   ZJUBase. Please feel free to contact us through EMails given below.   * *                                                                         * *   This program is free software; you can redistribute it and/or modify  * *   it under the terms of the GNU General Public License as published by  * *   the Free Software Foundation; either version 2 of the License, or     * *   (at your option) any later version.                                   * *                                                                         * *   This program is distributed in the hope that it will be useful,       * *   but WITHOUT ANY WARRANTY; without even the implied warranty of        * *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         * *   GNU General Public License for more details.                          * *                                                                         * *   You should have received a copy of the GNU General Public License     * *   along with this program; if not, write to the                         * *   Free Software Foundation, Inc.,                                       * *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             * ***************************************************************************/#ifndef SITUATION_H
#define SITUATION_H

#include "Global.h"
#include "soccertypes.h"
#include "ServerSettings.h"
#include "Predictor.h"
#include "math.h"

// add by zy
#define MAX_PASS_DISTANCE 25
#define MAX_AIR_DISTANCE 16.5
#define ALARM 2

const double square_t1=1e-4;
const double coef_dis[8][5]={
{10, 0.0695,	-0.2934,		0.2410,	-0.3092},
{20, 0.1629,	-3.2765,		0.2279,	-0.2920},
{25, 0.1541,	-2.1076,		0.2235,	-0.4849},
{50, 0.1564,   -2.4196,		0.1554,	-0.2699},
{30, 0.2080,   -5.0069,		0.2097,	  0.0417},
{45, 0.1574,	-1.9228,		0.1713,	-0.2212},
{35, 0.1798,	-2.7292,		0.2020,	-0.4385},
{40, 0.1823,	-3.1515,		0.1821,	  0.0449},
};

typedef struct tagITInfo
{
	int nCyc;
	Vector3 IT_point;

	//=========
	double dDist2Ball;

}ITInfo;

class Situation  
{
	void AddMap(string s, int (*)(void));

public:
	static ITInfo our_ITInfo[11];
	static ITInfo opp_ITInfo[11];
	static ITInfo myITInfo;

	//===============
	static int ourByITCyc[11];
	static int oppByITCyc[11];
	static int ourByDist2Ball[11];
	static int oppByDist2Ball[11];

	//===============
	Situation();
	virtual ~Situation();
	static string m_DebugMessage;
	static ServerSettings *SS;

	//=======================
	static double shoot_prob;
	static double shoot_ang;

	//=======================
	static string getThinkNodeConsiderValue(string considerValue);
	static map<TPlayMode,string> m_PlayModeStringMap;
	void Init(ServerSettings *ss);
	static Vector3 GetVectorFromString(char* str);
	static void AddDebugMessage(const char *str, ...);
	static void updateSituation();
	static bool isBallKickable();	static bool isBallCatchable();
	static bool shouldIIntercept();
	static bool shouldICatchWhenInter();
	static bool shouldIStopBall();
	static bool canIReachBallin3Cycs();
	static bool canIPassTo(int number,double &power);
	static bool canIDribbleTo(const Vector3& dest);
	static bool isNearBall();
	static bool isBallInAir();
	static bool isShootable();
	static bool isGoThrough();

	//======================
	static bool shouldIDribble(bool isShoot);
	static bool isDribbleSafe();
	static double Normal_School(double u, double a, double x);
	static bool shouldITurn(bool isShoot);
	static Vector3 passToMid();

	//======================
	static bool isSomeOppBlocking(Vector3 ball,Angle ang,Angle &goover);

	//=============================
	static int IControlTheBall();
	static int MyITCycle();

	//=============================
	static double angBallMe();
	static int isPlayOn();
	static int CalCharactor(string s);
	static bool isDeadBall();
	static bool isBallInOurControl();
	static bool isBallInOppControl();
	static bool isBallInBothControl();	
	static bool isBallBeingInOurControl();
	static bool isBallBeingInOppControl();
	static bool isBallBeingInBothControl();

	//==================================
	static void getConsiderPassPoint(vector<Vector3>& points, double maxDis = -1);
	static Vector3 getBestPassPoint(double maxDis = -1);
	static bool getPassVel(double &power, double & theta, double start = -1, double end = -1);
	static bool getPassVel(double &power, double & theta, bool &isShoot, double start = -1, double end = -1);
	static Angle getKickAngle();
	static Vector3 getWhereToKickTo(double start = -1, double end = -1);
	static void getAngInc(Angle &panAngInc,Angle &tiltAngInc);	
	static Angle getNextPanAng();		
	static void getShootVel(Angle &theta,double &power,Angle kick_ang);
	//static double EvaluatePassPoint(Vector3 p);
	static Vector3 EvaluatePassPoint(Vector3 p);
	static Vector3 EvaluatePosVal(Vector3 p);
	static bool shouldIKickOff();		// 判断是否由我来发球(角球或边线球)

	//==============================//停球
	//static bool shouldIStopBall(Vector3& target);
	static int getKickPower(Vector3 destPos, double &theta, double &power);	// add by zy

	//========================================================//碰撞add by fx
	static bool isBallInCollisionWithMe();
	static BallStatus getBallStatusAfterCollisionWithMe();
	static bool isBallInCollisionWithMe(int & nCycT1, Vector3 & ballPosT1, Vector3 & ballVelT1);
	static BallStatus getBallStatusAfterCollisionWithMe(const int nCycT1, const Vector3 ballposT1, const Vector3 ballVelT1);
	static bool isBallOverlapAgent(Circle ball, Circle agent);
	static bool isBallInCollisionWithField(int & nCycT1, Vector3 &ballPosT1, Vector3 &ballVelT1);
	static BallStatus getBallStatusAfterCollisionWithField(const int nCycT1, const Vector3 ballPosT1, const Vector3 ballVelT1);
	static Vector3 t20Tot1(const Vector3 V20);
	static Vector3 t1Tot20(const Vector3 V1);
	//========================================================

};

#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -