diff options
author | Clyne Sullivan <tullivan99@gmail.com> | 2015-12-15 16:28:26 -0500 |
---|---|---|
committer | Clyne Sullivan <tullivan99@gmail.com> | 2015-12-15 16:28:26 -0500 |
commit | 5d3e755cc37dea817b08e88f4697275b927c56b8 (patch) | |
tree | 9197d1651ccad052ff477206ed28e9db0519fc03 /src/auto.c | |
parent | 0fb3c40c38905790f47cbd77f7e26553bb0061fa (diff) |
autonomizing robot
Diffstat (limited to 'src/auto.c')
-rw-r--r-- | src/auto.c | 49 |
1 files changed, 18 insertions, 31 deletions
@@ -1,41 +1,28 @@ #include <main.h>
-/*#define TARGET_SPEED 65
-
-static unsigned int time;
-
-void autoDelay(unsigned int ms){
- delay(ms);
- time-=ms;
-}*/
+#define TARGET_RPM 1700
void autonomous(){
- /*static char speed = 0;
+ /*static double cl,cr,ca;
+ static char speed;
- time = 15000;
+ speed = 30;
do{
-
- speed+=10;
-
- motorSet(CANNON1,speed);
- motorSet(CANNON2,speed);
- motorSet(CANNON3,speed);
- motorSet(CANNON4,speed);
-
- autoDelay(200);
-
- }while(speed<TARGET_SPEED);
-
- autoDelay(800);
-
- motorSet(LIFT1 ,127);
- motorSet(LIFT2 ,127);
- motorSet(INTAKE,127);
-
- //while(1);
- delay(time);
+ speed += 10;
+ zMotorSet("Left cannon",-speed);
+ zMotorSet("Right cannon",speed);
+ delay(800);
+ cl = zMotorIMEGetVelocity("Left cannon") / 16.3333125L * 9;
+ cr = -zMotorIMEGetVelocity("Right cannon") / 16.3333125L * 9;
+ ca = (cl + cr) / 2;
+ }while(ca < TARGET_RPM);
+
+ zMotorSet("Misc",127);
+ delay(900);
+ zMotorSet("Misc",-127);
+ delay(900);
+ zMotorSet("Misc",0);
motorStopAll();*/
-
}
|