-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathskills.c
89 lines (71 loc) · 2.38 KB
/
skills.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
#ifndef SKILLS_C_INCLUDED
#define SKILLS_C_INCLUDED
void runSkills()
{
startTask(readBuffer);
wait1Msec(250);
//PRELOAD AND STARS------------------------------------
//Close claw and drive back
intakeAndLiftTask_intakeState = INTAKE_REST; //Let the intake chill
intakeAndLiftTask_liftState = LIFT_DOWN; //Put the lift down
startTask(intakeAndLiftTask);
//Drive back a tile and open the intake
moveToPoint(609, 304 + ONE_TILE_MM*1.1, true);
intakeAndLiftTask_intakeState = INTAKE_OPEN; //Open the intake
waitForIntake(INTAKE_OPEN);
//Wait for match loads
wait1Msec(1000);
//Close the intake
intakeAndLiftTask_intakeState = INTAKE_CLOSED;
wait1Msec(500);
//Drive back and lift to hold stars
intakeAndLiftTask_liftState = LIFT_UP;
wait1Msec(250);
//moveToPoint(609, 304 + ONE_TILE_MM*1.2, true);
writeDebugStreamLine("pre dump");
//Dump
dumpIntake();
writeDebugStreamLine("post dump");
//Turn to score star
waitForLift(LIFT_DOWN);
turnToAbsAngle(180);
intakeAndLiftTask_intakeState = INTAKE_POPEN;
writeDebugStreamLine("star");
//CUBE MATCH LOADS------------------------
//First cube
//Drive back to wall at an offset
moveToPoint(609 - ONE_TILE_MM/4, 304 + ONE_TILE_MM *0.7);
turnToAbsAngle(-90);
//Grab first cube and star
intakeAndLiftTask_intakeState = INTAKE_CLOSED;
wait1Msec(300);
driveStraight(-700); //Move intake out of way of wall
intakeAndLiftTask_intakeState = INTAKE_OPEN;
driveStraight(600);
intakeAndLiftTask_intakeState = INTAKE_CLOSED;
wait1Msec(600);
driveStraight(-150);
//Drive back to fence
//driveStraight(-ONE_TILE_MM*0.5);
//Dump
dumpIntake();
//Second cube
//Drive back to wall
moveToPoint(609 - ONE_TILE_MM/4, 304 + ONE_TILE_MM*1.2);
//Grab second cube
intakeAndLiftTask_intakeState = INTAKE_CLOSED;
wait1Msec(500);
//Drive back to fence
moveToPoint(609 - ONE_TILE_MM/4, 304 + ONE_TILE_MM*1.1, true);
//Dump
dumpIntake();
//CENTER CUBE------------------------------------
moveToPoint(609 - ONE_TILE_MM/4, 304 + ONE_TILE_MM);
moveToPoint(609 + 0.9* ONE_TILE_MM,304 + ONE_TILE_MM);
intakeAndLiftTask_intakeState = INTAKE_CLOSED;
wait1Msec(250);
intakeAndLiftTask_liftState = LIFT_HALF;
moveToPoint(609 + 3.25* ONE_TILE_MM,304 + ONE_TILE_MM);
dumpIntake();
}
#endif //SKILLS_C_INCLUDED