strat des robots

Fork of CRAC-Strat_2017 by CRAC Team

Committer:
ClementBreteau
Date:
Fri May 19 17:14:07 2017 +0000
Revision:
17:d1594579eec6
Parent:
11:ed13a480ddca
strat du robot, 19-05-2017, 19h

Who changed what in which revision?

UserRevisionLine numberNew contents of line
antbig 0:ad97421fb1fb 1 #ifndef CRAC_INSTRUCTION
antbig 0:ad97421fb1fb 2 #define CRAC_INSTRUCTION
antbig 0:ad97421fb1fb 3
antbig 0:ad97421fb1fb 4 #include "global.h"
antbig 0:ad97421fb1fb 5
antbig 0:ad97421fb1fb 6 enum E_InstructionType
antbig 0:ad97421fb1fb 7 {
antbig 0:ad97421fb1fb 8 MV_COURBURE, // C -> Courbure
antbig 0:ad97421fb1fb 9 MV_LINE, // L -> Ligne droite
antbig 0:ad97421fb1fb 10 MV_TURN, // T -> Rotation sur place
antbig 0:ad97421fb1fb 11 MV_XYT, // X -> Aller à
antbig 0:ad97421fb1fb 12 MV_RECALAGE, // R -> Recalage bordure
antbig 0:ad97421fb1fb 13 ACTION, // A -> Action
antbig 0:ad97421fb1fb 14 UNKNOWN // Erreur, instruction inconnue
antbig 0:ad97421fb1fb 15 };
antbig 0:ad97421fb1fb 16 enum E_InstructionDirection
antbig 0:ad97421fb1fb 17 {
antbig 0:ad97421fb1fb 18 NODIRECTION, // N -> Parametre absent
antbig 0:ad97421fb1fb 19 BACKWARD,
antbig 0:ad97421fb1fb 20 FORWARD,
antbig 0:ad97421fb1fb 21 RELATIVE,
antbig 11:ed13a480ddca 22 ABSOLUTE,
antbig 11:ed13a480ddca 23 LEFT,
antbig 11:ed13a480ddca 24 RIGHT
antbig 0:ad97421fb1fb 25 };
antbig 0:ad97421fb1fb 26 enum E_InstructionPrecisionOuRecalage
antbig 0:ad97421fb1fb 27 {
antbig 0:ad97421fb1fb 28 NOPRECISION,// N -> Parametre absent
antbig 0:ad97421fb1fb 29 PRECISION, // P -> Precision, verifier la position à la fin du mouvement et refaire un XYT si erreur > 1cm
antbig 0:ad97421fb1fb 30 RECALAGE_X, // X -> Recalage en X, indique un recalage sur l'axe X
antbig 0:ad97421fb1fb 31 RECALAGE_Y // Y -> Recalage en Y, indique un recalage sur l'axe Y
antbig 0:ad97421fb1fb 32 };
antbig 0:ad97421fb1fb 33 enum E_InstructionNextActionType
antbig 0:ad97421fb1fb 34 {
antbig 0:ad97421fb1fb 35 NONEXTACTION, // N -> Parametre absent
antbig 0:ad97421fb1fb 36 JUMP,
antbig 0:ad97421fb1fb 37 WAIT,
antbig 0:ad97421fb1fb 38 ENCHAINEMENT
antbig 0:ad97421fb1fb 39 };
antbig 0:ad97421fb1fb 40 enum E_InstructionNextActionJumpType
antbig 0:ad97421fb1fb 41 {
antbig 0:ad97421fb1fb 42 NONEXTACTIONJUMPTYPE, // N -> Parametre absent
antbig 0:ad97421fb1fb 43 JUMP_TIME,
antbig 0:ad97421fb1fb 44 JUMP_POSITION
antbig 0:ad97421fb1fb 45 };
antbig 0:ad97421fb1fb 46 struct S_Instruction
antbig 0:ad97421fb1fb 47 {
antbig 0:ad97421fb1fb 48 short lineNumber;//Numéro de la ligne
antbig 0:ad97421fb1fb 49 enum E_InstructionType order; //Type de l'instruction
antbig 0:ad97421fb1fb 50 enum E_InstructionDirection direction; //BackWard ou Forward || Relative ou Absolu
antbig 0:ad97421fb1fb 51
antbig 0:ad97421fb1fb 52 unsigned short arg1;
antbig 0:ad97421fb1fb 53 unsigned short arg2;
antbig 0:ad97421fb1fb 54 signed short arg3;
antbig 0:ad97421fb1fb 55
antbig 0:ad97421fb1fb 56 enum E_InstructionPrecisionOuRecalage precision;
antbig 0:ad97421fb1fb 57 enum E_InstructionNextActionType nextActionType;
antbig 0:ad97421fb1fb 58 enum E_InstructionNextActionJumpType jumpAction;
antbig 0:ad97421fb1fb 59 unsigned short JumpTimeOrX;
antbig 0:ad97421fb1fb 60 unsigned short JumpY;
antbig 0:ad97421fb1fb 61 unsigned short nextLineOK;
antbig 0:ad97421fb1fb 62 unsigned short nextLineError;
antbig 0:ad97421fb1fb 63 };
antbig 0:ad97421fb1fb 64
antbig 0:ad97421fb1fb 65 /**
antbig 0:ad97421fb1fb 66 * Convertir un char en type d'instruction
antbig 0:ad97421fb1fb 67 **/
antbig 0:ad97421fb1fb 68 enum E_InstructionType charToInstructionType(char type);
antbig 0:ad97421fb1fb 69
antbig 0:ad97421fb1fb 70 /**
antbig 0:ad97421fb1fb 71 *
antbig 0:ad97421fb1fb 72 **/
antbig 0:ad97421fb1fb 73 enum E_InstructionDirection charToInstructionDirection(char type);
antbig 0:ad97421fb1fb 74
antbig 0:ad97421fb1fb 75 /**
antbig 0:ad97421fb1fb 76 * Convertir un char
antbig 0:ad97421fb1fb 77 **/
antbig 0:ad97421fb1fb 78 enum E_InstructionPrecisionOuRecalage charToInstructionPrecisionOuRecalage(char type);
antbig 0:ad97421fb1fb 79
antbig 0:ad97421fb1fb 80 /**
antbig 0:ad97421fb1fb 81 *
antbig 0:ad97421fb1fb 82 **/
antbig 0:ad97421fb1fb 83 enum E_InstructionNextActionType charToInstructionNextActionType(char type);
antbig 0:ad97421fb1fb 84
antbig 0:ad97421fb1fb 85 /**
antbig 0:ad97421fb1fb 86 *
antbig 0:ad97421fb1fb 87 **/
antbig 0:ad97421fb1fb 88 enum E_InstructionNextActionJumpType charToInstructionNextActionJumpType(char type);
antbig 0:ad97421fb1fb 89
antbig 4:88431b537477 90 /****************************************************************************************/
antbig 4:88431b537477 91 /* FUNCTION NAME: stringToInstruction */
antbig 4:88431b537477 92 /* DESCRIPTION : Conversion d'une ligne du fichier de strat en instruction */
antbig 4:88431b537477 93 /****************************************************************************************/
antbig 0:ad97421fb1fb 94 struct S_Instruction stringToInstruction(char line[]);
antbig 0:ad97421fb1fb 95
antbig 4:88431b537477 96 /****************************************************************************************/
antbig 4:88431b537477 97 /* FUNCTION NAME: loadAllInstruction */
antbig 4:88431b537477 98 /* DESCRIPTION : Charger toutes les instructions du fichier de stratégie */
antbig 4:88431b537477 99 /* Il faut utiliser strcpy(cheminFileStart,"/local/strat.txt"); */
antbig 4:88431b537477 100 /* pour indiquer le fichier à utiliser */
antbig 4:88431b537477 101 /****************************************************************************************/
antbig 0:ad97421fb1fb 102 void loadAllInstruction(void);
antbig 0:ad97421fb1fb 103
antbig 4:88431b537477 104 /****************************************************************************************/
antbig 4:88431b537477 105 /* FUNCTION NAME: FileExists */
antbig 4:88431b537477 106 /* DESCRIPTION : Permet de vérifier si un fichier existe */
antbig 4:88431b537477 107 /****************************************************************************************/
antbig 4:88431b537477 108 int FileExists(const char *fname);
antbig 4:88431b537477 109
antbig 0:ad97421fb1fb 110
antbig 0:ad97421fb1fb 111 #endif