Fork de Timer après le match à 61 points

Dependencies:   RoboClaw mbed

Fork of Timer by ARES

Committer:
IceTeam
Date:
Wed May 04 16:21:48 2016 +0000
Revision:
53:bef06d5e827d
Parent:
51:1056dd73a748
Parent:
52:98f8a6ccb6ae
Child:
54:be4ea8da9057
Ajout d?part homologation;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
sype 41:b5a2fbc20beb 1 #include "func.h"
IceTeam 47:be4eebf40568 2 #include "map.h"
sype 0:ad9600df4a70 3
sype 41:b5a2fbc20beb 4 /* Déclaration des différents éléments de l'IHM */
sype 46:5658af4e5149 5
sype 51:1056dd73a748 6 DigitalIn CAMP(PA_15);
sype 51:1056dd73a748 7 DigitalIn START(PB_7);
sype 46:5658af4e5149 8 DigitalOut LEDR(PC_2);
sype 46:5658af4e5149 9 DigitalOut LEDV(PC_3);
sype 46:5658af4e5149 10
sype 51:1056dd73a748 11 BusOut drapeau(PC_8, PC_6, PC_5);
sype 51:1056dd73a748 12
sype 10:ae3178aa94e9 13 InterruptIn mybutton(USER_BUTTON);
sype 10:ae3178aa94e9 14 DigitalIn button(USER_BUTTON);
sype 46:5658af4e5149 15
sype 46:5658af4e5149 16 DigitalIn ChannelA1(PA_1);
sype 46:5658af4e5149 17 DigitalIn ChannelB1(PA_0);
sype 46:5658af4e5149 18 DigitalIn ChannelA2(PA_5);
sype 46:5658af4e5149 19 DigitalIn ChannelB2(PA_6);
sype 46:5658af4e5149 20
sype 41:b5a2fbc20beb 21 DigitalOut bleu(PC_5);
sype 41:b5a2fbc20beb 22 DigitalOut blanc(PC_6);
sype 41:b5a2fbc20beb 23 DigitalOut rouge(PC_8);
sype 41:b5a2fbc20beb 24
sype 48:03da1aead032 25 //AX12 left_hand(PA_9, PA_10, 4, 250000);
sype 48:03da1aead032 26 //AX12 right_hand(PA_9, PA_10, 1, 250000);
sype 41:b5a2fbc20beb 27
sype 41:b5a2fbc20beb 28 /* Sharp */
sype 41:b5a2fbc20beb 29 AnalogIn capt1(PA_4);
sype 41:b5a2fbc20beb 30 AnalogIn capt2(PB_0);
sype 41:b5a2fbc20beb 31 AnalogIn capt3(PC_1);
sype 41:b5a2fbc20beb 32 AnalogIn capt4(PC_0);
sype 41:b5a2fbc20beb 33
sype 41:b5a2fbc20beb 34 /* Moteurs pas à pas */
sype 51:1056dd73a748 35 Stepper RMot(NC, PA_8, PC_7, 4);
sype 51:1056dd73a748 36 Stepper ZMot(NC, PB_4, PB_10, 5);
sype 51:1056dd73a748 37 Stepper LMot(NC, PB_5, PB_3, 4);
sype 41:b5a2fbc20beb 38 /* Fins de course */
sype 41:b5a2fbc20beb 39 InterruptIn EndR(PB_15);
sype 41:b5a2fbc20beb 40 InterruptIn EndZ(PB_14);
sype 41:b5a2fbc20beb 41 InterruptIn EndL(PB_13);
sype 51:1056dd73a748 42 DigitalIn EnR(PB_15);
sype 51:1056dd73a748 43 DigitalIn EnZ(PB_14);
sype 51:1056dd73a748 44 DigitalIn EnL(PB_13);
sype 41:b5a2fbc20beb 45
sype 0:ad9600df4a70 46 Ticker ticker;
IceTeam 47:be4eebf40568 47 //Serial logger(USBTX, USBRX);
sype 51:1056dd73a748 48 Serial logger(PA_2, PA_3);
sype 46:5658af4e5149 49 RoboClaw roboclaw(ADR, 460800, PA_11, PA_12);
IceTeam 39:309f38d1e49c 50 Odometry odo(61.7, 61.8, ENTRAXE, 4096, roboclaw);
sype 10:ae3178aa94e9 51
sype 51:1056dd73a748 52 int SIMON_i = 0, SIMON_state = 0, SCouleur = VERT, SStart = 0, SSchema = 1;
sype 51:1056dd73a748 53 bool SIMON_EL = false, SIMON_EZ = false, SIMON_ER = false, SGauche = false, SDevant = false, SDroite = false;
sype 0:ad9600df4a70 54
sype 2:abdf8c6823a1 55 void init(void);
sype 46:5658af4e5149 56 void update_main(void);
sype 0:ad9600df4a70 57
sype 43:d5aaff7d2bec 58 /* Debut du programme */
sype 0:ad9600df4a70 59 int main(void)
sype 10:ae3178aa94e9 60 {
IceTeam 53:bef06d5e827d 61 <<<<<<< local
sype 51:1056dd73a748 62 logger.printf("Depart homologation !\n\r");
sype 51:1056dd73a748 63 homologation();
sype 51:1056dd73a748 64 /*drapeau = 0;
sype 51:1056dd73a748 65 init();
sype 51:1056dd73a748 66
sype 51:1056dd73a748 67 map m(&odo);
IceTeam 47:be4eebf40568 68 m.addObs(obsCarr (1250, 1000, 220, 220));
IceTeam 47:be4eebf40568 69 m.addObs(obsCarr (1500, 750, 220, 220));
IceTeam 47:be4eebf40568 70 m.addObs(obsCarr (1500, 1250, 220, 220));
sype 51:1056dd73a748 71
IceTeam 53:bef06d5e827d 72 =======
IceTeam 47:be4eebf40568 73 init();
IceTeam 47:be4eebf40568 74
IceTeam 52:98f8a6ccb6ae 75 int cote = MAP_RIGHTSIDE;
IceTeam 47:be4eebf40568 76 /*map m(&odo);
IceTeam 52:98f8a6ccb6ae 77 m.Build(cote);
IceTeam 53:bef06d5e827d 78 >>>>>>> other
IceTeam 47:be4eebf40568 79 m.Execute(1000,1000);
IceTeam 47:be4eebf40568 80 m.Execute(1500,1000);
IceTeam 47:be4eebf40568 81 m.Execute(1500,1500);
IceTeam 47:be4eebf40568 82 m.Execute(110,1000);
sype 51:1056dd73a748 83
IceTeam 47:be4eebf40568 84 odo.GotoThet(0);
sype 49:5e2f7323f280 85 roboclaw.ForwardM1(0);
sype 49:5e2f7323f280 86 roboclaw.ForwardM2(0);
sype 51:1056dd73a748 87 logger.printf ("Chemin Fini !");
sype 51:1056dd73a748 88
sype 51:1056dd73a748 89 while(1);*/
sype 2:abdf8c6823a1 90 }
sype 2:abdf8c6823a1 91
sype 2:abdf8c6823a1 92 void init(void)
sype 0:ad9600df4a70 93 {
sype 37:da3a2c781672 94 logger.baud(9600);
sype 37:da3a2c781672 95 logger.printf("Hello from main !\n\r");
sype 51:1056dd73a748 96
sype 51:1056dd73a748 97 init_interrupt();
sype 51:1056dd73a748 98 goHome();
sype 51:1056dd73a748 99
sype 51:1056dd73a748 100 SCouleur = VERT;
sype 51:1056dd73a748 101 LEDV = 1;
sype 51:1056dd73a748 102 LEDR = 0;
sype 51:1056dd73a748 103
sype 49:5e2f7323f280 104 odo.setPos(110, 1000, 0);
sype 51:1056dd73a748 105 roboclaw.ResetEnc();
sype 46:5658af4e5149 106 roboclaw.ForwardM1(0);
sype 51:1056dd73a748 107 roboclaw.ForwardM2(0);
sype 10:ae3178aa94e9 108 wait_ms(500);
sype 51:1056dd73a748 109 while(1);
sype 51:1056dd73a748 110 //depart();
sype 44:b1fd7489369f 111 init_interrupt();
sype 41:b5a2fbc20beb 112 wait_ms(100);
sype 51:1056dd73a748 113 while(START==0);
IceTeam 39:309f38d1e49c 114 logger.printf("End init\n\r");
sype 0:ad9600df4a70 115 }
sype 46:5658af4e5149 116
sype 46:5658af4e5149 117 void update_main(void)
sype 46:5658af4e5149 118 {
sype 49:5e2f7323f280 119 odo.update_odo();
sype 51:1056dd73a748 120 checkAround();
sype 46:5658af4e5149 121 }