Time is good

Dependencies:   RoboClaw mbed

Fork of Robot2016_2-0 by ARES

Files at this revision

API Documentation at this revision

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

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
main.cpp.orig Show annotated file Show diff for this revision Revisions of this file
--- a/Map/map.cpp	Wed May 04 16:15:13 2016 +0000
+++ b/Map/map.cpp	Wed May 04 16:21:48 2016 +0000
@@ -3,6 +3,42 @@
 map::map (Odometry* nodo) : Codo(nodo) {
 }
 
+void map::Build (int start_type) {
+    m.addObs(obsCarr (800, 100, 100, 15));
+    m.addObs(obsCarr (2200, 100, 100, 15));
+    
+    m.addObs(obsCarr (1500, 750, 1100, 15));
+    m.addObs(obsCarr (1500, 1050, 20, 300));
+    
+    if (start_type == MAP_RIGHTSIDE) { 
+        m.addObs(obsCarr (0, 2000, 250, 150));  // Coté haut droite
+        m.addObs(obsCarr (200, 2000, 200, 50));
+        
+        m.addObs(obsCarr (3000, 2000, 250, 150));     // Coté bas droite
+        m.addObs(obsCarr (2800, 2000, 200, 50));
+        
+        m.addObs(obsCarr (200, 2000-450, 40, 40));   // Coquillages du haut droit
+        m.addObs(obsCarr (200, 2000-750, 40, 40));
+        
+        m.addObs(obsCarr (900, 2000-550, 40, 40));
+        m.addObs(obsCarr (1200, 2000-350, 40, 40)); // Coquillages du milieu/haut
+        
+        m.addObs(obsCarr (1500, 2000-550, 40, 40));
+        m.addObs(obsCarr (1500, 2000-350, 40, 40)); 
+        
+        m.addObs(obsCarr (3000-900, 2000-550, 40, 40));
+        m.addObs(obsCarr (3000-1200, 2000-350, 40, 40));   
+        
+        m.addObs(obsCarr (3000-200, 2000-450, 40, 40));   // Coquillages du bas droite
+        m.addObs(obsCarr (3000-200, 2000-750, 40, 40));
+    }
+    else {
+        m.addObs(obsCarr (1250, 1000, 220, 220));
+        m.addObs(obsCarr (1500, 750, 220, 220));
+        m.addObs(obsCarr (1500, 1250, 220, 220));   
+    }
+}
+
 void map::addObs (obsCarr nobs) {
     obs.push_back (nobs);
 }
--- a/Map/map.h	Wed May 04 16:15:13 2016 +0000
+++ b/Map/map.h	Wed May 04 16:21:48 2016 +0000
@@ -7,6 +7,9 @@
 #include "controle.h"
 #include "Odometry.h"
 
+#define MAP_RIGHTSIDE 1
+#define MAP_LEFTSIDE 2
+
 class map {
 public:
     map (Odometry* nodo);
@@ -14,6 +17,7 @@
     void FindWay (point dep, point arr);
     void FindWay (float depX, float depY, float arrX, float arrY);
     void Execute (float XObjectif, float YObjectif);
+    void Build(int start_type);
     nVector<pointParcours>& getParc () { return path; }
     bool& getEnded () { return endedParc; }
 
--- a/main.cpp	Wed May 04 16:15:13 2016 +0000
+++ b/main.cpp	Wed May 04 16:21:48 2016 +0000
@@ -58,6 +58,7 @@
 /* Debut du programme */
 int main(void)
 {
+<<<<<<< local
     logger.printf("Depart homologation !\n\r");
     homologation();
     /*drapeau = 0;
@@ -68,6 +69,13 @@
     m.addObs(obsCarr (1500, 750, 220, 220));
     m.addObs(obsCarr (1500, 1250, 220, 220));
 
+=======
+    init();    
+    
+    int cote = MAP_RIGHTSIDE;
+    /*map m(&odo);
+    m.Build(cote);
+>>>>>>> other
     m.Execute(1000,1000);
     m.Execute(1500,1000);
     m.Execute(1500,1500);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp.orig	Wed May 04 16:21:48 2016 +0000
@@ -0,0 +1,113 @@
+#include "func.h"
+#include "map.h"
+
+/* Déclaration des différents éléments de l'IHM */
+
+DigitalIn CAMP(PA_15);
+DigitalIn START(PB_7);
+DigitalOut LEDR(PC_2);
+DigitalOut LEDV(PC_3);
+
+BusOut drapeau(PC_8, PC_6, PC_5);
+
+InterruptIn mybutton(USER_BUTTON);
+DigitalIn button(USER_BUTTON);
+
+DigitalIn ChannelA1(PA_1);
+DigitalIn ChannelB1(PA_0);
+DigitalIn ChannelA2(PA_5);
+DigitalIn ChannelB2(PA_6);
+
+DigitalOut bleu(PC_5);
+DigitalOut blanc(PC_6);
+DigitalOut rouge(PC_8);
+
+//AX12 left_hand(PA_9, PA_10, 4, 250000);
+//AX12 right_hand(PA_9, PA_10, 1, 250000);
+
+/* Sharp */
+AnalogIn capt1(PA_4);
+AnalogIn capt2(PB_0);
+AnalogIn capt3(PC_1);
+AnalogIn capt4(PC_0);
+
+/* Moteurs pas à pas */
+Stepper RMot(NC, PA_8, PC_7, 4);
+Stepper ZMot(NC, PB_4, PB_10, 5);
+Stepper LMot(NC, PB_5, PB_3, 4);
+/* Fins de course */
+InterruptIn EndR(PB_15);
+InterruptIn EndZ(PB_14);
+InterruptIn EndL(PB_13);
+DigitalIn EnR(PB_15);
+DigitalIn EnZ(PB_14);
+DigitalIn EnL(PB_13);
+
+Ticker ticker;
+//Serial logger(USBTX, USBRX);
+Serial logger(PA_2, PA_3);
+RoboClaw roboclaw(ADR, 460800, PA_11, PA_12);
+Odometry odo(61.7, 61.8, ENTRAXE, 4096, roboclaw);
+
+int SIMON_i = 0, SIMON_state = 0, SCouleur = VERT, SStart = 0, SSchema = 1;
+bool SIMON_EL = false, SIMON_EZ = false, SIMON_ER = false, SGauche = false, SDevant = false, SDroite = false;
+
+void init(void);
+void update_main(void);
+
+/* Debut du programme */
+int main(void)
+{
+    logger.printf("Depart homologation !\n\r");
+    homologation();
+    /*drapeau = 0;
+    init();
+
+    map m(&odo);
+    m.addObs(obsCarr (1250, 1000, 220, 220));
+    m.addObs(obsCarr (1500, 750, 220, 220));
+    m.addObs(obsCarr (1500, 1250, 220, 220));
+
+    m.Execute(1000,1000);
+    m.Execute(1500,1000);
+    m.Execute(1500,1500);
+    m.Execute(110,1000);
+
+    odo.GotoThet(0);
+    roboclaw.ForwardM1(0);
+    roboclaw.ForwardM2(0);
+    logger.printf ("Chemin Fini !");
+
+    while(1);*/
+}
+
+void init(void)
+{
+    logger.baud(9600);
+    logger.printf("Hello from main !\n\r");
+
+    init_interrupt();
+    goHome();
+
+    SCouleur = VERT;
+    LEDV = 1;
+    LEDR = 0;
+
+    odo.setPos(110, 1000, 0);
+    roboclaw.ResetEnc();
+    roboclaw.ForwardM1(0);
+    roboclaw.ForwardM2(0);
+    wait_ms(500);
+    while(1);
+    //depart();
+    init_interrupt();
+    wait_ms(100);
+    while(START==0);
+    logger.printf("End init\n\r");
+}
+
+void update_main(void)
+{
+    odo.update_odo();
+    checkAround();
+}
\ No newline at end of file