Programme course fonctionnel Jour J Croisement non pris en charge (tourne en rond)

Dependencies:   MMA8451Q mbed

Fork of Programme_course_30Tr by Freescale_Cachan

Committer:
leandre
Date:
Fri Mar 24 09:29:12 2017 +0000
Revision:
5:7714a216c91d
Parent:
4:8b0215ec788f
Prog fonctionnel Jour J; Croisement ? r?gler

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Freescale_cup 0:3ec7fc598e48 1
Freescale_cup 0:3ec7fc598e48 2
Freescale_cup 0:3ec7fc598e48 3 #ifndef TEST
Freescale_cup 0:3ec7fc598e48 4 #define TEST
Freescale_cup 0:3ec7fc598e48 5
Freescale_cup 0:3ec7fc598e48 6 #include "mbed.h"
Freescale_cup 0:3ec7fc598e48 7 #include "MMA8451Q.h"
Freescale_cup 0:3ec7fc598e48 8 #include "motor.h"
leandre 5:7714a216c91d 9
Freescale_cup 0:3ec7fc598e48 10 #define MMA8451_I2C_ADRESS (0x1d<<1)
Freescale_cup 0:3ec7fc598e48 11
Freescale_cup 0:3ec7fc598e48 12 #define FRQ_CLK 15000
Freescale_cup 0:3ec7fc598e48 13 #define FRQ_CYC 6000
Freescale_cup 0:3ec7fc598e48 14 #define AMIDTAB 64
Freescale_cup 0:3ec7fc598e48 15 #define BMIDTAB 63
Freescale_cup 0:3ec7fc598e48 16 #define BANDSIZE 4
Freescale_cup 0:3ec7fc598e48 17 #define MIN_INTE 0
leandre 5:7714a216c91d 18 #define MAX_INTE FRQ_CYC-500
Freescale_cup 0:3ec7fc598e48 19 #define INCREM_BALANCE 300
Freescale_cup 0:3ec7fc598e48 20 #define MARGE_LIGNE 5
Freescale_cup 0:3ec7fc598e48 21 #define MARGE_DISTANCE_LIGNE 10
leandre 2:a37de5eb8bf3 22 #define LUMI_MOYENNE 90
leandre 2:a37de5eb8bf3 23
Freescale_cup 0:3ec7fc598e48 24 #define CORRECTION_VIRAGE 1
Freescale_cup 0:3ec7fc598e48 25 #define MAX_BATTERY 1.3
Freescale_cup 0:3ec7fc598e48 26 #define SEUIL_NB_DERRIVEE 25
leandre 2:a37de5eb8bf3 27 #define KD 400 //valeur de base 400
Freescale_cup 0:3ec7fc598e48 28 #define KI 3
Freescale_cup 0:3ec7fc598e48 29
Freescale_cup 0:3ec7fc598e48 30 #define BOSSE_ACTIVE S2
Freescale_cup 0:3ec7fc598e48 31
Freescale_cup 0:3ec7fc598e48 32 #define VITESSE 40
leandre 2:a37de5eb8bf3 33
leandre 4:8b0215ec788f 34 #define TAILLE_TAB_INT 5
leandre 5:7714a216c91d 35 #define SEUIL_INT_VIR 50
Freescale_cup 0:3ec7fc598e48 36 /***********************FONCTIONS**********************/
Freescale_cup 0:3ec7fc598e48 37 /**/ /****************CAMERA****************/ /**/
Freescale_cup 0:3ec7fc598e48 38 /**/ void F_GetData(); /**/
Freescale_cup 0:3ec7fc598e48 39 /**/ void F_CLK(); /**/
Freescale_cup 0:3ec7fc598e48 40 /**/ void Impulse_SI(); /**/
Freescale_cup 0:3ec7fc598e48 41 /**/ /**/
Freescale_cup 0:3ec7fc598e48 42 /**/ /***************SHIELD*****************/ /**/
Freescale_cup 0:3ec7fc598e48 43 /**/ void moteurs_arriere(); /**/
Freescale_cup 0:3ec7fc598e48 44 /**/ void test_servo(int time); /**/
Freescale_cup 0:3ec7fc598e48 45 /**/ void Get_pot_value(); /**/
Freescale_cup 0:3ec7fc598e48 46 /**/ /**/
Freescale_cup 0:3ec7fc598e48 47 /**/ /**********TRAITEMENT_IMG************/ /**/
Freescale_cup 0:3ec7fc598e48 48 /**/ void F_TraitementImage(); /**/
Freescale_cup 0:3ec7fc598e48 49 /**/ void F_BalanceBlancs(); /**/
Freescale_cup 0:3ec7fc598e48 50 /**/ void Gestion_bosse(); /**/
Freescale_cup 0:3ec7fc598e48 51 /**/ void T_image(); /**/
Freescale_cup 0:3ec7fc598e48 52 /**/ /**/
Freescale_cup 0:3ec7fc598e48 53 /**/ /**/
Freescale_cup 0:3ec7fc598e48 54 /**/ /***********AUTRES_FCT***************/ /**/
Freescale_cup 0:3ec7fc598e48 55 /**/ char middle_3(char *tab); /**/
Freescale_cup 0:3ec7fc598e48 56 /**/ int middle_3U(int *tab); /**/
Freescale_cup 0:3ec7fc598e48 57 /**/ float middle_3F(float *tab); /**/
Freescale_cup 0:3ec7fc598e48 58 /**/ void tri_a_bulle(char* t, int const size); /**/
Freescale_cup 0:3ec7fc598e48 59 /**/ void tri_a_bulleU(int* t, int const size); /**/
Freescale_cup 0:3ec7fc598e48 60 /**/ float tri_a_bulleF(float*t, int const size);/**/
Freescale_cup 0:3ec7fc598e48 61 /**/ unsigned char Moyenne(unsigned char *tab); /**/
Freescale_cup 0:3ec7fc598e48 62 /**/ char Moyenne2(char *tab, int nb); /**/
Freescale_cup 0:3ec7fc598e48 63 /**/ void menu(); /**/
Freescale_cup 0:3ec7fc598e48 64 /**/ void init_bary(); /**/
Freescale_cup 0:3ec7fc598e48 65 /**/ void fin_course(); /**/
Freescale_cup 0:3ec7fc598e48 66 /******************************************************/
Freescale_cup 0:3ec7fc598e48 67
Freescale_cup 0:3ec7fc598e48 68 /****************CAMERA****************/
Freescale_cup 0:3ec7fc598e48 69 extern DigitalOut SI;
Freescale_cup 0:3ec7fc598e48 70 extern DigitalOut CLK;
Freescale_cup 0:3ec7fc598e48 71 extern AnalogIn AIN;
Freescale_cup 0:3ec7fc598e48 72 extern unsigned char cam_data[128];
Freescale_cup 0:3ec7fc598e48 73 extern InterruptIn Int_clk;
Freescale_cup 0:3ec7fc598e48 74 extern char numero_data;
Freescale_cup 0:3ec7fc598e48 75 extern char clk_active;
Freescale_cup 0:3ec7fc598e48 76
Freescale_cup 0:3ec7fc598e48 77 /***************SHIELD*****************/
Freescale_cup 0:3ec7fc598e48 78 extern char bosse;
Freescale_cup 0:3ec7fc598e48 79 extern int ajust_vitesse;
Freescale_cup 0:3ec7fc598e48 80 extern int vitesse_virage;
Freescale_cup 0:3ec7fc598e48 81 extern DigitalOut BP1;
Freescale_cup 0:3ec7fc598e48 82 extern DigitalOut BP2;
Freescale_cup 0:3ec7fc598e48 83 extern DigitalOut led1;
Freescale_cup 0:3ec7fc598e48 84 extern DigitalOut led2;
Freescale_cup 0:3ec7fc598e48 85 extern DigitalOut led3;
Freescale_cup 0:3ec7fc598e48 86 extern DigitalOut led4;
Freescale_cup 0:3ec7fc598e48 87 extern DigitalIn S1;
Freescale_cup 0:3ec7fc598e48 88 extern DigitalIn S2;
Freescale_cup 0:3ec7fc598e48 89 extern DigitalIn S3;
Freescale_cup 0:3ec7fc598e48 90 extern DigitalIn S4;
Freescale_cup 0:3ec7fc598e48 91 extern AnalogIn pot1;
Freescale_cup 0:3ec7fc598e48 92 extern AnalogIn pot2;
leandre 4:8b0215ec788f 93 extern int ajust_vit_bosse;
leandre 4:8b0215ec788f 94 extern int ajust_vit_vir;
Freescale_cup 0:3ec7fc598e48 95
leandre 2:a37de5eb8bf3 96 //extern DigitalOut RGB_R(LED_RED);
leandre 2:a37de5eb8bf3 97
Freescale_cup 0:3ec7fc598e48 98 /************TRAITEMENT_IMG************/
Freescale_cup 0:3ec7fc598e48 99 extern Ticker t_clk;
Freescale_cup 0:3ec7fc598e48 100 extern Ticker t_finInte;
Freescale_cup 0:3ec7fc598e48 101 extern int tempsInte;
Freescale_cup 0:3ec7fc598e48 102 extern int baricentre;
Freescale_cup 0:3ec7fc598e48 103 extern char arrivee;
Freescale_cup 0:3ec7fc598e48 104 extern int somme_derivee;
Freescale_cup 0:3ec7fc598e48 105 extern int seuil_der;
Freescale_cup 0:3ec7fc598e48 106 extern float last_three[3];
Freescale_cup 0:3ec7fc598e48 107 extern int bary_tab[3];
Freescale_cup 0:3ec7fc598e48 108 extern int bary_tab_bis[3];
Freescale_cup 0:3ec7fc598e48 109 extern int integral;
Freescale_cup 0:3ec7fc598e48 110 extern int new_bari;
Freescale_cup 0:3ec7fc598e48 111 extern int ralentire;
Freescale_cup 0:3ec7fc598e48 112 extern MMA8451Q acc;
Freescale_cup 0:3ec7fc598e48 113 extern char last_five[5];
leandre 2:a37de5eb8bf3 114 extern char mem_a;
leandre 2:a37de5eb8bf3 115 extern char mem_b;
leandre 2:a37de5eb8bf3 116 extern char Interval[TAILLE_TAB_INT];
Freescale_cup 0:3ec7fc598e48 117
Freescale_cup 0:3ec7fc598e48 118 /*************AUTRES_VAR***************/
Freescale_cup 0:3ec7fc598e48 119 extern Ticker t_cyc;
Freescale_cup 0:3ec7fc598e48 120 extern Serial pc;
Freescale_cup 0:3ec7fc598e48 121 extern Timer t_debut;
Freescale_cup 0:3ec7fc598e48 122 extern Timer t_ligne;
Freescale_cup 0:3ec7fc598e48 123 extern Timer timer;
Freescale_cup 0:3ec7fc598e48 124 extern int begin;
Freescale_cup 0:3ec7fc598e48 125 extern int VIT;
Freescale_cup 0:3ec7fc598e48 126 extern int KP;
Freescale_cup 0:3ec7fc598e48 127 extern int ligne_droite;
Freescale_cup 0:3ec7fc598e48 128
Freescale_cup 0:3ec7fc598e48 129
Freescale_cup 0:3ec7fc598e48 130
Freescale_cup 0:3ec7fc598e48 131
Freescale_cup 0:3ec7fc598e48 132
Freescale_cup 0:3ec7fc598e48 133
Freescale_cup 0:3ec7fc598e48 134
Freescale_cup 0:3ec7fc598e48 135
Freescale_cup 0:3ec7fc598e48 136
Freescale_cup 0:3ec7fc598e48 137
Freescale_cup 0:3ec7fc598e48 138
leandre 4:8b0215ec788f 139
leandre 4:8b0215ec788f 140
Freescale_cup 0:3ec7fc598e48 141 #endif /* !MLIB_H*/