#include <main.h>\r
+ #include <zephyr.c>\r
\r
-/*#define TARGET_SPEED 65\r
-\r
-static unsigned int time;\r
-\r
-void autoDelay(unsigned int ms){\r
- delay(ms);\r
- time-=ms;\r
-}*/\r
+#define TARGET_RPM 1700\r
\r
void autonomous(){\r
- /*static char speed = 0;\r
+ /*static double cl,cr,ca;\r
+ static char speed;\r
\r
- time = 15000;\r
+ speed = 30;\r
\r
do{\r
-\r
- speed+=10;\r
-\r
- motorSet(CANNON1,speed);\r
- motorSet(CANNON2,speed);\r
- motorSet(CANNON3,speed);\r
- motorSet(CANNON4,speed);\r
-\r
- autoDelay(200);\r
-\r
- }while(speed<TARGET_SPEED);\r
-\r
- autoDelay(800);\r
-\r
- motorSet(LIFT1 ,127);\r
- motorSet(LIFT2 ,127);\r
- motorSet(INTAKE,127);\r
-\r
- //while(1);\r
- delay(time);\r
+ speed += 10;\r
+ zMotorSet("Left cannon",-speed);\r
+ zMotorSet("Right cannon",speed);\r
+ delay(800);\r
+ cl = zMotorIMEGetVelocity("Left cannon") / 16.3333125L * 9;\r
+ cr = -zMotorIMEGetVelocity("Right cannon") / 16.3333125L * 9;\r
+ ca = (cl + cr) / 2;\r
+ }while(ca < TARGET_RPM);\r
+\r
+ zMotorSet("Misc",127);\r
+ delay(900);\r
+ zMotorSet("Misc",-127);\r
+ delay(900);\r
+ zMotorSet("Misc",0);\r
\r
motorStopAll();*/\r
-\r
}\r