-
Notifications
You must be signed in to change notification settings - Fork 0
/
BACKUP.txt
156 lines (133 loc) · 3.78 KB
/
BACKUP.txt
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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
SKAR 1 -> big bot
/* void auton_left_side()
{
int DIST = 30; // mm distance
drive_rt->moveVoltage(12000);
drive_lft->moveVoltage(12000);
int move_time = 0;
drive_lft->setBrakeMode(okapi::AbstractMotor::brakeMode::brake);
drive_rt->setBrakeMode(okapi::AbstractMotor::brakeMode::brake);
int MAX_TIME = 1400; // seconds want to stop running no matter what (FOR AUTON LINE)
while ((dist_sensor->get() > DIST || dist_sensor->get() == 0) && move_time < MAX_TIME)
{
if (dist_sensor->get() < 400 && dist_sensor->get() != 0)
{
drive_rt->moveVoltage(6000);
drive_lft->moveVoltage(6000);
MAX_TIME = MAX_TIME + 3;
}
pros::delay(5);
move_time += 5;
}
drive_rt->moveVoltage(0);
drive_lft->moveVoltage(0);
piston->set_value(true);
pros::delay(150);
chassis->moveDistance(-2.75_ft);
pros::delay(400);
// Lift the Front Lift with the Yellow
front_lift_control->setTarget(FRONT_LIFT_UP);
pros::delay(400);
// Turn to the blue
chassis->turnAngle(-70_deg);
pros::delay(500);
// Move back for the back lift space
front_lift_control->setTarget(FRONT_LIFT_UP);
pros::delay(100);
chassis->setMaxVelocity(90);
chassis->moveDistanceAsync(0.9_ft);
pros::delay(800);
chassis->stop();
// Bring the Back Lift Down
back_lift_control->setTarget(BACK_LIFT_DOWN);
pros::delay(1000);
// Move the chassis towards the blue
if (selector::auton < 0)
{
turn_to_goal(camera, drive_rt, drive_lft, BLUE);
}
chassis->moveDistanceAsync(-1_ft);
pros::delay(1000);
chassis->stop();
// Lift the blue up
back_lift_control->setTarget(BACK_LIFT_UP);
chassis->setMaxVelocity(90);
pros::delay(300);
// Move back to get rings
chassis->moveDistance(0.2_ft);
// Turn around to put rings inside
chassis->turnAngle(60_deg);
pros::delay(200);
// Move toward yellow again
chassis->moveDistance(0.2_ft);
// piston->set_value(true);
// Turn around to put rings
pros::delay(100);
chassis->turnAngle(140_deg);
// Start moving intake
intake->moveVelocity(100);
// Storing rings time
while (true)
{
chassis->moveDistance(-0.6_ft);
chassis->moveDistance(0.6_ft);
}
}
void auton_right_side()
{
// Move to the Yellow
int DIST = 30; // mm distance
drive_rt->moveVoltage(12000);
drive_lft->moveVoltage(12000);
int move_time = 0;
drive_lft->setBrakeMode(okapi::AbstractMotor::brakeMode::brake);
drive_rt->setBrakeMode(okapi::AbstractMotor::brakeMode::brake);
int MAX_TIME = 1400; // seconds want to stop running no matter what (FOR AUTON LINE)
while ((dist_sensor->get() > DIST || dist_sensor->get() == 0) && move_time < MAX_TIME)
{
if (dist_sensor->get() < 400 && dist_sensor->get() != 0)
{
drive_rt->moveVoltage(6000);
drive_lft->moveVoltage(6000);
MAX_TIME = MAX_TIME + 3;
}
pros::delay(5);
move_time += 5;
}
drive_rt->moveVoltage(0);
drive_lft->moveVoltage(0);
piston->set_value(true);
pros::delay(150);
chassis->moveDistance(-1.30_ft);
pros::delay(400);
// Turn to the red or blue
chassis->turnAngle(-65_deg);
pros::delay(200);
chassis->moveDistance(0.5_ft);
if (selector::auton < 0)
{
turn_to_goal(camera, drive_rt, drive_lft, BLUE);
}
// turn_to_goal(camera, drive_rt, drive_lft, BLUE);
// Put the Back Lift Down
back_lift_control->setTarget(BACK_LIFT_DOWN);
pros::delay(1500);
// Go toward the Blue or Red neutral goal
chassis->moveDistance(-1.2_ft);
pros::delay(1000);
// Lift the back lift up
back_lift_control->setTarget(BACK_LIFT_UP);
pros::delay(1500);
// Move back
chassis->moveDistance(1_ft);
chassis->waitUntilSettled();
chassis->turnAngle(-140_deg);
chassis->waitUntilSettled();
lift_back_control->setTarget(-3.0/8.0*LIFT_GEAR_RATIO);
lift_back_control->waitUntilSettled();
chassis->moveDistance(-3_ft);
chassis->waitUntilSettled();
lift_back_control->setTarget(-(2/8.0)*LIFT_GEAR_RATIO);
chassis->moveDistance(3_ft);
intake->moveVoltage(12000);
} */