-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTFautoRight.java
87 lines (76 loc) · 2.6 KB
/
TFautoRight.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
package org.firstinspires.ftc.teamcode;
import com.acmerobotics.dashboard.FtcDashboard;
import com.acmerobotics.dashboard.telemetry.TelemetryPacket;
import com.qualcomm.robotcore.eventloop.opmode.Autonomous;
import com.qualcomm.robotcore.eventloop.opmode.LinearOpMode;
import com.qualcomm.robotcore.hardware.DcMotor;
import org.firstinspires.ftc.robotcore.external.ClassFactory;
import org.firstinspires.ftc.robotcore.external.navigation.VuforiaLocalizer;
import org.firstinspires.ftc.robotcore.external.navigation.VuforiaLocalizer.CameraDirection;
import org.firstinspires.ftc.robotcore.external.tfod.Recognition;
import org.firstinspires.ftc.robotcore.external.tfod.TFObjectDetector;
import java.util.List;
@Autonomous(name = "TF Depot", group = "Concept")
public class TFautoRight extends TFauto {
public void runOpMode() {
super.runOpMode();
// Lower and let go
robot.mark.setPosition(0.7);
robot.lift.setTargetPosition(robot.lift.getCurrentPosition() - 18500);
robot.lift.setPower(1);
while(robot.lift.isBusy()) {
opModeIsActive();
}
robot.latch.setPower(-1);
pause(2500);
robot.latch.setPower(0);
double speed = 0.8;
double sidedist = 25;
long pausetime = 300;
driveBackward(speed, 1);
turnAbs(0);
driveBackward(speed, 4);
//sample
switch(goldPosition) {
case "middle":
driveBackward(speed, 40);
pause(pausetime);
break;
case "left":
pause(pausetime);
turnAbs(45);
driveBackward(speed, sidedist);
turnAbs(-35);
driveBackward(speed, sidedist);
break;
case "right":
pause(pausetime);
turnAbs(-45);
driveBackward(speed, sidedist);
turnAbs(35);
driveBackward(speed, sidedist);
break;
}
//claim
turnAbs(-135);
robot.mark.setPosition(0.0);
pause(1000);
//drive after
switch(goldPosition) {
case "middle":
driveForward(speed, 10);
break;
case "left":
break;
case "right":
driveForward(speed, 10);
break;
}
turnAbs(-135);
driveLeft(speed, 65);
turnAbs(-135);
robot.intakearm.setTargetPosition(-800);
robot.intakearm.setPower(0.4);
while(robot.intakearm.isBusy() && opModeIsActive()) {}
}
}