Romain Ame
/
Timer71pt
Fork de Timer après le match à 61 points
Fork of Timer by
deplacement.cpp
- Committer:
- IceTeam
- Date:
- 2016-05-06
- Revision:
- 88:e4de39dd3e2e
- Parent:
- 86:0c5e9ac3d8d8
- Child:
- 89:46730de0d013
File content as of revision 88:e4de39dd3e2e:
#include "entete.h" void GotoDist(float timer) { Timer t; roboclaw.SpeedAccelM1(accel_dista, vitesse_dista); roboclaw.SpeedAccelM2(accel_dista, vitesse_dista); t.reset(); t.start(); while (t.read() < timer) { if (Ravance != 1) { roboclaw.ForwardM1(0); roboclaw.ForwardM2(0); t.stop(); while (Ravance != 1); roboclaw.SpeedAccelM1(accel_dista, vitesse_dista); roboclaw.SpeedAccelM2(accel_dista, vitesse_dista); t.start(); } } roboclaw.ForwardM1(0); roboclaw.ForwardM2(0); t.stop(); t.reset(); 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); t.reset(); t.start(); while (t.read() < timer) { if (Ravance != 1) { roboclaw.ForwardM1(0); roboclaw.ForwardM2(0); t.stop(); while (Ravance != 1); roboclaw.SpeedAccelM1(accel_dista, vitesse_dista); roboclaw.SpeedAccelM2(accel_dista, vitesse_dista); t.start(); } } roboclaw.ForwardM1(0); roboclaw.ForwardM2(0); t.stop(); t.reset(); wait(waiting_time); }