diff --git a/simulation/qtcreator-files/paprikaSimulateur/paprikaSimulateur.pro b/simulation/qtcreator-files/paprikaSimulateur/paprikaSimulateur.pro index ccd29396620b4e0c7b6e63ff240323c8b5ee7cb3..99080899d1d084420533d8b20d94348ed723fa97 100644 --- a/simulation/qtcreator-files/paprikaSimulateur/paprikaSimulateur.pro +++ b/simulation/qtcreator-files/paprikaSimulateur/paprikaSimulateur.pro @@ -88,9 +88,6 @@ HEADERS += \ ../../include/simul/asservwindow.h \ ../../include/simul/sharpwindow.h \ ../../include/simul/watchwindow.h \ - ../../include/strategie/manipulationCoinGaucheHaut.h \ - ../../include/strategie/manipulationCoinGaucheBas.h \ - ../../include/strategie/manipulationCoinGaucheHautPiedSolitaire.h \ ../../include/vec3d.h \ ../../include/vec2d.h \ ../../include/interfaceServosNumeriques.h \ @@ -168,9 +165,6 @@ SOURCES += \ ../../src/simul/asservwindow.cpp \ ../../src/simul/sharpwindow.cpp \ ../../src/simul/watchwindow.cpp \ - ../../src/strategie/manipulationCoinGaucheHaut.cpp \ - ../../src/strategie/manipulationCoinGaucheBas.cpp \ - ../../src/strategie/manipulationCoinGaucheHautPiedSolitaire.cpp \ ../../src/vec3d.cpp \ ../../src/vec2d.cpp \ ../../src/InitKrabiJunior.cpp \ diff --git a/stm32/include/strategie/etape.h b/stm32/include/strategie/etape.h index 4c75028cb4b44b262a732ffec642a25ed88f3bf0..508d89245037dfed81efea7d545974954d8f6c44 100644 --- a/stm32/include/strategie/etape.h +++ b/stm32/include/strategie/etape.h @@ -28,18 +28,7 @@ public: POINT_PASSAGE = 0, COLLECT = 1, - DEPART = 5, - - COIN_GAUCHE_HAUT = 24, - COIN_GAUCHE_BAS = 25, - SPOT_SOLITAIRE_COIN = 26, - - ROBOT_POINT_PASSAGE = POINT_PASSAGE + ROBOT_VU_ICI, - ROBOT_DEPART = DEPART + ROBOT_VU_ICI, - - ROBOT_COIN_GAUCHE_HAUT = COIN_GAUCHE_HAUT + ROBOT_VU_ICI, - ROBOT_COIN_GAUCHE_BAS = COIN_GAUCHE_BAS + ROBOT_VU_ICI, - ROBOT_SPOT_SOLITAIRE_COIN = SPOT_SOLITAIRE_COIN + ROBOT_VU_ICI + DEPART = 5 }; diff --git a/stm32/include/strategie/krabi2016.h b/stm32/include/strategie/krabi2016.h index f39656529dd0f1327568e09700b36a3ba9dfe13b..45408483da7fb91e40bef803727a96e009a21274 100644 --- a/stm32/include/strategie/krabi2016.h +++ b/stm32/include/strategie/krabi2016.h @@ -9,9 +9,6 @@ #include "etape.h" #include "zoneConstruction.h" #include "cabine.h" -#include "manipulationCoinGaucheBas.h" -#include "manipulationCoinGaucheHaut.h" -#include "manipulationCoinGaucheHautPiedSolitaire.h" #include "benne.h" #include "dune.h" #include "cubeDebut.h" diff --git a/stm32/include/strategie/manipulationCoinGaucheBas.h b/stm32/include/strategie/manipulationCoinGaucheBas.h deleted file mode 100644 index 440233fb6024a5039b6d1be0476e1611c6a03ec3..0000000000000000000000000000000000000000 --- a/stm32/include/strategie/manipulationCoinGaucheBas.h +++ /dev/null @@ -1,20 +0,0 @@ -#ifndef MANIPULATION_COIN_GAUCHE_BAS_H -#define MANIPULATION_COIN_GAUCHE_BAS_H - -#include "position.h" -#include "mediumLevelAction.h" -#include "command.h" - -class ManipulationCoinGaucheBas : public MediumLevelAction -{ - public : - ManipulationCoinGaucheBas(Position positionDepart, bool isYellow); - ~ManipulationCoinGaucheBas(); - int update(); - Etape::EtapeType getType(); - - private : - bool isYellow; -}; - -#endif // MANIPULATION_COIN_GAUCHE_BAS_H diff --git a/stm32/include/strategie/manipulationCoinGaucheHaut.h b/stm32/include/strategie/manipulationCoinGaucheHaut.h deleted file mode 100644 index cb91c39524484a8074040259438663c88941b711..0000000000000000000000000000000000000000 --- a/stm32/include/strategie/manipulationCoinGaucheHaut.h +++ /dev/null @@ -1,20 +0,0 @@ -#ifndef MANIPULATION_COIN_GAUCHE_HAUT_H -#define MANIPULATION_COIN_GAUCHE_HAUT_H - -#include "position.h" -#include "mediumLevelAction.h" -#include "command.h" - -class ManipulationCoinGaucheHaut : public MediumLevelAction -{ - public : - ManipulationCoinGaucheHaut(Position positionDepart, bool isYellow); - ~ManipulationCoinGaucheHaut(); - int update(); - Etape::EtapeType getType(); - - private : - bool isYellow; -}; - -#endif // MANIPULATION_COIN_GAUCHE_HAUT_H diff --git a/stm32/include/strategie/manipulationCoinGaucheHautPiedSolitaire.h b/stm32/include/strategie/manipulationCoinGaucheHautPiedSolitaire.h deleted file mode 100644 index ab5a0b1e4530892dfb4ff95401b620ebb610bbd1..0000000000000000000000000000000000000000 --- a/stm32/include/strategie/manipulationCoinGaucheHautPiedSolitaire.h +++ /dev/null @@ -1,20 +0,0 @@ -#ifndef MANIPULATION_COIN_GAUCHE_HAUT_PIED_SOLITAIRE_H -#define MANIPULATION_COIN_GAUCHE_HAUT_PIED_SOLITAIRE_H - -#include "position.h" -#include "mediumLevelAction.h" -#include "command.h" - -class ManipulationCoinGaucheHautPiedSolitaire : public MediumLevelAction -{ - public : - ManipulationCoinGaucheHautPiedSolitaire(Position positionDepart, bool isYellow); - ~ManipulationCoinGaucheHautPiedSolitaire(); - int update(); - Etape::EtapeType getType(); - - private : - bool isYellow; -}; - -#endif // MANIPULATION_COIN_GAUCHE_HAUT_PIED_SOLITAIRE_H diff --git a/stm32/src/strategie/cabine.cpp b/stm32/src/strategie/cabine.cpp index eca81a3dbf8e12bee1a5ada005ecbd9d2f2670d0..5c4321f177bea0d305ab9f24c36654b188e27c85 100644 --- a/stm32/src/strategie/cabine.cpp +++ b/stm32/src/strategie/cabine.cpp @@ -28,6 +28,8 @@ int Cabine::update() if (status == 0) //Début { + // A faire : Desactiver le Sharp avant + StrategieV2::setCurrentGoal(this->getGoalPosition(), false, VITESSE_LINEAIRE_MAX, -100.0, 200.f); #ifndef ROBOTHW qDebug() << "On se prepare a pousser une porte"; diff --git a/stm32/src/strategie/cubeDebut.cpp b/stm32/src/strategie/cubeDebut.cpp index 929b4d2ca27238920e720f119718e2d0f3d4f336..e5aa97bfe9ec9864c2a124f6eb7f4b5f637ebcc9 100644 --- a/stm32/src/strategie/cubeDebut.cpp +++ b/stm32/src/strategie/cubeDebut.cpp @@ -36,6 +36,8 @@ int CubeDebut::update() } else if (status == 1) { + // A faire : Desactiver le Sharp avant + if (Command::isNear(this->getGoalPosition(), 100.0f)) // le second paramètre est la distance a l'objectif { // après avoir poussé les cubes on revient en marche arrière diff --git a/stm32/src/strategie/dune.cpp b/stm32/src/strategie/dune.cpp index d4bc632a7c79be8eda1789c86a6ff9589d1008b2..14b2d1ac7ddba3c0500ea541fe77f4d2d2845257 100644 --- a/stm32/src/strategie/dune.cpp +++ b/stm32/src/strategie/dune.cpp @@ -39,6 +39,8 @@ int Dune::update() else if (status == 1) { + // A faire : Desactiver le Sharp avant + StrategieV2::setCurrentGoal(this->getGoalPosition(), false, VITESSE_LINEAIRE_MAX, -100.0, 200.f); status++; } @@ -56,7 +58,7 @@ int Dune::update() else if (status == 3) { #ifndef ROBOTHW qDebug() << "Etape dune finie"; - + qDebug() << "Benne pleine"; #endif benne_locale->setBenneFull(); status = -1; diff --git a/stm32/src/strategie/krabi2016.cpp b/stm32/src/strategie/krabi2016.cpp index 538b3dfc59d5296c449c3345460eee6c0850a8b1..d06c506ca9f45e93d9912814b1854bfafbe5ab0d 100644 --- a/stm32/src/strategie/krabi2016.cpp +++ b/stm32/src/strategie/krabi2016.cpp @@ -22,20 +22,20 @@ Krabi2016::Krabi2016(bool isYellow) : StrategieV3(isYellow) int start = Etape::makeEtape(Position(250, 900, true), Etape::DEPART); // départ au fond de la zone de départ /** Points de passage **/ - Position wa_position = Position(600, 900, true); - int wa = Etape::makeEtape(wa_position); + Position p1_position = Position(600, 900, true); + int p1 = Etape::makeEtape(p1_position); - int wb = Etape::makeEtape(Position(680, 700, true)); - int wc = Etape::makeEtape(Position(1000, 500, true)); + int p2 = Etape::makeEtape(Position(680, 700, true)); + int p3 = Etape::makeEtape(Position(1000, 500, true)); - Position wd_position = Position(400, 500, true); - int wd = Etape::makeEtape(wd_position); + Position p4_position = Position(400, 500, true); + int p4 = Etape::makeEtape(p4_position); - int we = Etape::makeEtape(Position(950, 425, true)); - int wf = Etape::makeEtape(Position(1400, 425, true)); + int p5 = Etape::makeEtape(Position(950, 425, true)); + int p6 = Etape::makeEtape(Position(1400, 425, true)); // On crée l'étape "pousse les cubes du début" - int cd1 = Etape::makeEtape(new CubeDebut(Position(900, 900, true), wa_position)); + int cubedebut = Etape::makeEtape(new CubeDebut(Position(900, 900, true), p1_position)); /** Actions **/ @@ -45,51 +45,51 @@ Krabi2016::Krabi2016(bool isYellow) : StrategieV3(isYellow) // Dune - int da = Etape::makeEtape(new Dune(Position(1200, 280, true), benne)); - int db = Etape::makeEtape(new Dune(Position(1400, 280, true), benne)); - int dc = Etape::makeEtape(new Dune(Position(950, 250, true), benne)); - int dd = Etape::makeEtape(new Dune(Position(1500, 280, true), benne)); + int dune1 = Etape::makeEtape(new Dune(Position(1200, 280, true), benne)); + int dune2 = Etape::makeEtape(new Dune(Position(1400, 280, true), benne)); + int dune3 = Etape::makeEtape(new Dune(Position(950, 250, true), benne)); + int dune4 = Etape::makeEtape(new Dune(Position(1500, 280, true), benne)); // Cabines de plage - int cp1 = Etape::makeEtape(new Cabine(Position(250, 50, true), wd_position)); - int cp2 = Etape::makeEtape(new Cabine(Position(500, 50, true), wd_position)); + int cabine1 = Etape::makeEtape(new Cabine(Position(250, 50, true), p4_position)); + int cabine2 = Etape::makeEtape(new Cabine(Position(500, 50, true), p4_position)); /** Liens **/ // [WIP] - Etape::get(start) ->addVoisin(wa); - Etape::get(wa) ->addVoisin(wb); - Etape::get(wa) ->addVoisin(wd); - Etape::get(cd1) ->addVoisin(wa); + Etape::get(start) ->addVoisin(p1); + Etape::get(p1) ->addVoisin(p2); + Etape::get(p1) ->addVoisin(p4); + Etape::get(cubedebut)->addVoisin(p1); - Etape::get(wc) ->addVoisin(zc1); - Etape::get(wc) ->addVoisin(zc2); - Etape::get(wc) ->addVoisin(da); + Etape::get(p3) ->addVoisin(zc1); + Etape::get(p3) ->addVoisin(zc2); + Etape::get(p3) ->addVoisin(dune4); - Etape::get(cp1) ->addVoisin(wd); - Etape::get(cp2) ->addVoisin(wd); + Etape::get(cabine1) ->addVoisin(p4); + Etape::get(cabine2) ->addVoisin(p4); - Etape::get(wd) ->addVoisin(wb); - Etape::get(da) ->addVoisin(wb); - Etape::get(db) ->addVoisin(da); - Etape::get(dc) ->addVoisin(we); + Etape::get(p4) ->addVoisin(p2); + Etape::get(dune1) ->addVoisin(p2); + Etape::get(dune2) ->addVoisin(dune1); + Etape::get(dune3) ->addVoisin(p5); - Etape::get(we) ->addVoisin(wa); - Etape::get(we) ->addVoisin(wb); - Etape::get(we) ->addVoisin(wc); - Etape::get(we) ->addVoisin(wd); - Etape::get(we) ->addVoisin(da); + Etape::get(p5) ->addVoisin(p1); + Etape::get(p5) ->addVoisin(p2); + Etape::get(p5) ->addVoisin(p3); + Etape::get(p5) ->addVoisin(p4); + Etape::get(p5) ->addVoisin(dune1); - Etape::get(wf) ->addVoisin(db); - Etape::get(wf) ->addVoisin(dd); - Etape::get(wf) ->addVoisin(wc); + Etape::get(p5) ->addVoisin(dune2); + Etape::get(p5) ->addVoisin(dune4); + Etape::get(p5) ->addVoisin(p3); - Etape::get(zc1) ->addVoisin(da); - Etape::get(zc1) ->addVoisin(db); + Etape::get(zc1) ->addVoisin(dune1); + Etape::get(zc1) ->addVoisin(dune2); - Etape::get(zc2) ->addVoisin(da); - Etape::get(zc2) ->addVoisin(db); - Etape::get(zc2) ->addVoisin(wf); + Etape::get(zc2) ->addVoisin(dune1); + Etape::get(zc2) ->addVoisin(dune2); + Etape::get(zc2) ->addVoisin(p5); #ifndef ROBOTHW qDebug() << Etape::getTotalEtapes(); @@ -115,6 +115,9 @@ int Krabi2016::getScoreEtape(int i) /*case Etape::TYPE_ACTION: return NB_POINTS_ACTION; */ + + // A faire : remplacer la priorite par le nombre de points obtenables a l'etape + case Etape::DEPART : return 0; case Etape::POINT_PASSAGE : @@ -128,18 +131,21 @@ int Krabi2016::getScoreEtape(int i) } } + case Etape::CABINE : + return 400; + case Etape::CUBE_DEBUT : - return 10000; + return 500; case Etape::DUNE : { - // On fait comme si on avait rammasé un cube, du coup la benne est pleine, en vrai on fera - // tout ça dans la future classe cube - - // le probleme avec le setter est que dans la recherche de meilleur itineraire la methode est exectuee + if( benne->getIsBenneEmpty() ) { + return 400; + } - // benne->setBenneFull(); - return 100; + else { + return 1; + } } default : diff --git a/stm32/src/strategie/manipulationCoinGaucheBas.cpp b/stm32/src/strategie/manipulationCoinGaucheBas.cpp deleted file mode 100644 index 1bc79e7d093dc9e4d5f726337df86368de82d597..0000000000000000000000000000000000000000 --- a/stm32/src/strategie/manipulationCoinGaucheBas.cpp +++ /dev/null @@ -1,250 +0,0 @@ -#include "manipulationCoinGaucheBas.h" -#include "ascenseur.h" -#include "strategieV2.h" -#include "mediumLevelAction.h" -#include "command.h" -#include "pinces.h" - -//MLA : Medium Level Action - -#define ATTENTE 20 - -#ifndef ROBOTHW -#include -#endif - -ManipulationCoinGaucheBas::ManipulationCoinGaucheBas(Position positionDepart, bool isYellow) : MediumLevelAction(positionDepart){ - Pinces::getSingleton()->ouvrirPinces(); - Ascenseur::getSingleton()->leverAscenseur(); - this->isYellow = isYellow; -} - -ManipulationCoinGaucheBas::~ManipulationCoinGaucheBas(){} - -Etape::EtapeType ManipulationCoinGaucheBas::getType() -{ - return Etape::COIN_GAUCHE_BAS; -} - -int ManipulationCoinGaucheBas::update() -{ - if (status == 0) - { - StrategieV2::setCurrentGoal(this->goalPosition); - status++; - } - - else if (status == 1) - { - if (Command::isNear(this->goalPosition)) - { - status++; - } - } - - else if (status == 2) - { - #ifndef ROBOTHW - qDebug() << "action ManipulationCoinGaucheBas"; - #endif - this->goalPosition = Position(86,1755, true); - StrategieV2::setCurrentGoal(this->goalPosition); - status++; - } - - else if (status == 3) - { - if (Command::isNear(goalPosition, 200.0f)) - { - StrategieV2::lookAt(this->goalPosition); - status++; - } - } - - else if (status == 4) - { - if (Command::isLookingAt(this->goalPosition)) - { - Pinces::getSingleton()->fermerPinces(); - status++; - } - } - - else if (status < 4 + ATTENTE) - { - status++; - } - - else if (status == 4 + ATTENTE) - { - Ascenseur::getSingleton()->ouvrirAscenseur(); - status++; - } - - else if (status < 4 + ATTENTE + ATTENTE) - { - status++; - } - - else if (status == 4 + ATTENTE + ATTENTE) - { - Ascenseur::getSingleton()->baisserAscenseur(); - status++; - } - - else if (status == 5 + ATTENTE + ATTENTE) - { - if (Ascenseur::getSingleton()->estEnBas()) - { - status++; - } - } - - else if (status == 6 + ATTENTE + ATTENTE) - { - Ascenseur::getSingleton()->fermerAscenseur(); - status++; - } - - else if (status < 6 + ATTENTE + ATTENTE + ATTENTE) - { - status++; - } - - else if (status == 6 + ATTENTE + ATTENTE + ATTENTE) - { - Ascenseur::getSingleton()->leverAscenseur(); - Ascenseur::getSingleton()->addPied(); - status++; - } - - else if (status == 7 + ATTENTE + ATTENTE + ATTENTE) - { - if (Ascenseur::getSingleton()->estEnHaut()) - { - status++; - } - } - - - else if (status == 7 + ATTENTE + ATTENTE + ATTENTE) - { - if (Ascenseur::getSingleton()->getNbrPiedsStockes()==3) - { - status = -1; - } - - else - { -#ifndef ROBOTHW - qDebug() << "Etape ManipulationCoinGaucheBas part2"; -#endif - this->goalPosition = Position(86, 1855, true); - StrategieV2::setCurrentGoal(this->goalPosition, this->goBack); - Pinces::getSingleton()->ouvrirPinces(); - status++; - } - } - - else if (status == 8 + ATTENTE + ATTENTE + ATTENTE) - { - if (Command::isNear(goalPosition, 200.0f)) - { - StrategieV2::lookAt(goalPosition); - status++; - } - } - - else if (status == 9 + ATTENTE + ATTENTE + ATTENTE) - { - if (Command::isLookingAt(this->goalPosition)) - { - Pinces::getSingleton()->fermerPinces(); - status++; - } - } - - else if (status < 9 + ATTENTE + ATTENTE + ATTENTE + ATTENTE) - { - status++; - } - - else if (status == 9 + ATTENTE + ATTENTE + ATTENTE + ATTENTE) - { - Ascenseur::getSingleton()->ouvrirAscenseur(); - status++; - } - - else if (status < 9 + ATTENTE + ATTENTE + ATTENTE + ATTENTE + ATTENTE) - { - status++; - } - - else if (status == 9 + ATTENTE + ATTENTE + ATTENTE + ATTENTE + ATTENTE) - { - Ascenseur::getSingleton()->baisserAscenseur(); - status++; - } - - else if (status == 9 + ATTENTE + ATTENTE + ATTENTE + ATTENTE + ATTENTE) - { - if (Ascenseur::getSingleton()->estEnBas()) - { - status++; - } - } - - else if (status == 10 + ATTENTE + ATTENTE + ATTENTE + ATTENTE + ATTENTE) - { - Ascenseur::getSingleton()->fermerAscenseur(); - status++; - } - - else if (status < 10 + ATTENTE + ATTENTE + ATTENTE + ATTENTE + ATTENTE + ATTENTE) - { - status++; - } - - else if (status == 10 + ATTENTE + ATTENTE + ATTENTE + ATTENTE + ATTENTE + ATTENTE) - { - Ascenseur::getSingleton()->leverAscenseur(); - Ascenseur::getSingleton()->addPied(); - this->goBack = true; - status++; - } - - else if (status == 11 + ATTENTE + ATTENTE + ATTENTE + ATTENTE + ATTENTE + ATTENTE) - { - if (Ascenseur::getSingleton()->estEnHaut()) - { - status++; - } - } - - else if (status == 12 + ATTENTE + ATTENTE + ATTENTE + ATTENTE + ATTENTE + ATTENTE) - { -#ifndef ROBOTHW - qDebug() << "Le robot se recentre"; -#endif - this->goalPosition =Position(260, 1575, true); - StrategieV2::setCurrentGoal(goalPosition, this->goBack); - status++; - } - - else if (status == 13 + ATTENTE + ATTENTE + ATTENTE + ATTENTE + ATTENTE + ATTENTE) - { - if (Command::isNear(goalPosition)) - { - this->goBack = false; - status++; - } - } - - else - { - status = -1; - } - - return status; -} - diff --git a/stm32/src/strategie/manipulationCoinGaucheHaut.cpp b/stm32/src/strategie/manipulationCoinGaucheHaut.cpp deleted file mode 100644 index 39a906e7f1a5f9032fd4b3ae483951413c7f7318..0000000000000000000000000000000000000000 --- a/stm32/src/strategie/manipulationCoinGaucheHaut.cpp +++ /dev/null @@ -1,222 +0,0 @@ -#include "manipulationCoinGaucheHaut.h" -#include "ascenseur.h" -#include "strategieV2.h" -#include "mediumLevelAction.h" -#include "command.h" -#include "pinces.h" - -//MLA : Medium Level Action - -#define ATTENTE 20 - -#ifndef ROBOTHW -#include -#endif - -ManipulationCoinGaucheHaut::ManipulationCoinGaucheHaut(Position positionDepart, bool isYellow) : MediumLevelAction(positionDepart){ - Pinces::getSingleton()->ouvrirPinces(); - Ascenseur::getSingleton()->leverAscenseur(); - this->isYellow = isYellow; -} - -ManipulationCoinGaucheHaut::~ManipulationCoinGaucheHaut(){} - -Etape::EtapeType ManipulationCoinGaucheHaut::getType() -{ - return Etape::COIN_GAUCHE_HAUT; -} - -int ManipulationCoinGaucheHaut::update() -{ - if (status == 0) - { - StrategieV2::setCurrentGoal(this->goalPosition); - status++; - } - - else if (status == 1) - { - if (Command::isNear(this->goalPosition)) - { - status++; - } - } - - else if (status == 2) - { - #ifndef ROBOTHW - qDebug() << "action ManipulationCoinGaucheHaut"; - #endif - this->goalPosition = Position(850,210, true); - StrategieV2::setCurrentGoal(this->goalPosition); - status++; - } - - else if (status == 3) - { - if (Command::isNear(goalPosition, 200.0f)) - { - StrategieV2::lookAt(this->goalPosition); - status++; - } - } - - else if (status == 4) - { - if (Command::isLookingAt(this->goalPosition)) - { - Pinces::getSingleton()->fermerPinces(); - status++; - } - } - - else if (status < 4 + ATTENTE) - { - status++; - } - - else if (status == 4 + ATTENTE) - { - Ascenseur::getSingleton()->ouvrirAscenseur(); - status++; - } - - else if (status < 4 + ATTENTE + ATTENTE) - { - status++; - } - - else if (status == 4 + ATTENTE + ATTENTE) - { - Ascenseur::getSingleton()->baisserAscenseur(); - status++; - } - - else if (status == 5 + ATTENTE + ATTENTE) - { - if (Ascenseur::getSingleton()->estEnBas()) - { - status++; - } - } - - else if (status == 6 + ATTENTE + ATTENTE) - { - Ascenseur::getSingleton()->fermerAscenseur(); - status++; - } - - else if (status < 6 + ATTENTE + ATTENTE + ATTENTE) - { - status++; - } - - else if (status == 6 + ATTENTE + ATTENTE + ATTENTE) - { - Ascenseur::getSingleton()->leverAscenseur(); - Ascenseur::getSingleton()->addPied(); - status++; - } - - else if (status < 7 + ATTENTE + ATTENTE + ATTENTE) - { - if (Ascenseur::getSingleton()->estEnHaut()) - { - status++; - } - } - - - else if (status == 8 + ATTENTE + ATTENTE + ATTENTE) - { - if (Ascenseur::getSingleton()->getNbrPiedsStockes()==3) - { - status = -1; - } - - else - { -#ifndef ROBOTHW - qDebug() << "Etape ManipulationCoinGaucheHaut part2"; -#endif - this->goalPosition = Position(850, 110, true); - StrategieV2::setCurrentGoal(this->goalPosition, this->goBack); - Pinces::getSingleton()->ouvrirPinces(); - status++; - } - } - - else if (status == 9 + ATTENTE + ATTENTE + ATTENTE) - { - if (Command::isNear(goalPosition, 200.0f)) - { - StrategieV2::lookAt(goalPosition); - status++; - } - } - - else if (status == 10 + ATTENTE + ATTENTE + ATTENTE) - { - if (Command::isLookingAt(this->goalPosition)) - { - Pinces::getSingleton()->fermerPinces(); - status++; - } - } - - else if (status < 10 + ATTENTE + ATTENTE + ATTENTE) - { - status++; - } - - else if (status == 10 + ATTENTE + ATTENTE + ATTENTE) - { - Ascenseur::getSingleton()->ouvrirAscenseur(); - status++; - } - - else if (status < 10 + ATTENTE + ATTENTE + ATTENTE + ATTENTE) - { - status++; - } - - else if (status == 10 + ATTENTE + ATTENTE + ATTENTE + ATTENTE) - { - Ascenseur::getSingleton()->baisserAscenseur(); - status++; - } - - else if (status < 11 + ATTENTE + ATTENTE + ATTENTE + ATTENTE) - { - if (Ascenseur::getSingleton()->estEnBas()) - { - status++; - } - } - - else if (status == 12 + ATTENTE + ATTENTE + ATTENTE + ATTENTE) - { - Ascenseur::getSingleton()->fermerAscenseur(); - status++; - } - - else if (status < 12 + ATTENTE + ATTENTE + ATTENTE + ATTENTE + ATTENTE ) - { - status++; - } - - else if (status == 12 + ATTENTE + ATTENTE + ATTENTE + ATTENTE + ATTENTE) - { - Ascenseur::getSingleton()->leverAscenseur(); - Ascenseur::getSingleton()->addPied(); - status++; - } - - else - { - status = -1; - } - - return status; -} - diff --git a/stm32/src/strategie/manipulationCoinGaucheHautPiedSolitaire.cpp b/stm32/src/strategie/manipulationCoinGaucheHautPiedSolitaire.cpp deleted file mode 100644 index 82aa62260a09b0b5bcecf1a68b8d270ca68adbc1..0000000000000000000000000000000000000000 --- a/stm32/src/strategie/manipulationCoinGaucheHautPiedSolitaire.cpp +++ /dev/null @@ -1,133 +0,0 @@ -#include "manipulationCoinGaucheHautPiedSolitaire.h" -#include "ascenseur.h" -#include "strategieV2.h" -#include "mediumLevelAction.h" -#include "command.h" -#include "pinces.h" - -//MLA : Medium Level Action - -#define ATTENTE 20 - -#ifndef ROBOTHW -#include -#endif - -ManipulationCoinGaucheHautPiedSolitaire::ManipulationCoinGaucheHautPiedSolitaire(Position positionDepart, bool isYellow) : MediumLevelAction(positionDepart){ - Pinces::getSingleton()->ouvrirPinces(); - Ascenseur::getSingleton()->leverAscenseur(); - this->isYellow = isYellow; -} - -ManipulationCoinGaucheHautPiedSolitaire::~ManipulationCoinGaucheHautPiedSolitaire(){} - -Etape::EtapeType ManipulationCoinGaucheHautPiedSolitaire::getType() -{ - return Etape::SPOT_SOLITAIRE_COIN; -} - -int ManipulationCoinGaucheHautPiedSolitaire::update() -{ - if (status == 0) - { - StrategieV2::setCurrentGoal(this->goalPosition); - status++; - } - - else if (status == 1) - { - if (Command::isNear(this->goalPosition)) - { - status++; - } - } - - else if (status == 2) - { - #ifndef ROBOTHW - qDebug() << "action ManipulationCoinGaucheHautPiedSolitaire"; - #endif - this->goalPosition = Position(85,200, true); - StrategieV2::setCurrentGoal(this->goalPosition); - status++; - } - - else if (status == 3) - { - if (Command::isNear(goalPosition, 200.0f)) - { - StrategieV2::lookAt(this->goalPosition); - status++; - } - } - - else if (status == 4) - { - if (Command::isLookingAt(this->goalPosition)) - { - Pinces::getSingleton()->fermerPinces(); - status++; - } - } - - else if (status < 4 + ATTENTE) - { - status++; - } - - else if (status == 4 + ATTENTE) - { - Ascenseur::getSingleton()->ouvrirAscenseur(); - status++; - } - - else if (status < 4 + ATTENTE + ATTENTE) - { - status++; - } - - else if (status == 5 + ATTENTE + ATTENTE) - { - Ascenseur::getSingleton()->baisserAscenseur(); - status++; - } - - else if (status < 5 + ATTENTE + ATTENTE + ATTENTE) - { - status++; - } - - else if (status == 5 + ATTENTE + ATTENTE + ATTENTE) - { - Ascenseur::getSingleton()->fermerAscenseur(); - status++; - } - - else if (status < 5 + ATTENTE + ATTENTE + ATTENTE + ATTENTE) - { - status++; - } - - else if (status == 5 + ATTENTE + ATTENTE + ATTENTE + ATTENTE) - { - Ascenseur::getSingleton()->leverAscenseur(); - Ascenseur::getSingleton()->addPied(); - status++; - } - - else if (status == 6 + ATTENTE + ATTENTE + ATTENTE + ATTENTE) - { - if (Ascenseur::getSingleton()->estEnHaut()) - { - status++; - } - } - - - else if (status == 7 + ATTENTE + ATTENTE + ATTENTE + ATTENTE + ATTENTE) - { - status = -1; - } - - return status; -} diff --git a/stm32/src/strategie/zoneConstruction.cpp b/stm32/src/strategie/zoneConstruction.cpp index 573a91ea19497f478691c8b9dea533ccc8ec244b..f8e26bc169ac021bc841939623134d02088037e8 100644 --- a/stm32/src/strategie/zoneConstruction.cpp +++ b/stm32/src/strategie/zoneConstruction.cpp @@ -37,7 +37,6 @@ int ZoneConstruction::update() status++; } - else if (status == 1) { StrategieV2::setCurrentGoal(this->getGoalPosition(), false, VITESSE_LINEAIRE_MAX, -100.0, 200.f); @@ -56,8 +55,7 @@ int ZoneConstruction::update() else if (status == 3) { #ifndef ROBOTHW - qDebug() << "Etape zone de construction finie"; - + qDebug() << "Etape zone de construction finie ; benne vide"; #endif benne_locale->setBenneEmpty(); status = -1;