TRR2018 omar

Dependencies:   mbed

Fork of biniou by TRR 2018

Revision:
19:771bf61be276
Parent:
18:38504337d2fc
Child:
21:de7a0a47f8a3
diff -r 38504337d2fc -r 771bf61be276 stateMachines.h
--- a/stateMachines.h	Wed Sep 12 22:37:07 2018 +0000
+++ b/stateMachines.h	Thu Sep 13 23:07:15 2018 +0000
@@ -1,31 +1,57 @@
 #include "mbed.h"
 #include <stdint.h>
 
-//#define DEBUG 3
+//#define DLVV
+#define SAMPLING//commenter pour désactiver
+#define DEBUG -1//-1 pour avoir uniquement la gestion de l'interruption bouton
 
-#define DIERCTION_PERIOD 10000
+#define DIERCTION_PERIOD_MS 10000
 #define DIRECTION_PULSE_MAX 2100
 #define DIRECTION_PULSE_MIN 800
 #define DIRECTION_PULSE_MIDDLE 1500
 
-#define SPEED_PERIOD 20000
-#define BRAKING_PWM 1350
-#define MAX_PULSE_WIDTH_FOR_TACHY 1700
-#define INITAL_PULSE_SPEED 1590
+#define SPEED_PERIOD_US 20000
+#define BRAKING_PULSE_US 1350
+#define MAX_PULSE_WIDTH_FOR_TACHY_US 1850
+#define INITAL_PULSE_SPEED_US 1590
+#define ZERO_PULSE_SPEED_US 1500
 
 #define NB_ECHANTILLONS_IR 4
 #define NB_ECHANTILLONS_LIDAR 4
 
-#define LIDAR_STRENGTH_THRESOLD 200 //pour la gestion de la vitesse MAX (MAXSpeed_ST)
-#define LIDAR_STRENGH_DELTA 50
+#define LIDAR_STRENGTH_THRESOLD 350 //pour la gestion de la vitesse MAX (MAXSpeed_ST)
+#define LIDAR_STRENGH_DELTA 20
 
 #define IR_DEADZONE_U16_22cm 49677
 #define IR_FAR_U16_105cm 11915
 
 #define SPEED_DELTA_CMPS 30
 
-//#define DLVV
+#ifdef SAMPLING
+#define TAILLE_SAMPLES 1200
+typedef struct states
+{
+    char murs_dlvv;
+    char section;
+    char maxSpeed;
+    char throttle;
+    }s_States;
 
+typedef struct sample 
+{
+    s_States states;
+    uint16_t time;
+    uint16_t cg45;
+    uint16_t cd45;
+    uint16_t cg90;
+    uint16_t cd90;
+    uint16_t lidarDist;
+    uint16_t lidarStr;
+    uint16_t speed;
+    uint16_t dist;
+} s_Sample;
+
+#endif
 
 typedef enum{
     ATTRACTIF_G,
@@ -56,7 +82,8 @@
     UNDER_SPEED,
     OVER_SPEED,
     AT_SPEED,
-    BRAKING
+    BRAKING,
+    STOPPED
 }THROTTLE_ST;
 
 
@@ -64,8 +91,7 @@
    int targetSpeed_cmps;
    int slowSpeed_cmps;//pour effectuer les virages... pour ne pas avoir d'a coups entre la vitesse variable et la vitesse limitée: brakingCoefficient = 30*((targetSpeed_cmps/slowSpeed_cmps)-1)
    int brakingCoefficient;
-   int us_accel;
-   int us_decel;
+   int coef_p_accel;
    int lidarWarningDist_cm;
    int lng_section_cm;
    int coef_p;