?? forwardplan.cpp
字號:
/* * 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: Sassan Haradji * * Released on Monday 1 August 2005, 10 Mordad 1384 by Mersad RoboCup Team. * For more information please read README file.*/#include <BasicDash.h>#include <AdvancedAgent.h>#include <ForwardPlan.h>#include <DefBreakerPlan.h>#include <MoveToForwardPlan.h>#include <WaitPlan.h>#include <GotoSidePlan.h>#include <DribblePlan.h>#include <Logger.h>#include <Basics.h>#include <cassert>using namespace std;using namespace Basics;ForwardPlan::ForwardPlan(const WorldModel *wm, Form &form, const Library &library): Plan("Forward", wm, form, library){}ForwardPlan::~ForwardPlan(){}void ForwardPlan::decide(){ LOG << "ForwardPlan::decide" << endl; string hearString = wm->getHearedPlanInfo(); if (hearString == "XGSPL" && library.gwSelection == WOBS_INTERCEPT) if (isInPlayers(wm->getBody().getUniNum(), "5234B")) startPlan(new GotoSidePlan(wm, form, library, SI_LEFT)); if (hearString == "XGSPR" && library.gwSelection == WOBS_INTERCEPT) if (isInPlayers(wm->getBody().getUniNum(), "5234A")) startPlan(new GotoSidePlan(wm, form, library, SI_RIGHT));/* if (!subPlans.empty()) if (subPlans.top()->getName() != "DefBreaker" && wm->isBallKickable()) if (isInPlayers(wm->getBody().getUniNum(), "AB")) startPlan(new DefBreakerPlan(wm, form, library), .32); else if (isInPlayers(wm->getBody().getUniNum(), "234")) startPlan(new DefBreakerPlan(wm, form, library), .34); else if (isInPlayers(wm->getBody().getUniNum(), "78")) startPlan(new DefBreakerPlan(wm, form, library), .4);*/ Plan::decide(); startPlan(new MoveToForwardPlan(wm, form, library, 3.5)); int uniNum = wm->getBody().getUniNum(); if (isInPlayers(uniNum, "35")) uniNum = (wm->getBody().getPos().getY() > 0)?4:2; switch (uniNum) { case 2: case 10: startPlan(new WaitPlan(wm, form, library, SI_LEFT)); startPlan(new GotoSidePlan(wm, form, library, SI_RIGHT)); break; case 4: case 11: startPlan(new WaitPlan(wm, form, library, SI_RIGHT)); startPlan(new GotoSidePlan(wm, form, library, SI_LEFT)); break; } startPlan(new MoveToForwardPlan(wm, form, library, 2.2)); startPlan(bestPlan(2, true, new PassPlan(wm, form, library, BPM_ALL, BPN_ALL, -180, 180, -180, 180), new DribblePlan(wm, form, library))); LOG << name << " Plan WARNING!!! : " << "All WithBall Plans Finished Without Return Any Command." << endl; LOG << name << " Plan : " << "Now Run Dribble Plan Without Check SuccessRate or isFinished" << "(Urgent State)." << endl; DribblePlan dribblePlan(wm, form, library); dribblePlan.decide(); LOG << "ForwardPlan Now Kill Program" << endl; assert(0);}double ForwardPlan::successRate(){ return 1.0;}bool ForwardPlan::isFinished(){ if(isInPlayers(wm->getBody().getUniNum(), "234") || (isInPlayers(wm->getBody().getUniNum(), "5AB") && wm->getBody().getPos().getX() >= -20)) return false; return true;}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -