homologation gros robot et test avec les ack de la carte a tout faire

Fork of CRAC-Strat_2017_HOMOLOGATION_PETIT_ROBOT by CRAC Team

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers Instruction.h Source File

Instruction.h

00001 #ifndef CRAC_INSTRUCTION
00002 #define CRAC_INSTRUCTION
00003 
00004 #include "global.h"
00005 
00006 enum E_InstructionType
00007 {
00008     MV_COURBURE,    // C -> Courbure
00009     MV_LINE,        // L -> Ligne droite
00010     MV_TURN,        // T -> Rotation sur place
00011     MV_XYT,         // X -> Aller à
00012     MV_RECALAGE,    // R -> Recalage bordure
00013     ACTION,         // A -> Action
00014     UNKNOWN         // Erreur, instruction inconnue
00015 };
00016 enum E_InstructionDirection
00017 {
00018     NODIRECTION,     // N -> Parametre absent
00019     BACKWARD,
00020     FORWARD,
00021     RELATIVE,
00022     ABSOLUTE,
00023     LEFT,
00024     RIGHT
00025 };
00026 enum E_InstructionPrecisionOuRecalage
00027 {
00028     NOPRECISION,// N -> Parametre absent
00029     PRECISION,  // P -> Precision, verifier la position à la fin du mouvement et refaire un XYT si erreur > 1cm
00030     RECALAGE_X, // X -> Recalage en X, indique un recalage sur l'axe X
00031     RECALAGE_Y  // Y -> Recalage en Y, indique un recalage sur l'axe Y
00032 };
00033 enum E_InstructionNextActionType
00034 {
00035     NONEXTACTION,    // N -> Parametre absent
00036     JUMP, 
00037     WAIT,
00038     ENCHAINEMENT
00039 };
00040 enum E_InstructionNextActionJumpType
00041 {
00042     NONEXTACTIONJUMPTYPE,    // N -> Parametre absent
00043     JUMP_TIME,
00044     JUMP_POSITION
00045 };
00046 struct S_Instruction
00047 {
00048     short lineNumber;//Numéro de la ligne
00049     enum E_InstructionType order; //Type de l'instruction
00050     enum E_InstructionDirection direction; //BackWard ou Forward || Relative ou Absolu
00051     
00052     unsigned short  arg1;
00053     unsigned short  arg2;
00054     signed   short  arg3;
00055     
00056     enum E_InstructionPrecisionOuRecalage    precision;
00057     enum E_InstructionNextActionType         nextActionType;
00058     enum E_InstructionNextActionJumpType     jumpAction;
00059     unsigned short JumpTimeOrX;
00060     unsigned short JumpY;
00061     unsigned short nextLineOK;
00062     unsigned short nextLineError;
00063 };
00064 
00065 /**
00066 * Convertir un char en type d'instruction
00067 **/
00068 enum E_InstructionType charToInstructionType(char type);
00069 
00070 /**
00071 * 
00072 **/
00073 enum E_InstructionDirection charToInstructionDirection(char type);
00074 
00075 /**
00076 * Convertir un char 
00077 **/
00078 enum E_InstructionPrecisionOuRecalage charToInstructionPrecisionOuRecalage(char type);
00079 
00080 /**
00081 * 
00082 **/
00083 enum E_InstructionNextActionType charToInstructionNextActionType(char type);
00084 
00085 /**
00086 * 
00087 **/
00088 enum E_InstructionNextActionJumpType charToInstructionNextActionJumpType(char type);
00089 
00090 /****************************************************************************************/
00091 /* FUNCTION NAME: stringToInstruction                                                   */
00092 /* DESCRIPTION  : Conversion d'une ligne du fichier de strat en instruction             */
00093 /****************************************************************************************/
00094 struct S_Instruction stringToInstruction(char line[]);
00095 
00096 /****************************************************************************************/
00097 /* FUNCTION NAME: loadAllInstruction                                                    */
00098 /* DESCRIPTION  : Charger toutes les instructions du fichier de stratégie               */
00099 /*  Il faut utiliser strcpy(cheminFileStart,"/local/strat.txt");                        */
00100 /*   pour indiquer le fichier à utiliser                                                */
00101 /****************************************************************************************/
00102 void loadAllInstruction(void);
00103 
00104 /****************************************************************************************/
00105 /* FUNCTION NAME: FileExists                                                            */
00106 /* DESCRIPTION  : Permet de vérifier si un fichier existe                               */
00107 /****************************************************************************************/
00108 int FileExists(const char *fname);
00109 
00110 
00111 #endif