Programme de contrôle de l'octopode 4DOF, Theraphosa-Salconi.

Dependencies:   debug mbed

CtrlBridge

  • fonction quelquonque pour communiquer avec les module
  • fonction quelquonque pour faire des recherche dans les module dispo
  • autre fonction pour jouer avec MemRegistre

Version 1.2.0

  • Ajout d'un mode de simulation pour tester le code avec seulement un contrôleur stm32
Committer:
salco
Date:
Tue Sep 29 17:23:25 2015 +0000
Revision:
37:f53e9f7a14df
Parent:
36:474d4795aafa
Child:
38:57d5f36a0333
modification de la fonction analiseMaze();

Who changed what in which revision?

UserRevisionLine numberNew contents of line
salco 28:ac5c6350ed9a 1 /**
salco 35:d81f6b927932 2 * @file labyrinthe.h
salco 35:d81f6b927932 3 * @brief Regroupement de fonction pour enregistrer le millieu en 2D.
salco 28:ac5c6350ed9a 4 * @author Salco
salco 28:ac5c6350ed9a 5 * @version 2.00
salco 28:ac5c6350ed9a 6 * @date 11 mars 2015
salco 28:ac5c6350ed9a 7 */
salco 28:ac5c6350ed9a 8 #ifndef LABYRINTHE_H
salco 28:ac5c6350ed9a 9 #define LABYRINTHE_H
salco 35:d81f6b927932 10
salco 28:ac5c6350ed9a 11 #define DEFAULTLABLEIGHT 4
salco 35:d81f6b927932 12 #define DEBUGLABCOORD 0
salco 37:f53e9f7a14df 13 #define DEBUGLABSEARCHCOORD 0
salco 28:ac5c6350ed9a 14
salco 28:ac5c6350ed9a 15 #include "mbed.h"
salco 28:ac5c6350ed9a 16 #include "debug.h"
salco 35:d81f6b927932 17 #include "settingDebug.h"
salco 28:ac5c6350ed9a 18 #include <string>
salco 28:ac5c6350ed9a 19
salco 28:ac5c6350ed9a 20 #define UP 1
salco 28:ac5c6350ed9a 21 #define DOWN 2
salco 28:ac5c6350ed9a 22 #define LEFT 3
salco 28:ac5c6350ed9a 23 #define RIGHT 4
salco 28:ac5c6350ed9a 24
salco 28:ac5c6350ed9a 25
salco 37:f53e9f7a14df 26 /*#define VIDE 3
salco 28:ac5c6350ed9a 27 #define EXPLORER 1
salco 28:ac5c6350ed9a 28 #define MUR 2
salco 37:f53e9f7a14df 29 #define PAS_EXPLORER 0*/
salco 28:ac5c6350ed9a 30
salco 35:d81f6b927932 31 // 1 tuile == 4 byte
salco 35:d81f6b927932 32
salco 36:474d4795aafa 33
salco 36:474d4795aafa 34
salco 36:474d4795aafa 35 class Labyrinthe
salco 36:474d4795aafa 36 {
salco 37:f53e9f7a14df 37 signed char m_posX,m_posY;
salco 36:474d4795aafa 38 char direction;
salco 36:474d4795aafa 39 string mapDuLabyrinthe;
salco 36:474d4795aafa 40
salco 37:f53e9f7a14df 41
salco 36:474d4795aafa 42
salco 36:474d4795aafa 43 public:
salco 36:474d4795aafa 44 enum coordoner_t{
salco 33:c8b4e5a392e6 45 /* C7,C8,C9 */
salco 33:c8b4e5a392e6 46 /* C4,C5,C6 */
salco 33:c8b4e5a392e6 47 /* C1,C2,C3 */
salco 36:474d4795aafa 48 unset = -1,
salco 28:ac5c6350ed9a 49 C1 = 1,
salco 28:ac5c6350ed9a 50 C2 = 2,
salco 28:ac5c6350ed9a 51 C3 = 3,
salco 28:ac5c6350ed9a 52 C4 = 4,
salco 28:ac5c6350ed9a 53 C5 = 5,
salco 28:ac5c6350ed9a 54 C6 = 6,
salco 28:ac5c6350ed9a 55 C7 = 7,
salco 28:ac5c6350ed9a 56 C8 = 8,
salco 28:ac5c6350ed9a 57 C9 = 9
salco 28:ac5c6350ed9a 58 };
salco 28:ac5c6350ed9a 59
salco 36:474d4795aafa 60 enum case_t{
salco 37:f53e9f7a14df 61 error =-1,
salco 36:474d4795aafa 62 pasExplorer = 0,
salco 36:474d4795aafa 63 explorer = 1,
salco 36:474d4795aafa 64 mur = 2,
salco 36:474d4795aafa 65 vide = 3
salco 36:474d4795aafa 66 };
salco 36:474d4795aafa 67
salco 28:ac5c6350ed9a 68 Labyrinthe();
salco 28:ac5c6350ed9a 69 ~Labyrinthe();
salco 28:ac5c6350ed9a 70
salco 28:ac5c6350ed9a 71 char getDirection(){return direction;}
salco 28:ac5c6350ed9a 72 void setDirection(char dir){direction= dir;}
salco 28:ac5c6350ed9a 73
salco 37:f53e9f7a14df 74 signed char getX(void){return m_posX;}
salco 37:f53e9f7a14df 75 void setX(signed char x){m_posX = x;}
salco 28:ac5c6350ed9a 76
salco 37:f53e9f7a14df 77 signed char getY(void){return m_posY;}
salco 37:f53e9f7a14df 78 void getY(signed char y){m_posY = y;}
salco 28:ac5c6350ed9a 79
salco 28:ac5c6350ed9a 80 void goUp(void){m_posY++;}
salco 28:ac5c6350ed9a 81 void goDown(void){m_posY--;}
salco 28:ac5c6350ed9a 82 void goLeft(void){m_posX--;}
salco 37:f53e9f7a14df 83 void goRight(void){m_posX++;}
salco 28:ac5c6350ed9a 84
salco 37:f53e9f7a14df 85
salco 28:ac5c6350ed9a 86
salco 36:474d4795aafa 87 case_t getC(coordoner_t cX);
salco 37:f53e9f7a14df 88 case_t getC(signed char x, signed char y, coordoner_t cX);
salco 37:f53e9f7a14df 89 case_t getC(signed char x, signed char y);
salco 37:f53e9f7a14df 90 void setC(case_t value, signed char x, signed char y, coordoner_t cX);
salco 36:474d4795aafa 91 void setC(case_t value, coordoner_t cX);
salco 37:f53e9f7a14df 92 void setC(case_t value, signed char x, signed char y);
salco 28:ac5c6350ed9a 93
salco 36:474d4795aafa 94 void setC_Up(case_t value);
salco 36:474d4795aafa 95 void setC_Down(case_t value);
salco 36:474d4795aafa 96 void setC_Left(case_t value);
salco 36:474d4795aafa 97 void setC_Right(case_t value);
salco 36:474d4795aafa 98 void setMyPos(case_t value);
salco 28:ac5c6350ed9a 99
salco 35:d81f6b927932 100 /**
salco 35:d81f6b927932 101 * Surcharge de showMap(void)
salco 35:d81f6b927932 102 * @return The formated map 3x3 result
salco 35:d81f6b927932 103 */
salco 35:d81f6b927932 104 string showMap(void);
salco 35:d81f6b927932 105
salco 35:d81f6b927932 106 /**
salco 35:d81f6b927932 107 * Fonction permetant de sortire la map de la position x et y
salco 35:d81f6b927932 108 * @param x position X.
salco 35:d81f6b927932 109 * @param y position Y.
salco 35:d81f6b927932 110 * @return The formated map 3x3 result
salco 35:d81f6b927932 111 */
salco 37:f53e9f7a14df 112 string showMap(signed char x, signed char y);
salco 37:f53e9f7a14df 113
salco 37:f53e9f7a14df 114
salco 37:f53e9f7a14df 115
salco 28:ac5c6350ed9a 116
salco 37:f53e9f7a14df 117 private:
salco 37:f53e9f7a14df 118 int searchCoord(signed char posX,signed char posY);
salco 28:ac5c6350ed9a 119
salco 37:f53e9f7a14df 120 coordoner_t getCoordoner(signed char &x, signed char &y);
salco 37:f53e9f7a14df 121 coordoner_t getCoordoner(void);
salco 37:f53e9f7a14df 122
salco 37:f53e9f7a14df 123 bool updateMap(string mapUpdated);
salco 37:f53e9f7a14df 124 bool updateMap(string mapUpdated,signed char x, signed char y);
salco 37:f53e9f7a14df 125 bool addMap(signed char x, signed char y);
salco 28:ac5c6350ed9a 126
salco 28:ac5c6350ed9a 127 };
salco 28:ac5c6350ed9a 128 #endif //LABYRINTHE_H//