Guillaume Chauvon
/
Asserve12
asser1
main.cpp@3:1dba6eca01ad, 2019-05-06 (annotated)
- Committer:
- GuillaumeCH
- Date:
- Mon May 06 13:48:45 2019 +0000
- Revision:
- 3:1dba6eca01ad
- Parent:
- 2:5764f89a27f6
- Child:
- 4:deef042e9c02
O
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Coconara | 0:6ca63d45f0ee | 1 | #include "mbed.h" |
Coconara | 0:6ca63d45f0ee | 2 | |
Coconara | 0:6ca63d45f0ee | 3 | #include "hardware.h" |
Coconara | 0:6ca63d45f0ee | 4 | #include "odometrie.h" |
Coconara | 0:6ca63d45f0ee | 5 | #include "reglages.h" |
GuillaumeCH | 2:5764f89a27f6 | 6 | #include "commande_moteurs.h" |
GuillaumeCH | 3:1dba6eca01ad | 7 | #include "deplacement.h" |
Coconara | 0:6ca63d45f0ee | 8 | |
Coconara | 0:6ca63d45f0ee | 9 | int main() |
Coconara | 0:6ca63d45f0ee | 10 | { |
Coconara | 0:6ca63d45f0ee | 11 | //init |
Coconara | 0:6ca63d45f0ee | 12 | init_odometrie(); |
Coconara | 0:6ca63d45f0ee | 13 | init_hardware(); |
GuillaumeCH | 2:5764f89a27f6 | 14 | srand(time(NULL)); |
GuillaumeCH | 2:5764f89a27f6 | 15 | motors_on(); |
GuillaumeCH | 3:1dba6eca01ad | 16 | /*DigitalIn depart(USER_BUTTON); |
GuillaumeCH | 2:5764f89a27f6 | 17 | //Pause pour sauver le robot et l'ordi |
GuillaumeCH | 3:1dba6eca01ad | 18 | while(depart);*/ |
GuillaumeCH | 3:1dba6eca01ad | 19 | deplacement robot; |
GuillaumeCH | 3:1dba6eca01ad | 20 | robot.bouton(); |
GuillaumeCH | 3:1dba6eca01ad | 21 | Ticker asser; |
GuillaumeCH | 3:1dba6eca01ad | 22 | Timer t; |
GuillaumeCH | 3:1dba6eca01ad | 23 | t.start(); |
GuillaumeCH | 3:1dba6eca01ad | 24 | asser.attach(callback(&robot,&deplacement::asservissement),0.01); |
GuillaumeCH | 3:1dba6eca01ad | 25 | robot.test(); |
GuillaumeCH | 3:1dba6eca01ad | 26 | asser.detach(); |
GuillaumeCH | 3:1dba6eca01ad | 27 | robot.vitesse_nulle_G(0); |
GuillaumeCH | 3:1dba6eca01ad | 28 | robot.vitesse_nulle_D(0); |
GuillaumeCH | 3:1dba6eca01ad | 29 | wait(0.2); |
GuillaumeCH | 3:1dba6eca01ad | 30 | motors_stop(); |
GuillaumeCH | 3:1dba6eca01ad | 31 | robot.printftab(); |
GuillaumeCH | 3:1dba6eca01ad | 32 | //actualise_position(); |
GuillaumeCH | 3:1dba6eca01ad | 33 | //while(t.read()<5){ |
GuillaumeCH | 3:1dba6eca01ad | 34 | //debugEncoder(); |
GuillaumeCH | 3:1dba6eca01ad | 35 | //} |
GuillaumeCH | 3:1dba6eca01ad | 36 | |
GuillaumeCH | 3:1dba6eca01ad | 37 | //commande_vitesse(600,600); |
GuillaumeCH | 3:1dba6eca01ad | 38 | |
GuillaumeCH | 3:1dba6eca01ad | 39 | //robot.ligne_droite_v2(150000); |
GuillaumeCH | 3:1dba6eca01ad | 40 | //asser.detach(); |
GuillaumeCH | 3:1dba6eca01ad | 41 | //robot.ligne_droite_v2(210000); |
GuillaumeCH | 3:1dba6eca01ad | 42 | //robot.test_rotation_rel(-90); |
GuillaumeCH | 3:1dba6eca01ad | 43 | //ligne_droite_v2(210000); |
GuillaumeCH | 3:1dba6eca01ad | 44 | /*while(t.read()<3){ |
GuillaumeCH | 3:1dba6eca01ad | 45 | //actualise_position(); |
GuillaumeCH | 3:1dba6eca01ad | 46 | //actualise_position_test(); |
GuillaumeCH | 3:1dba6eca01ad | 47 | //debugEncoder(); |
GuillaumeCH | 3:1dba6eca01ad | 48 | //("bite"); |
GuillaumeCH | 3:1dba6eca01ad | 49 | }*/ |
GuillaumeCH | 3:1dba6eca01ad | 50 | //wait(1); |
GuillaumeCH | 3:1dba6eca01ad | 51 | /*for(int i =0;i<50;i++){ |
GuillaumeCH | 3:1dba6eca01ad | 52 | robot.test_rotation_rel(180); |
GuillaumeCH | 3:1dba6eca01ad | 53 | }*/ |
GuillaumeCH | 3:1dba6eca01ad | 54 | //robot.ligne_droite_v2(30000); |
GuillaumeCH | 3:1dba6eca01ad | 55 | /*robot.ligne_droite_v2(100000); |
GuillaumeCH | 3:1dba6eca01ad | 56 | robot.ligne_droite_v2(100000); |
GuillaumeCH | 3:1dba6eca01ad | 57 | robot.ligne_droite_v2(100000); |
GuillaumeCH | 3:1dba6eca01ad | 58 | robot.ligne_droite_v2(100000); |
GuillaumeCH | 3:1dba6eca01ad | 59 | robot.ligne_droite_v2(100000); |
GuillaumeCH | 3:1dba6eca01ad | 60 | robot.ligne_droite_v2(100000); |
GuillaumeCH | 3:1dba6eca01ad | 61 | robot.ligne_droite_v2(100000); |
GuillaumeCH | 3:1dba6eca01ad | 62 | robot.ligne_droite_v2(100000); |
GuillaumeCH | 3:1dba6eca01ad | 63 | robot.ligne_droite_v2(100000); |
GuillaumeCH | 3:1dba6eca01ad | 64 | robot.ligne_droite_v2(100000);*/ |
GuillaumeCH | 3:1dba6eca01ad | 65 | //robot.ligne_droite_v2(210000); |
GuillaumeCH | 3:1dba6eca01ad | 66 | /*for (int i =0;i<4;i++){ |
GuillaumeCH | 3:1dba6eca01ad | 67 | robot.ligne_droite_v2(50000); |
GuillaumeCH | 3:1dba6eca01ad | 68 | robot.test_rotation_rel(-90); |
GuillaumeCH | 3:1dba6eca01ad | 69 | }*/ |
GuillaumeCH | 3:1dba6eca01ad | 70 | //robot.ligne_droite_v2(140000); |
GuillaumeCH | 3:1dba6eca01ad | 71 | //vitesse_nulle_G(0); |
GuillaumeCH | 3:1dba6eca01ad | 72 | //vitesse_nulle_D(0); |
GuillaumeCH | 3:1dba6eca01ad | 73 | //motors_stop(); |
GuillaumeCH | 3:1dba6eca01ad | 74 | //robot.tab(); |
GuillaumeCH | 3:1dba6eca01ad | 75 | //ligne_droite(200000); |
GuillaumeCH | 3:1dba6eca01ad | 76 | //ligne_droite_v2(200000); |
GuillaumeCH | 2:5764f89a27f6 | 77 | //commande_vitesse(500,500); |
GuillaumeCH | 3:1dba6eca01ad | 78 | //test_rotation_rel(90); |
GuillaumeCH | 3:1dba6eca01ad | 79 | //test_rotation_rel(-90); |
GuillaumeCH | 3:1dba6eca01ad | 80 | //test_rotation_rel(180); |
GuillaumeCH | 3:1dba6eca01ad | 81 | /*for (int i =0;i<6;i++){ |
GuillaumeCH | 3:1dba6eca01ad | 82 | robot.test_rotation_rel(180); |
GuillaumeCH | 2:5764f89a27f6 | 83 | wait(1); |
Coconara | 1:0690cf83f060 | 84 | }*/ |
GuillaumeCH | 3:1dba6eca01ad | 85 | |
Coconara | 0:6ca63d45f0ee | 86 | return 0; |
Coconara | 0:6ca63d45f0ee | 87 | } |