diff --git a/simulation/qtcreator-files/paprikaSimulateur/paprikaSimulateur.pro b/simulation/qtcreator-files/paprikaSimulateur/paprikaSimulateur.pro index 830c14544c60d110c5154414ae68fef05309e7b4..9e6e44153b1c43c4fde38dece975681223aff436 100644 --- a/simulation/qtcreator-files/paprikaSimulateur/paprikaSimulateur.pro +++ b/simulation/qtcreator-files/paprikaSimulateur/paprikaSimulateur.pro @@ -72,13 +72,9 @@ HEADERS += \ ../../include/strategie/zoneConstruction.h \ ../../include/strategie/dijkstra.h \ ../../include/hardware/tourelle.h \ - ../../include/strategie/clap.h \ - ../../include/strategie/gobelet.h \ - ../../include/strategie/tapis.h \ ../../include/actionneurs/brasTapis.h \ ../../include/actionneurs/brasKrabi.h \ ../../include/actionneurs/brasLateraux.h \ - ../../include/strategie/deposerGobelet.h \ ../../include/actionneurs/pinces.h \ ../../include/strategie/ramasserPied.h \ ../../include/hardware/microSwitch.h \ @@ -154,14 +150,10 @@ SOURCES += \ ../../src/strategie/etape.cpp \ ../../src/strategie/dijkstra.cpp \ ../../src/hardware/tourelle.cpp \ - ../../src/strategie/clap.cpp \ - ../../src/strategie/gobelet.cpp \ - ../../src/strategie/tapis.cpp \ ../../src/actionneurs/brasTapis.cpp \ ../../src/actionneurs/brasLateraux.cpp \ ../../src/actionneurs/brasKrabi.cpp \ ../../src/actionneurs/ascenseur.cpp \ - ../../src/strategie/deposerGobelet.cpp \ ../../src/actionneurs/pinces.cpp \ ../../src/strategie/ramasserPied.cpp \ ../../src/simul/debugwindow.cpp \ diff --git a/stm32/include/hardware/leds.h b/stm32/include/hardware/leds.h index de0f09862a726c86df2fa2eebfd04f352161d211..f4188bd47a1d457f8401feb3324317beb5ba988d 100644 --- a/stm32/include/hardware/leds.h +++ b/stm32/include/hardware/leds.h @@ -24,7 +24,7 @@ void eteindreLED2(); bool isLedOn(int led); #endif -class Leds +class Led { public: static void toggle(int index = 0); diff --git a/stm32/include/strategie/clap.h b/stm32/include/strategie/clap.h deleted file mode 100644 index 8a741c39c359bf8de49151a0a7dac61766630cad..0000000000000000000000000000000000000000 --- a/stm32/include/strategie/clap.h +++ /dev/null @@ -1,44 +0,0 @@ -#ifndef CLAP_H -#define CLAP_H - -#include "position.h" -#include "mediumLevelAction.h" -#include "command.h" -#include "brasLateraux.h" - -/** @class clap : le robot doit fermer 3 claps du bord de la table -*/ - -class Clap : public MediumLevelAction -{ - public: - Clap(); - /** @brief Constructeur - * @fn Clap(Position positionDepart, Position positionArrivee) - * @param les paramètres sont de type Position - */ - Clap(Position positionDepart, Position positionArrivee); - /** @brief Destructeur - */ - ~Clap(); - /** @brief Fonction appelée toutes les 50ms qui gère l'action Clap : le robot avance à la position de départ, ouvre son bras, avance à la position d'arrivée, ferme son bras. - * @fn int update() - * @return le statut ("status" dans le code) (attribut hérité de la classe MediumLevelAction) : - status = 0 : le robot commence l'action - status = 1 : le robot se déplace jusqu'à la position de départ - status = 2 : le robot s'oriente pour présenter son coté au clap - status = 3 : le robot ouvre son bras - status = 54 : le robot avance à la position d'arrivée - status = 55 : le robot ferme son bras - status = -1 : le robot a finit l'action - */ - int update(); - Etape::EtapeType getType(); - - protected : - Position positionDepart; - Position positionArrivee; - -}; - -#endif // CLAP_H diff --git a/stm32/include/strategie/deposerGobelet.h b/stm32/include/strategie/deposerGobelet.h deleted file mode 100644 index 949465a44a27517f86465673f106b88493146466..0000000000000000000000000000000000000000 --- a/stm32/include/strategie/deposerGobelet.h +++ /dev/null @@ -1,21 +0,0 @@ -#ifndef DEPOSERGOBELET_H -#define DEPOSERGOBELET_H - -#include "position.h" -#include "mediumLevelAction.h" -#include "command.h" - -class DeposerGobelet : public MediumLevelAction -{ -public: - DeposerGobelet(); - DeposerGobelet(Position position); - ~DeposerGobelet(); - int update(); - Etape::EtapeType getType(); - -protected : - Position position; -}; - -#endif // DEPOSERGOBELET_H diff --git a/stm32/include/strategie/etape.h b/stm32/include/strategie/etape.h index 9871cb510b195efa0056a6b09d6be217098e80ef..9085fd2667d3350e0e0711e0d895c4e9b52594ef 100644 --- a/stm32/include/strategie/etape.h +++ b/stm32/include/strategie/etape.h @@ -26,37 +26,19 @@ public: POINT_PASSAGE = 0, COLLECT = 1, - FRUIT = 2, + DEPART = 5, - DEPOSE_FEU = 6, - DEPOSE_FRUIT = 7, - FEU_MINI_BRAS = 14, - FEU_COTE = 15, - CENTRE_TABLE = 16, - CLAP = 17, - GOBELET = 18, + RAMASSER_PIED = 19, - AMPOULE = 20, - TAPIS = 21, - DEPOSER_GOBELET = 22, + COIN_GAUCHE_HAUT = 24, COIN_GAUCHE_BAS = 25, SPOT_SOLITAIRE_COIN = 26, ROBOT_POINT_PASSAGE = POINT_PASSAGE + ROBOT_VU_ICI, - ROBOT_COLLECT = COLLECT + ROBOT_VU_ICI, - ROBOT_FRUIT = FRUIT + ROBOT_VU_ICI, ROBOT_DEPART = DEPART + ROBOT_VU_ICI, - ROBOT_DEPOSE_FEU = DEPOSE_FEU + ROBOT_VU_ICI, - ROBOT_DEPOSE_FRUIT = DEPOSE_FRUIT + ROBOT_VU_ICI, - ROBOT_FEU_MINI_BRAS = FEU_MINI_BRAS + ROBOT_VU_ICI, - ROBOT_CENTRE_TABLE = CENTRE_TABLE + ROBOT_VU_ICI, - ROBOT_CLAP = CLAP + ROBOT_VU_ICI, - ROBOT_GOBELET = GOBELET + ROBOT_VU_ICI, + ROBOT_PIED = RAMASSER_PIED + ROBOT_VU_ICI, - ROBOT_AMPOULE = AMPOULE + ROBOT_VU_ICI, - ROBOT_TAPIS = TAPIS + ROBOT_VU_ICI, - ROBOT_DEPOSER_GOBELET = DEPOSER_GOBELET + 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 diff --git a/stm32/include/strategie/gobelet.h b/stm32/include/strategie/gobelet.h deleted file mode 100644 index 42a2db6c50f318413284ffa55c82770977017d98..0000000000000000000000000000000000000000 --- a/stm32/include/strategie/gobelet.h +++ /dev/null @@ -1,21 +0,0 @@ -#ifndef GOBELET_H -#define GOBELET_H - -#include "position.h" -#include "mediumLevelAction.h" -#include "command.h" - -class Gobelet : public MediumLevelAction -{ - public : - Gobelet(); - Gobelet(Position position); - ~Gobelet(); - int update(); - Etape::EtapeType getType(); - - protected : - Position position; -}; - -#endif // GOBELET_H diff --git a/stm32/include/strategie/krabi2016.h b/stm32/include/strategie/krabi2016.h index 665d207a55138422a0be2b1a4f2cf4a153f00914..4bcdf9c4c341e042648dbdaa4bb8b63c158ecf52 100644 --- a/stm32/include/strategie/krabi2016.h +++ b/stm32/include/strategie/krabi2016.h @@ -7,13 +7,9 @@ #include "strategiev3.h" #include "etape.h" -#include "clap.h" -#include "gobelet.h" #include "zoneConstruction.h" -#include "tapis.h" #include "cabine.h" #include "ramasserPied.h" -#include "deposerGobelet.h" #include "manipulationCoinGaucheBas.h" #include "manipulationCoinGaucheHaut.h" #include "manipulationCoinGaucheHautPiedSolitaire.h" @@ -28,10 +24,7 @@ public: Krabi2016(bool isYellow); /** @brief Actions de Krabi */ - Clap actionClap[3]; - Gobelet actionGobelet[5]; Cabine actionCabine[2]; - DeposerGobelet actionDeposerGobelet[3]; RamasserPied actionRamasserPied[8]; diff --git a/stm32/include/strategie/krabijunior2016.h b/stm32/include/strategie/krabijunior2016.h index d1b55494dc19638accefc09d399a69d1765ad551..6fa10fb596f2ad42c6b5bad310bf0bf3f2b429ba 100644 --- a/stm32/include/strategie/krabijunior2016.h +++ b/stm32/include/strategie/krabijunior2016.h @@ -7,7 +7,6 @@ #include "strategiev3.h" #include "etape.h" -#include "clap.h" class KrabiJunior2016 : public StrategieV3 { diff --git a/stm32/include/strategie/tapis.h b/stm32/include/strategie/tapis.h deleted file mode 100644 index 5cbaef92f90617c67540798ef7af3ee0c08cfd0b..0000000000000000000000000000000000000000 --- a/stm32/include/strategie/tapis.h +++ /dev/null @@ -1,41 +0,0 @@ -#ifndef TAPIS_H -#define TAPIS_H - -#include "position.h" -#include "angle.h" -#include "mediumLevelAction.h" -#include "command.h" -#include "brasTapis.h" - -/** @class Tapis : le robot doit poser 2 tapis sur les marches. -*/ - -class Tapis : public MediumLevelAction -{ - public: - Tapis(); - /** @brief Constructeur - * @fn Tapis(Position position) - * @param le paramètre sont de type Position - */ - Tapis(Position position); - /** @brief Destructeur - */ - ~Tapis(); - /** @brief Fonction appelée toutes les 50ms qui gère l'action Tapis : le robot avance à la position puis déploie son bras pour poser le tapis. - * @fn int update() - * @return le statut ("status" dans le code) (attribut hérité de la classe MediumLevelAction) : - - */ - int update(); - - Etape::EtapeType getType(); - - protected : - Position position; - Angle toLookAt; - BrasTapis::COTE cote; -}; - - -#endif // TAPIS_H diff --git a/stm32/src/strategie/clap.cpp b/stm32/src/strategie/clap.cpp deleted file mode 100644 index d2a26a75cc42c8801c74863c2810b2cac2118645..0000000000000000000000000000000000000000 --- a/stm32/src/strategie/clap.cpp +++ /dev/null @@ -1,111 +0,0 @@ -#include "clap.h" -#include "strategieV2.h" -#include "mediumLevelAction.h" -#include "command.h" -#include "position.h" -#include "brasLateraux.h" - -#ifndef ROBOTHW -#include -#endif - -#define ATTENTE_ROTATION 500 -#define ATTENTE_SORTIE_BRAS 10 - - -Clap::Clap(){} - -Clap::Clap(Position positionDepart, Position positionArrivee):MediumLevelAction(positionDepart) -{ - this->positionArrivee = positionArrivee; - this->goBack = false; -} - -Clap::~Clap(){} - -Etape::EtapeType Clap::getType() -{ - return Etape::CLAP; -} - -int Clap::update() -{ - - if (status == 0)//Début - { -#ifndef ROBOTHW - qDebug() << "clap"; -#endif - status++; - } - - else if (status == 1)//Aller au point de départ - { - StrategieV2::setCurrentGoal(goalPosition, goBack); - status++; - } - - else if (status == 2)//Se tourner une fois au point de départ - { - if (Command::isNear(goalPosition)) - { - StrategieV2::lookAt(positionArrivee); - - status++; - } - } - - else if ((status <= 3 + ATTENTE_ROTATION) && (status > -1 ))//On attend que le robot se tourne : 50ms par incrémentation du status - { - status++; - } - - - else if (status == 4 + ATTENTE_ROTATION)//Sortir le bras - { - //Ouvrir le bras - if (positionArrivee.getX()<1500) - BrasLateraux::getRight()->expand(); - else - BrasLateraux::getLeft()->expand(); - - status++; - } - - else if ((status <= 5 + ATTENTE_ROTATION + ATTENTE_SORTIE_BRAS) && (status > -1 ))//On attend que le bras du robot s'ouvre : 50ms par incrémentation du status - { - status++; - } - - else if (status == 6 + ATTENTE_ROTATION + ATTENTE_SORTIE_BRAS)//Avancer pour faire tomber le clap - { - StrategieV2::setCurrentGoal(positionArrivee, goBack); - status++; - } - - else if (status == 56 + ATTENTE_ROTATION + ATTENTE_SORTIE_BRAS)//Fermer le bras une fois passé - { - if (Command::isNear(positionArrivee)) - { - if (positionArrivee.getX()<1500) - BrasLateraux::getRight()->collapse(); - else - BrasLateraux::getLeft()->collapse(); - status++; - } - } - - else if ((status <= 105 + ATTENTE_ROTATION + ATTENTE_SORTIE_BRAS) && (status > -1)) - { - status++; - } - - else if (status == 106 + ATTENTE_ROTATION + ATTENTE_SORTIE_BRAS){ - status = -1; -#ifndef ROBOTHW - qDebug() << "Etape clap finie"; -#endif - } - - return status; -} diff --git a/stm32/src/strategie/deposerGobelet.cpp b/stm32/src/strategie/deposerGobelet.cpp deleted file mode 100644 index 555c8b8743768be24a1e9e512d9d16b2091e7314..0000000000000000000000000000000000000000 --- a/stm32/src/strategie/deposerGobelet.cpp +++ /dev/null @@ -1,85 +0,0 @@ -#include "deposerGobelet.h" -#include "pinces.h" -#include "strategieV2.h" -#include "mediumLevelAction.h" -#include "command.h" - -#ifndef ROBOTHW -#include -#endif - -DeposerGobelet::DeposerGobelet(){} - -DeposerGobelet::DeposerGobelet(Position goalposition):MediumLevelAction(goalposition){} - -DeposerGobelet::~DeposerGobelet(){} - -Etape::EtapeType DeposerGobelet::getType() -{ - return Etape::DEPOSER_GOBELET; -} - -int DeposerGobelet::update() -{ - if (status == 0) - { -#ifndef ROBOTHW - qDebug() << "deposerGobelet"; -#endif - status++; - status = -1; - } - - else if (status == 1) - { - StrategieV2::setCurrentGoal(this->goalPosition, this->goBack); - status++; - } - - else if (status == 2) - { - if (Command::isNear(goalPosition)) - { - StrategieV2::lookAt(goalPosition); - status++; - } - } - - else if (status == 3) - { - if (Command::isLookingAt(goalPosition)) - { -#ifndef ROBOTHW - qDebug() << "On lache le gobelet"; -#endif - Pinces::getSingleton()->ouvrirPinces(); - status++; - } - } - - else if ((status <23) && (status > 0)) //On attend que les pinces aient laché le gobelet. - { - status++; - } - - else if (status == 23) - { -#ifndef ROBOTHW - qDebug() << "On referme les pinces"; -#endif - Pinces::getSingleton()->fermerPinces(); - status++; - } - - else if ((status <63) && (status > 0)) //On attend que l'ascenseur ferme ses pinces - { - status++; - } - - else if (status == 63) - { - status = -1; - } - - return status; -} diff --git a/stm32/src/strategie/etape.cpp b/stm32/src/strategie/etape.cpp index d9f2e170fd4f69c067c10442ade4eaa2384bee78..2893d589ec85700b7a81bbace9f2fd7faef18d30 100644 --- a/stm32/src/strategie/etape.cpp +++ b/stm32/src/strategie/etape.cpp @@ -191,10 +191,7 @@ int Etape::getNombreEtapesLieesParFinirEtape() void Etape::finir(void) { - if(this->type == FRUIT) - { - this->type = POINT_PASSAGE; - } + return; } void Etape::setScore(int score) @@ -363,18 +360,10 @@ QString Etape::getNameType(EtapeType type) return "Passage"; case DEPART: return "Départ"; - case CLAP: - return "Clap"; - case GOBELET: - return "Gobelet"; + case RAMASSER_PIED: return "Pied"; - case AMPOULE: - return "Ampoule"; - case TAPIS: - return "Tapis"; - case DEPOSER_GOBELET: - return "Déposer Gobelet"; + case CUBE_DEBUT: return "Pousser les cubes a l'init"; default: @@ -394,18 +383,10 @@ QString Etape::getShortNameType(EtapeType type) return ""; case DEPART: return "Start"; - case CLAP: - return "Clap"; - case GOBELET: - return "Gob"; + case RAMASSER_PIED: return "Pied"; - case AMPOULE: - return "Amp"; - case TAPIS: - return "Tapis"; - case DEPOSER_GOBELET: - return "D.G"; + case CUBE_DEBUT: return "Cube debut"; default: diff --git a/stm32/src/strategie/gobelet.cpp b/stm32/src/strategie/gobelet.cpp deleted file mode 100644 index e8d0897b00950e63b008e7d119c79af5f8e9517c..0000000000000000000000000000000000000000 --- a/stm32/src/strategie/gobelet.cpp +++ /dev/null @@ -1,117 +0,0 @@ -#include "gobelet.h" -#include "pinces.h" -#include "ascenseur.h" -#include "strategieV2.h" -#include "mediumLevelAction.h" -#include "command.h" - -#ifndef ROBOTHW -#include -#endif - -Gobelet::Gobelet(){} - -Gobelet::Gobelet(Position goalposition):MediumLevelAction(goalposition){} - -Gobelet::~Gobelet(){} - -Etape::EtapeType Gobelet::getType() -{ - return Etape::GOBELET; -} - -int Gobelet::update() -{ - if (status == 0) - { -#ifndef ROBOTHW - qDebug() << "gobelet"; -#endif - status++; - } - - else if (status == 1) - { - StrategieV2::setCurrentGoal(this->goalPosition, this->goBack); - status++; - } - - else if (status == 2) - { - if (Command::isNear(goalPosition, 175.0f)) - { - StrategieV2::lookAt(goalPosition); - status++; - } - } - - else if (status == 3) - { - if (Command::isLookingAt(goalPosition)) - { -#ifndef ROBOTHW - qDebug() << "On baisse l'ascenseur"; -#endif - Ascenseur::getSingleton()->baisserAscenseur(); - status++; - } - } - - else if ((status <23) && (status > 0)) //On attend que l'ascenseur se baisse - { - status++; - } - - else if (status == 23) - { -#ifndef ROBOTHW - qDebug() << "On ouvre les pinces"; -#endif - Pinces::getSingleton()->ouvrirPinces(); - status++; - } - - else if ((status <43) && (status > 0)) //On attend que l'ascenseur ouvre les pinces - { - status++; - } - - else if (status == 43) - { -#ifndef ROBOTHW - qDebug() << "On ferme les pinces"; -#endif - Pinces::getSingleton()->fermerPinces(); - status++; - } - - else if ((status <63) && (status > 0)) //On attend que l'ascenseur ferme ses pinces - { - status++; - } - - else if (status == 63) - { -#ifndef ROBOTHW - qDebug() << "Etape gobelet finie"; -#endif - StrategieV2::setCurrentGoal(this->goalPosition, this->goBack); - status++; - } - - else if (status == 64) - { - if (Command::isNear(goalPosition)) - { - StrategieV2::lookAt(goalPosition); - status++; - } - } - - else if (status == 65) - { - status = -1; - } - - return status; -} diff --git a/stm32/src/strategie/krabijunior2016.cpp b/stm32/src/strategie/krabijunior2016.cpp index 27a692a8c5c4f3ef17acbe1dc0b704bcef2c74d2..1dbf7636bf103591536141d0718a77ac694fd13a 100644 --- a/stm32/src/strategie/krabijunior2016.cpp +++ b/stm32/src/strategie/krabijunior2016.cpp @@ -34,9 +34,6 @@ int KrabiJunior2016::getScoreEtape(int i){ case Etape::DEPART : return 10; break; - case Etape::TAPIS : - return 10; - break; default : return 0; break; diff --git a/stm32/src/strategie/strategiev3.cpp b/stm32/src/strategie/strategiev3.cpp index c4a5de29373383b9f1de735cacd119c7a0c34852..2102ace645abc575c39cd15c5b7201af42b24e44 100644 --- a/stm32/src/strategie/strategiev3.cpp +++ b/stm32/src/strategie/strategiev3.cpp @@ -22,7 +22,7 @@ StrategieV3::StrategieV3(bool /*isYellow*/) : MediumLevelAction() this->millisecondesRestantes = 90 * 1000; #ifndef ROBOTHW - colorLiaisonsEtapes = QColor("blue"); + colorLiaisonsEtapes = QColor(150,100,50); colorEtapeGoal = QColor("red"); colorEtapesIntermediaires = QColor("yellow"); colorEtapes = QColor("orange"); diff --git a/stm32/src/strategie/tapis.cpp b/stm32/src/strategie/tapis.cpp deleted file mode 100644 index 02a9b66b58933f5d9ac8d4b53573321b9ab8520c..0000000000000000000000000000000000000000 --- a/stm32/src/strategie/tapis.cpp +++ /dev/null @@ -1,103 +0,0 @@ -#include "tapis.h" -#include "strategieV2.h" -#include "mediumLevelAction.h" -#include "command.h" -#include "position.h" - -#ifndef ROBOTHW -#include -#endif - -#define GRANDE_ATTENTE 300 - -Tapis::Tapis(){} - -Tapis::Tapis(Position position):MediumLevelAction(position) -{ - this->toLookAt = M_PI/2; - if (position == Position(1060, 848)) - { - this->cote = BrasTapis::GAUCHE; - } - if (position == Position(1342, 848)) - { - this->cote = BrasTapis::DROIT; - } -} - -Tapis::~Tapis(){} - -Etape::EtapeType Tapis::getType() -{ - return Etape::TAPIS; -} - -int Tapis::update() -{ - if (status == 0) - { -#ifndef ROBOTHW - qDebug() << "tapis"; -#endif - status++; - } - - else if (status == 1) - { - StrategieV2::setCurrentGoal(goalPosition, goBack); - status++; - } - - else if (status == 2) - { - if (Command::isNear(goalPosition)) - { - StrategieV2::lookAt(toLookAt); - status++; - } - } - - else if (status == 3) - { - if (Command::isLookingAt(toLookAt)) - { - //ouvrir le bras -#ifndef ROBOTHW - qDebug() << "On ouvre le bras"; -#endif - for (int i = 0; i<10000; i++); - BrasTapis::getSingleton(cote)->ouvrirBras(); - status++; - } - } - - else if (status < 3 + GRANDE_ATTENTE) - { - status++; - } - - else if (status == 3 + GRANDE_ATTENTE) - { - //fermer bras -#ifndef ROBOTHW - qDebug() << "On ferme le bras"; -#endif - BrasTapis::getSingleton(cote)->fermerBras(); - status++; - } - - else if (status < 3 + GRANDE_ATTENTE + GRANDE_ATTENTE) - { - status++; - } - - else if (status == 3 + GRANDE_ATTENTE + GRANDE_ATTENTE) //On attend que les bras se ferment. - { -#ifndef ROBOTHW - qDebug() << "Etape tapis finie"; -#endif - status = -1; - } - return status; -} -