Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
directive.h
00001 /** 00002 * @file directive.h 00003 * @brief Cette classe est le modele des 3 taches de controle. 00004 * @author Salco 00005 * @version 2.00 00006 * @date 11 mars 2015 00007 */ 00008 #ifndef DIRECTIVE_H 00009 #define DIRECTIVE_H 00010 00011 00012 00013 00014 #define mvToADC(value)((value*1.023)/5) 00015 #define ADCTomv(value)((value*5)/1.023) 00016 #define ultrasonicToInch(value)(ADCTomv(value)/9.8) 00017 00018 #define inchToCm(value)(value*2.54) 00019 #define mvToInch(value)(value/9.8) 00020 00021 00022 00023 #include "mbed.h" 00024 #include "debug.h" 00025 #include "source/Task/TTask.h" 00026 #include "Motrice/mouvement.h" 00027 #include <stdlib.h> /* srand, rand */ 00028 #include <list> 00029 #include <time.h> /* time */ 00030 #include "labyrinthe.h" 00031 #include "settingDebug.h" 00032 00033 ////////////////////////////// 00034 // 00 - Nothing // 00035 //X01 - Calibration(milieu) // 00036 //X02 - Debout // 00037 //X03 - Coucher // 00038 //X04 - Tourne Gauche // 00039 //X05 - Tourne Droite // 00040 // 06 - Marche // 00041 // 07 - Recule // 00042 // 08 - Repositioner legs // 00043 // 09 - Crabe Gauche // Dont use Crabe because it's really anoying 00044 // 10 - Crabe Droite // Dont use Crabe because it's really anoying 00045 // 11 - Position naturel // 00046 ////////////////////////////// 00047 #define TBL_CMD_NOTHING 0 00048 #define TBL_CMD_CALIBRATION 1 00049 #define TBL_CMD_DEBOUT 2 00050 #define TBL_CMD_COUCHER 3 00051 #define TBL_CMD_TURN_LEFT 4 00052 #define TBL_CMD_TURN_RIGHT 5 00053 #define TBL_CMD_MARCHE 6 00054 #define TBL_CMD_RECULE 7 00055 #define TBL_CMD_REPOSITIONE 8 00056 #define TBL_CMD_CRAB_LEFT 9 00057 #define TBL_CMD_CRAB_RIGHT 10 00058 #define TBL_CMD_DEFAULT_POS 11 00059 00060 class Directive : public TTask 00061 { 00062 //CtrlBridge* m_CtrlBridge; 00063 Faculter_motrice *ctrDesPattes; 00064 /*Serial*//*Raw*/Serial *ssc32; 00065 string m_capteurUltrasonic,m_capteurIR,m_capteurProximiter; 00066 //char c; 00067 Labyrinthe* myMaze; 00068 bool followThePath; 00069 00070 struct positionXY 00071 { 00072 signed char posX; 00073 signed char posY; 00074 char direction; 00075 }; 00076 std::list<positionXY> bufferNewWay; 00077 00078 double m_valueCapteurUltrasonic,m_valueCapteurIR; 00079 int m_valueCapteurProximiter; 00080 unsigned char tableauDeCommange[DIRECTIVE_TABLEAUDECOMMANDE_SIZE]; 00081 unsigned char size_tableauDeCommange; 00082 void updateModuleValue(void); 00083 void turnRightDirection(char currentDir, char nextDir); 00084 00085 00086 protected: 00087 /* 00088 * Tache principale de la classe 00089 */ 00090 virtual void task(void); 00091 void updateMaze(void); 00092 void analiseMaze(void); 00093 char checkOtherWay(char dir, bool checkExplorer=false); 00094 void checkOtherWay(char &caseFront, char &caseBack, char &caseLeft, char &caseRight); 00095 00096 bool searchNewWay(void); 00097 00098 bool isAnotherWay(void); 00099 public: 00100 Directive(); 00101 virtual~Directive(); 00102 double IRToCm (double miliVolt); 00103 void addTableauDeCommande(unsigned char value); 00104 00105 }; 00106 #endif // DIRECTIVE_H
Generated on Tue Jul 12 2022 19:04:21 by
1.7.2