pointtodecision.cpp
来自「2006年世界杯足球赛2D仿真组第16名的源代码。在此代码上随便改改」· C++ 代码 · 共 77 行
CPP
77 行
/* * Copyright 2002-2005, Mersad Team, Allameh Helli High School (NODET). * * 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. * * 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 Library General Public License for more details. * * This file is created by: Ahmad Boorghany * * Released on Monday 1 August 2005, 10 Mordad 1384 by Mersad RoboCup Team. * For more information please read README file.*/#include <Degree.h>#include <Logger.h>#include <Basics.h>#include <Command.h>#include <PointToDecision.h>using namespace std;// class PointToDecisionPointToDecision::PointToDecision(const WorldModel *worldModel): worldModel(worldModel){}PointToDecision::~PointToDecision(){}void PointToDecision::decide(const Command *headCycleCommand){ LOG << "PointToDecision::decide" << endl; float maxSenseStamina; if (worldModel->getPlayMode() == PM_PLAY_ON) maxSenseStamina = 2500; else maxSenseStamina = 3850; if (worldModel->getBody().getArmMovable() != 0) { pointToCommand = new EmptyCommand(AT_POINTTO_DECISION); return; } if (worldModel->getBody().getStamina() > maxSenseStamina) { if (worldModel->getBody().getArmExpires()) pointToCommand = new PointToCommand(AT_POINTTO_DECISION, false); else pointToCommand = new EmptyCommand(AT_POINTTO_DECISION); } else { float dist = 1000; float dir = Basics::reRate(worldModel->getBody().getStamina(), 1000, maxSenseStamina, 0, 270, RRM_DIRECT); dir = Degree::getDeltaAngle(dir, worldModel->getBody().getHeadDir()); pointToCommand = new PointToCommand(AT_POINTTO_DECISION, dist, dir); }}Command *PointToDecision::getPointToCommand(){ return pointToCommand;}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?