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

📄 decisionmakingx.h

📁 仿真机器人的经典代码
💻 H
字号:
// DecisionMakingx.h: interface for the CDecisionMakingx class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_DECISIONMAKINGX_H__E1F060A5_484F_4338_B877_7B533844419F__INCLUDED_)
#define AFX_DECISIONMAKINGX_H__E1F060A5_484F_4338_B877_7B533844419F__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include "globe.h"
#include "geometry.h"
#include "defines.h"
class CDecisionMakingx  
{
public:

	CDecisionMakingx();
	virtual ~CDecisionMakingx();

	DecisionParamter m_decisionparamter;
	double  SolveRadius(dbPOINT Target);
	//计算直线和球门的交点
	double GetCrossPtWithGLLine(double x);
	double GetCrossPtWithGLLine();
	//预测球的位置
	BallInformation ForcastBall(BallInformation ball, int step);
	//预测球的运动直线、方向和速度
	int forcastball(dbPOINT *pPoint,FORCASTBALL *pBall);
	//计算中分点
	dbPOINT GetMidPoint(dbROBOTPOSTURE* pRobotInford, BallInformation ball,double deta_y);
	dbPOINT GetMidPoint(dbROBOTPOSTURE* pRobotInford, BallInformation ball,dbPOINT shoot_target,double deta_y);
//基本动作函数类
	double m_Front;
	AngleParameter m_AngleParameter;
protected:
	int Circle(double CircleRadius, double RefVelocity, dbLRWheelVelocity* pWheelVelocity);
	int CirclePassTarget(dbROBOTPOSTURE* pROBOTPOSTURE,dbPOINT Target,double SameSpeed,int clockwise,dbLRWheelVelocity* pLRWheelVelocity);
	int Turn(double dbVelocity,int clock,dbLRWheelVelocity *pSpeed);//1#
	int TurnTo(dbROBOTPOSTURE* robot, ballInformation ball, dbPOINT target,/*int wNo,*/int Vbase,dbLRWheelVelocity *pSpeed);
	int TurnToPointPD(dbROBOTPOSTURE *pRobot,dbPOINT Point,int clock,dbLRWheelVelocity *pSpeed);//2#	
	int s_TurnToPointPD(dbROBOTPOSTURE *pRobot,dbPOINT Point,dbLRWheelVelocity *pSpeed);//2#	
	int TurnToAnglePD(dbROBOTPOSTURE *pRobot,double dbAngle,int clock,dbLRWheelVelocity *pSpeed);//3#
	int s_TurnToAnglePD(dbROBOTPOSTURE *pRobot,double dbAngle,dbLRWheelVelocity *pSpeed);//3#
	int MoveOnAngle(dbROBOTPOSTURE *pRobot,double Angle,double speed,dbLRWheelVelocity *pSpeed);//4#
	int s_MoveOnAngle(dbROBOTPOSTURE *pRobot,double Angle,double speed,dbLRWheelVelocity *pSpeed);//4#

void CDecisionMakingx::Position( dbROBOTPOSTURE *robot, double x, double y,dbLRWheelVelocity* pLRWheelVelocity );

	MoveParameter m_MoveParameter;
	//以余弦曲线到定点
	int Move2Pt(dbROBOTPOSTURE* pRobot,dbPOINT Target,dbLRWheelVelocity* pWheelVelocity);//5#
	int s_Move2Pt(dbROBOTPOSTURE* pRobot,dbPOINT Target,dbLRWheelVelocity* pWheelVelocity);//5#
	//以余弦曲线且按给定的速度到定点
	int Move2Pt(dbROBOTPOSTURE* pRobot,dbPOINT Target,double speed,dbLRWheelVelocity* pLRWheelVelocity);//7#
	int s_Move2Pt(dbROBOTPOSTURE* pRobot,dbPOINT Target,double speed,dbLRWheelVelocity* pLRWheelVelocity);//7#
	int ToPositionPD(dbROBOTPOSTURE* pRobot,dbPOINT Target,double same_speed,double end_speed,dbLRWheelVelocity* pLRWheelVelocity);//8#
	int s_ToPositionPD(dbROBOTPOSTURE* pRobot,dbPOINT Target,double same_speed,double end_speed,dbLRWheelVelocity* pLRWheelVelocity);//8#
	int ToPositionNew(dbROBOTPOSTURE* robot, ballInformation ball,dbPOINT directionpt, double samespeed, int IfEndprocess,dbLRWheelVelocity* pSpeed);
	int ToPositionN(dbROBOTPOSTURE* robot,dbPOINT directionpt, double samespeed, dbLRWheelVelocity* pSpeed);
	int ToPositionPDGoal(dbROBOTPOSTURE* pROBOTPOSTURE,dbPOINT Target,double startspeed,double endspeed,dbLRWheelVelocity* pLRWheelVelocity);
//技术动作集合
	//防止碰撞边界
	int AvoidBound(dbROBOTPOSTURE *pRobot,dbLRWheelVelocity *pSpeed);
	//边界球处理
	int BoundProcess(dbROBOTPOSTURE *pRobot, BallInformation Ball,int field,dbLRWheelVelocity *pSpeed);
	//防守
	int Defence(dbROBOTPOSTURE *pRobot,BallInformation ball,dbLRWheelVelocity *pSpeed);
	int AttackAction(dbROBOTPOSTURE *pRobot,BallInformation ball,dbLRWheelVelocity *pSpeed);
	//射门
	int Vect_MidShoot2(dbROBOTPOSTURE pRobotInford, BallInformation &ball,dbPOINT shoot_target,int endP,dbLRWheelVelocity *pSpeed);
	//末端处理
	int EndProcess(dbROBOTPOSTURE *pRobot,dbPOINT shoot_target,dbPOINT ballPt,dbLRWheelVelocity *pSpeed);

//组合动作集合	
	void RobotReturn2Pt();//归位	
	void LefPenaltyOnly();//点球大战
	void FreeBallKick();//争球	
	void PenaltyOrFree_Kick(int nFlag);//点球或者任意球	
	void LefGoalKick();//门球



////////////////////////////////////////////////////xue/////////
public:
	int					modesave;
	BOOL				bKickOff;

	int					ROBOTAMOUNT;
	int					timer;
	int					starttimer;
	DEGame				dmDEG;
	int					currentResult[12],oldResult[12];//按照机器人顺序排列时对应的角色排列
	int					currentOrder[12],oldOrder[12];//按照角色顺序排列时对应的机器人排列
	int					robotCharacter[12];
	int					currentForm[12],oldForm[12];//队形	尚未初始化
	int					dmformNo,dmbfNo;
	AccessParameter		chartarget[12];
	RobotInford			Robot[12];
	FORCASTBALL         ballCharacter;
	BallInformation		oldBallPt[7];
	BallInformation		ball;
	dbLRWheelVelocity	rbV[12];
	double	perfRecord[12],oldperfRecord[12];
	int	effecChar[100];
	//界面显示角色内容
//	CString	charac[200];
	BOOL	chartest;
	int		chartestNo;
protected:
	double TNpara(RobotInford myrobot,dbPOINT ball,dbPOINT goal,double dist,double angle);
	int swL;
public:	
	int		GetBoundDefenceNo(dbPOINT ballPt);
	int		GetAreaNo(BallInformation ball);
protected:
	double Limit(double value,double limitation);
	int	GoalieAction2(dbROBOTPOSTURE* pRobotInford,int x, BallInformation ball,dbLRWheelVelocity *pSpeed);
	int CDecisionMakingx::GoalieAction(dbROBOTPOSTURE* pRobotInford, BallInformation ball,dbLRWheelVelocity *pSpeed);
	int GoalKeeperx(RobotInford myRobot,dbPOINT ballPt,dbLRWheelVelocity* pSpeed);
	double GetCharPerformance(RobotInford myRobot,dbPOINT ball,dbPOINT dpt);
	int		taskDecompose(int areaNo);
	void	formInterpret(int formNo, int bfNo);
	void	charAllot();
	double	charPerformance(int charNo, dbROBOTPOSTURE* pRobot);
	int		GetBestRobot(double Performance[12], int charNo);
	void	robotManager();
	void	actProcess();
	//角色解释函数
	void	charInterpret(int robotNo,int charNo, dbLRWheelVelocity* rbV);

	//角色函数集合
	//守门
	int GoalieAction1(dbROBOTPOSTURE* pRobotInford, BallInformation ball,dbLRWheelVelocity *pSpeed);//12
	//避障到定点
	int AvoidPt2Pt(dbROBOTPOSTURE* pRobotInford, dbPOINT &obsPt, dbPOINT &target,dbLRWheelVelocity *pSpeed);//10
	//射门
	int Vect_MidShoot(dbROBOTPOSTURE* pRobotInford, BallInformation &ball,dbLRWheelVelocity *pSpeed);//11
	int Vect_MidShoot1(dbROBOTPOSTURE pRobotInford, BallInformation &ball,dbLRWheelVelocity *pSpeed);
	//扫球
	int ClearBall(dbROBOTPOSTURE *pRobot,ballInformation ball ,dbLRWheelVelocity *pSpeed);//8
	//带球至对方球门
	int		DribleBall(dbROBOTPOSTURE *pRobot,ballInformation ball ,dbLRWheelVelocity *pSpeed);
	int		ptWait(RobotInford charRobot,dbPOINT pt,dbPOINT ball,dbLRWheelVelocity &rbV);
	int		ParallelDefence(RobotInford charRobot,dbPOINT ball,double x,double y,dbLRWheelVelocity &rbV);
	int		PushBallofBound(RobotInford charRobot,dbPOINT ball,dbLRWheelVelocity &rbV);
	BOOL	IsAcute(RobotInford rb,dbPOINT ball,dbPOINT directPt);
	double	Getpt2ptAngle(dbPOINT pt1,dbPOINT pt2);
	int		GetBoundAreaNo(dbPOINT pt);
	int		BoundPushBall(RobotInford charRobot,dbPOINT ballPt,dbLRWheelVelocity &rbV);
	int		BoundDefence(RobotInford charRobot,dbPOINT ballPt,int boundNo,double x,double y,dbLRWheelVelocity &rbV);
	int		AvoidHitWall(dbROBOTPOSTURE *pRobot, dbPOINT ball, int wallNo, dbLRWheelVelocity &pSpeed);
	//////////////////////xue//////////////////////
	/////////////////////////////////////////////////
	//初始化函数
public:	
	void KickOff();
	void InitDEG(DEGame DEG);
	void Initialize();
	//决策入口
	void Startx(RobotInford dmRobot[11]);
	//各项赛事
	//SMIu5
	void Simu5Decision();
	//SMIu11
	void Simu11Decision();
	//MIROSOT
	void MiroSot_DecisionMaking();
	//narosot
	void NaroDecision();
	//正常开球
	void LefNormalDecision(int nFlag);
	//信息预处理
	void preProcess();
};
#endif // !defined(AFX_DECISIONMAKINGX_H__E1F060A5_484F_4338_B877_7B533844419F__INCLUDED_)

⌨️ 快捷键说明

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