forked from FIRST-Tech-Challenge/FtcRobotController
-
Notifications
You must be signed in to change notification settings - Fork 0
/
OneConeParkAuto.java
92 lines (72 loc) · 2.63 KB
/
OneConeParkAuto.java
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
package org.firstinspires.ftc.teamcode;
import com.qualcomm.robotcore.eventloop.opmode.Autonomous;
import com.qualcomm.robotcore.eventloop.opmode.LinearOpMode;
import org.firstinspires.ftc.teamcode.subsystems.Drivetrain;
import org.firstinspires.ftc.teamcode.subsystems.Intake;
import org.firstinspires.ftc.teamcode.subsystems.Vision;
@Autonomous(name = "One Cone Right Side Park Auto 25pts or something but probably won't work", group = "comp", preselectTeleOp="Tele-Op 2 drivers")
public class OneConeParkAuto extends LinearOpMode {
private Drivetrain drivetrain;
private Intake intake;
private Vision vision;
private int zone = -1;
@Override
public void runOpMode() throws InterruptedException {
// initialize all the subsystems of the robot
drivetrain = new Drivetrain(telemetry, hardwareMap);
intake = new Intake(telemetry, hardwareMap);
vision = new Vision(telemetry, hardwareMap);
drivetrain.init();
intake.init();
vision.init();
// wait for the robot to start
waitForStart();
// pipeline is tailored to see the cone from where the robot starts
zone = vision.getConeZone();
// just drive forwards for a second for now
drivetrain.driveAuto(-.5, 0, 0);
sleep(1300);
drivetrain.driveAuto(0, 0, 0);
sleep(300);
// strafe right
drivetrain.driveAuto(0, .4, 0);
sleep(1100);
drivetrain.driveAuto(0, 0, 0);
sleep(300);
// raise the intake
intake.raise();
sleep(1700);
intake.freeze();
intake.freeze();
sleep(300);
// drive forward a little
drivetrain.driveAuto(-0.4, 0, 0);
sleep(250);
drivetrain.driveAuto(0, 0, 0);
sleep(100);
// lower slide
intake.lower();
sleep(500);
intake.freeze();
sleep(400);
// spit it out and drive backwards
intake.setIntake(1);
sleep(500);
drivetrain.driveAuto(0.4, 0, 0);
sleep(400);
drivetrain.driveAuto(0, 0, 0);
sleep(300);
if (zone == 1) { // the left zone
drivetrain.driveAuto(0, -.5, 0); // strafe left
sleep(2500); // wait a second
} else if (zone == 2) { // the middle, drive forwards
drivetrain.driveAuto(0, -0.3, 0); // the right zone, strafe right
sleep(400);
} else if (zone == 3) {
drivetrain.driveAuto(0, .3, 0); // the right zone, strafe right
sleep(400);
}
drivetrain.driveAuto(0, 0, 0); // stop the motors
// and that's a wrap
}
}