ARES
/
Timer
Time is good
Fork of Robot2016_2-0 by
Diff: deplacement.cpp
- Revision:
- 93:c0b040954eac
- Parent:
- 90:78d2c1527c95
- Child:
- 94:86b9bd6d5c28
--- a/deplacement.cpp Fri May 06 15:25:21 2016 +0000 +++ b/deplacement.cpp Fri May 06 17:33:43 2016 +0000 @@ -13,8 +13,10 @@ if (Ravance != 1) { roboclaw.ForwardM1(0); roboclaw.ForwardM2(0); + wait_ms(1); t.stop(); while (Ravance != 1); + wait_ms(1); roboclaw.SpeedAccelM1(accel_dista, vitesse_dista); roboclaw.SpeedAccelM2(accel_dista, vitesse_dista); t.start(); @@ -30,55 +32,12 @@ wait(waiting_time); } -void GotoThet (float timer, int signe) { - Timer t; - - if (signe == GAUCHE) { - //roboclaw.SpeedAccelM1(accel_angle, vitesse_angle); - //roboclaw.SpeedAccelM2(accel_angle, -vitesse_angle); - roboclaw.SpeedM1(vitesse_angle); - roboclaw.SpeedM2(-vitesse_angle); - } - if (signe == DROITE) { - roboclaw.SpeedAccelM1(accel_angle, -vitesse_angle); - roboclaw.SpeedAccelM2(accel_angle, vitesse_angle); - } - - t.reset(); - t.start(); - - while (t.read() < timer) { - if (Ravance != 1) { - roboclaw.ForwardM1(0); - roboclaw.ForwardM2(0); - t.stop(); - while (Ravance != 1); - t.start(); - } - if (signe < 0) { - roboclaw.SpeedAccelM1(accel_dista, vitesse_dista); - roboclaw.SpeedAccelM2(-accel_dista, -vitesse_dista); - } - else { - roboclaw.SpeedAccelM1(-accel_dista, -vitesse_dista); - roboclaw.SpeedAccelM2(accel_dista, vitesse_dista); - } - } - - roboclaw.ForwardM1(0); - roboclaw.ForwardM2(0); - - t.stop(); - t.reset(); - - wait(waiting_time); -} - void GotoArr(float timer) { Timer t; roboclaw.SpeedAccelM1(accel_dista, -vitesse_dista); roboclaw.SpeedAccelM2(accel_dista, -vitesse_dista); + wait_ms(1); t.reset(); t.start(); @@ -86,16 +45,19 @@ while (t.read() < timer) { if (Ravance != 1) { roboclaw.ForwardM1(0); + wait_ms(1); roboclaw.ForwardM2(0); t.stop(); while (Ravance != 1); - roboclaw.SpeedAccelM1(accel_dista, vitesse_dista); - roboclaw.SpeedAccelM2(accel_dista, vitesse_dista); + wait_ms(1); + roboclaw.SpeedAccelM1(accel_dista, -vitesse_dista); + roboclaw.SpeedAccelM2(accel_dista, -vitesse_dista); t.start(); } } roboclaw.ForwardM1(0); + wait_ms(1); roboclaw.ForwardM2(0); t.stop();