Biblioteca PTC3471 - Algoritmo de Trava - V1.0

Dependents:   Template_PTC3471_Geral LQR_With_Integrator_Implicito LQR_No_Integrator_Implicito Template_PTC3471_Geral_2020_V2 ... more

Fork of PTC3471 by Arthur Oliveira

Revision:
10:c26257e7778a
Parent:
9:3e57f111bace
--- a/PTC3471.cpp	Thu Aug 09 19:45:20 2018 +0000
+++ b/PTC3471.cpp	Thu Aug 16 13:39:52 2018 +0000
@@ -30,26 +30,26 @@
     Ctrl_LerAngulos();
     
     if(Ctrl_dPhi>=0.01){
-        Ctrl_Motor = min(2*Ctrl_dPhi, 0.3);
+        Ctrl_Motor = min(5*Ctrl_dPhi, 1);
+        Ctrl_Direita = 0;
+        Ctrl_Esquerda = 1;
+    }
+    else if(Ctrl_dPhi<=-0.01){
+        Ctrl_Motor = min(-5*Ctrl_dPhi, 1);
         Ctrl_Direita = 1;
         Ctrl_Esquerda = 0;
     }
-    else if(Ctrl_dPhi<=-0.01){
-        Ctrl_Motor = min(-2*Ctrl_dPhi, 0.3);
-        Ctrl_Direita = 0;
-        Ctrl_Esquerda = 1;
-    }
     else{
         Ctrl_Direita=1;
         Ctrl_Esquerda=1;
     }
     
-    if(Ctrl_Status==0){
+    /*if(Ctrl_Status==0){
         Ctrl_Status = 1;
     }
     else{
         Ctrl_Status = 0;
-    }
+    }*/
 }
 
 void Ctrl_ChecarTrava(void){
@@ -58,7 +58,8 @@
         Ctrl_StatusOk.detach();
         Ctrl_Trava.detach();
         Controler_Interrupt->detach();
-        Ctrl_Trava.attach(&Ctrl_Travar, Ctrl_Ts);
+        Ctrl_StatusOk.attach(&Ctrl_BlinkOk, 0.1);
+        Ctrl_Trava.attach(&Ctrl_Travar, Ctrl_Ts/10);
     }
 }