code petit robot pour homologation

Fork of CRAC-Strat_2017_V2 by CRAC Team

Revision:
19:b4b91258c275
Parent:
18:cc5fec34ed9c
diff -r cc5fec34ed9c -r b4b91258c275 peripheriques/actionneurs.cpp
--- a/peripheriques/actionneurs.cpp	Mon May 22 15:01:49 2017 +0000
+++ b/peripheriques/actionneurs.cpp	Tue May 23 13:10:05 2017 +0000
@@ -186,7 +186,6 @@
             GoalPosPinceG=1090;
             GoalPosPinceD=1930;
             mvtBrasCentralPR(AX12_DOIGT, speed, GoalPosDoigt, AX12_BASE, speed, GoalPosBase, AX12_COUDE, speed, GoalPosCoude, AX12_PINCEG, speed, GoalPosPinceG, AX12_PINCED, speed, GoalPosPinceD);   
-               
             break;
             
         case AX12_PINCE_CENTRALE_PREPARATION_PRISE :
@@ -312,20 +311,17 @@
             
         case AX12_GAUCHE_CROC_OUVERT :
             wait_ms(TIME);
-            CrocBrasGauchePR->Set_Secure_Goal(200);
-               
+            CrocBrasGauchePR->Set_Secure_Goal(110);
             break;
             
         case AX12_GAUCHE_CROC_FERME :
             wait_ms(TIME);
-            CrocBrasGauchePR->Set_Secure_Goal(240);
-               
+            CrocBrasGauchePR->Set_Secure_Goal(147);
             break;     
             
         case AX12_GAUCHE_CROC_INITIALE :
             wait_ms(TIME);
-            CrocBrasGauchePR->Set_Secure_Goal(300);
-               
+            CrocBrasGauchePR->Set_Secure_Goal(232);
             break;         
             
         case AX12_TOURNANTE_GAUCHE_POSITION_INITIALE :
@@ -360,20 +356,19 @@
             
         case AX12_DROIT_CROC_OUVERT :
             wait_ms(TIME);
-            CrocBrasDroitPR->Set_Secure_Goal(106);
+            CrocBrasDroitPR->Set_Secure_Goal(189);
                
             break;
             
         case AX12_DROIT_CROC_FERME :
             wait_ms(TIME);
-            CrocBrasDroitPR->Set_Secure_Goal(55);
+            CrocBrasDroitPR->Set_Secure_Goal(149);
                
             break;    
             
         case AX12_DROIT_CROC_INITIALE :
             wait_ms(TIME);
-            CrocBrasDroitPR->Set_Secure_Goal(0);
-               
+            CrocBrasDroitPR->Set_Secure_Goal(67);
             break;     
             
         case AX12_TOURNANTE_DROIT_POSITION_INITIALE :
@@ -466,33 +461,33 @@
     BrasCentralPRAx12->multiple_goal_and_speed(5,TabBrasCentralPR) ;
     wait(TIME);
     
-    timeOut.start;
-    while (((unsigned short)(DoigtBrasCentralPR->Get_Position()*10)>GPosition1*110/100) || ((unsigned short)(DoigtBrasCentralPR->Get_Position()*10)<GPosition1*90/100) || (timeOut.read_ms() > 100)) {
+    timeOut.start();
+    while (((unsigned short)(DoigtBrasCentralPR->Get_Position()*10)>GPosition1*110/100) || ((unsigned short)(DoigtBrasCentralPR->Get_Position()*10)<GPosition1*90/100) || (timeOut.read_ms() < 100)) {
         BrasCentralPRAx12->multiple_goal_and_speed(5,TabBrasCentralPR) ;
         wait(TIME);
         
     } 
     
-    timeOut.reset;    
-    while (((unsigned short)(BaseBrasCentralPR->Get_Position()*10)>GPosition2*110/100) || ((unsigned short)(BaseBrasCentralPR->Get_Position()*10)<GPosition2*90/100)|| (timeOut.read_ms() > 100)) {
+    timeOut.reset();    
+    while (((unsigned short)(BaseBrasCentralPR->Get_Position()*10)>GPosition2*110/100) || ((unsigned short)(BaseBrasCentralPR->Get_Position()*10)<GPosition2*90/100) || (timeOut.read_ms() < 100)) {
         BrasCentralPRAx12->multiple_goal_and_speed(5,TabBrasCentralPR) ;
         wait(TIME);
     } 
     
-    timeOut.reset;
-    while (((unsigned short)(CoudeBrasCentralPR->Get_Position()*10)>GPosition3*110/100) || ((unsigned short)(CoudeBrasCentralPR->Get_Position()*10)<GPosition3*90/100)|| (timeOut.read_ms() > 100)) {
+    timeOut.reset();
+    while (((unsigned short)(CoudeBrasCentralPR->Get_Position()*10)>GPosition3*110/100) || ((unsigned short)(CoudeBrasCentralPR->Get_Position()*10)<GPosition3*90/100) || (timeOut.read_ms() < 100)) {
         BrasCentralPRAx12->multiple_goal_and_speed(5,TabBrasCentralPR) ;
         wait(TIME);
     } 
     
-    timeOut.reset;
-    while (((unsigned short)(PinceGBrasCentralPR->Get_Position()*10)>GPosition4*110/100) || ((unsigned short)(PinceGBrasCentralPR->Get_Position()*10)<GPosition4*90/100)|| (timeOut.read_ms() > 100)) {
+    timeOut.reset();
+    while (((unsigned short)(PinceGBrasCentralPR->Get_Position()*10)>GPosition4*110/100) || ((unsigned short)(PinceGBrasCentralPR->Get_Position()*10)<GPosition4*90/100) || (timeOut.read_ms() < 100)) {
         BrasCentralPRAx12->multiple_goal_and_speed(5,TabBrasCentralPR) ;
         wait(TIME);
     } 
     
-    timeOut.reset;
-    while (((unsigned short)(PinceDBrasCentralPR->Get_Position()*10)>GPosition5*110/100) || ((unsigned short)(PinceDBrasCentralPR->Get_Position()*10)<GPosition5*90/100)|| (timeOut.read_ms() > 100)) {
+    timeOut.reset();
+    while (((unsigned short)(PinceDBrasCentralPR->Get_Position()*10)>GPosition5*110/100) || ((unsigned short)(PinceDBrasCentralPR->Get_Position()*10)<GPosition5*90/100) || (timeOut.read_ms() < 100)) {
         BrasCentralPRAx12->multiple_goal_and_speed(5,TabBrasCentralPR) ;
         wait(TIME);
     }
@@ -506,6 +501,7 @@
 {
     char TabBrasGauchePR[10];
     unsigned short GPosition1_1, GPosition2_1;
+    Timer  timeOut;
       
     GPosition1_1=((unsigned long)GPosition1*341/1000);
     GPosition2_1=((unsigned long)GPosition2*341/1000);
@@ -526,15 +522,18 @@
     BrasGauchePRAx12->multiple_goal_and_speed(2,TabBrasGauchePR) ;
     wait(TIME);
     
-    while (((unsigned short)(EpauleBrasGauchePR->Get_Position()*10)>GPosition1*105/100) || ((unsigned short)(EpauleBrasGauchePR->Get_Position()*10)<GPosition1*95/100)) {
+    timeOut.start();
+    while (((unsigned short)(EpauleBrasGauchePR->Get_Position()*10)>GPosition1*110/100) || ((unsigned short)(EpauleBrasGauchePR->Get_Position()*10)<GPosition1*90/100)  || (timeOut.read_ms() < 100)) {
         BrasGauchePRAx12->multiple_goal_and_speed(2,TabBrasGauchePR) ;
-        wait(TIME*5);
+        wait(TIME);
     } 
+    timeOut.reset();
     
-    while (((unsigned short)(CoudeBrasGauchePR->Get_Position()*10)>GPosition2*105/100) || ((unsigned short)(CoudeBrasGauchePR->Get_Position()*10)<GPosition2*95/100)) {
+    while (((unsigned short)(CoudeBrasGauchePR->Get_Position()*10)>GPosition2*110/100) || ((unsigned short)(CoudeBrasGauchePR->Get_Position()*10)<GPosition2*90/100)  || (timeOut.read_ms() < 100)) {
         BrasGauchePRAx12->multiple_goal_and_speed(2,TabBrasGauchePR) ;
-        wait(TIME*5);
+        wait(TIME);
     }  
+    timeOut.reset();
 }
 
 void mvtBrasDroitPR(unsigned char ID1, unsigned short GSpeed1, unsigned short GPosition1, 
@@ -542,6 +541,7 @@
 {
     char TabBrasDroitPR[10];
     unsigned short GPosition1_1, GPosition2_1;
+    Timer  timeOut;
       
     GPosition1_1=((unsigned long)GPosition1*341/1000);
     GPosition2_1=((unsigned long)GPosition2*341/1000);
@@ -562,14 +562,17 @@
     BrasDroitPRAx12->multiple_goal_and_speed(2,TabBrasDroitPR) ;
     wait(TIME);
     
-    while (((unsigned short)(EpauleBrasDroitPR->Get_Position()*10)>GPosition1*105/100) || ((unsigned short)(EpauleBrasDroitPR->Get_Position()*10)<GPosition1*95/100)) {
+    timeOut.start();
+    while (((unsigned short)(EpauleBrasDroitPR->Get_Position()*10)>GPosition1*110/100) || ((unsigned short)(EpauleBrasDroitPR->Get_Position()*10)<GPosition1*90/100)  || (timeOut.read_ms() < 100)) {
         BrasDroitPRAx12->multiple_goal_and_speed(2,TabBrasDroitPR) ;
-        wait(TIME*5);
+        wait(TIME);
     } 
+    timeOut.reset();
     
-    while (((unsigned short)(CoudeBrasDroitPR->Get_Position()*10)>GPosition2*105/100) || ((unsigned short)(CoudeBrasDroitPR->Get_Position()*10)<GPosition2*95/100)) {
+    while (((unsigned short)(CoudeBrasDroitPR->Get_Position()*10)>GPosition2*110/100) || ((unsigned short)(CoudeBrasDroitPR->Get_Position()*10)<GPosition2*90/100)  || (timeOut.read_ms() < 100)) {
         BrasDroitPRAx12->multiple_goal_and_speed(2,TabBrasDroitPR) ;
-        wait(TIME*5);
+        wait(TIME);
     } 
+    timeOut.reset();
 }