ballprediction.h
来自「该文件是包含了机器人足球比赛中的整个系统的代码」· C头文件 代码 · 共 97 行
H
97 行
#ifndef BALL_PREDICTION_H
#define BALL_PREDICTION_H
#include "../Common/VisionObject.h"
#define MAX_FRAMES 8
struct BallInfo
{
double x;
double y;
};
class BallPrediction {
public:
enum {
BP_STRAIGHT,
BP_RIGHT,
BP_LEFT
};
struct Ball {
double x;
double y;
double distance;
double heading;
};
class Graham {
public:
Graham();
void LoadParameters(char* filename);
void ProcessFrame();
bool ShouldIDive();
void Clear();
private:
bool IsBallValid();
void AddBallToArray();
void DetermineAction();
// Variables
bool doBallPrediction;
bool debug;
bool firstArray;
bool shouldDive;
int firstCount;
int diveDelayCount;
double deltaX;
int currentIndex;
BallInfo current[MAX_FRAMES];
BallInfo* currentBall;
// Config file variables
double diveBound;
double diveAtTime;
int diveDelay;
double normalBallSpeed;
double fastBallSpeed;
int ignoreFrames;
double minDiveBound;
public:
double ballSpeed;
double time;
double xIntercept;
double diveTime;
};
Graham gMoney;
BallPrediction();
void LoadParameters(char* filename);
void ProcessFrame();
bool CanPredict();
bool ShouldIDive();
void Clear() { gMoney.Clear(); }
bool DoPrediction(int frameAhead);
void AddBallToArray();
void DetermineAction();
int framesBallSeen_;
bool isMovingAway_;
Ball prevBall_[5];
Ball predictedBall_;
bool hadOutlier;
bool shouldDive;
double diveDelay;
};
#endif // BALL_PREDICTION_H
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?