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

📄 dribble.h

📁 robocup源代码2001年清华机器人源代码
💻 H
字号:
/*
    Copyright (C) 2001  Tsinghuaeolus

    Authors : ChenJiang, YaoJinyi, CaiYunpeng, Lishi

    This library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Lesser General Public
    License as published by the Free Software Foundation; either
    version 2.1 of the License, or (at your option) any later version.

    This library 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
    Lesser General Public License for more details.

	If you make any changes or have any comments we would appreciate a 
	message to yjy01@mails.tsinghua.edu.cn.
*/

#ifndef _dribble
#define _dribble

#include "bpn.h"
#include "types.h"
#include "Command.h"
#include "Strategy.h"

class DribbleAccount{ 
public:
	Command NextCmd;
	Vector NextBallPos; 
	DribbleAction draction;
	bool IsCriticalAction;
	int RetainCycle;
	Vector RetainPos;
	DribbleAccount(){draction = DR_NoAction;NextCmd.Reset();IsCriticalAction = false;};
};


class Dribble{
private:
	AngleDeg dribble_angle;

	bool BallInTrace(AngleDeg bodyfacing, Vector ballpos, Vector ballvel,Vector playerpos,Vector playervel,AngleDeg ball_angle,float rapidness,int IT_cycle = 3);
	bool KickAdjust(AngleDeg dribble_angle, AngleDeg ball_angle, float rapidness, DribbleAccount& draccount, Command& command);
	int TryIntercept(AngleDeg dribble_angle,Vector ballpos,Vector ballvel,Vector selfpos,Vector selfvel,float rapidness,int recovercycle = 3); 
	float GetDribbleRadius(AngleDeg ball_angle);
	bool TurnKick(AngleDeg dribble_angle, AngleDeg ball_angle, float rapidness, DribbleAccount& draccount, Command& command,int Turncycle);
public:
	Dribble();
	bool k_StepDribble(AngleDeg dribble_angle, AngleDeg ball_angle, float rapidness);
	bool k_StepDribble(AngleDeg dribble_angle, AngleDeg ball_angle, float rapidness, DribbleAccount& draccount);
	bool k_StepDribble(AngleDeg dribble_angle, AngleDeg ball_angle, float rapidness, DribbleAccount& draccount, Command& command);
	bool DribbleAvoidEnemy(DribbleAccount& draccount,Command& command); 
	bool DribbleAvoidEnemy(DribbleAccount& draccount);
	AngleDeg AvoidEnemyAngle();
	bool holdball(Command& command);
/**************    Strategy **********************/
	bool SmartDribble();
	int num_dribble;
	AngleDeg dribbleangle[12];
	bool CanDribble(AngleDeg dribble_angle); 
	AngleDeg GetBallAngle(AngleDeg dribble_angle,bool dribbleforward = true); 
	bool Covered(Vector pos,UNum opp,Time time, float buf_factor);
	float DRWeightByDistance(float distance);
	void DoDribble(AngleDeg dribble_angle, float priority);
	friend class Handleball;
};

#endif

⌨️ 快捷键说明

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