-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTestTeleOp.java
More file actions
59 lines (58 loc) · 2.33 KB
/
Copy pathTestTeleOp.java
File metadata and controls
59 lines (58 loc) · 2.33 KB
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
package org.firstinspires.ftc.teamcode;
import com.qualcomm.robotcore.eventloop.opmode.TeleOp;
// Created for 16887.
@TeleOp(name="Test TeleOp", group="_Other")
//@Disabled
public class TestTeleOp extends BaseRobot {
@Override
public void init() {
super.init();
}
@Override
public void start() {
super.start();
DEBUG = true;
}
@Override
public void loop() {
if (gamepad1.left_bumper) { // Using the power adjustment factors to balance the motors
if (gamepad1.x) leftBack.setPower(ConstantVariables.K_LB_ADJUST);
else leftBack.setPower(0);
if (gamepad1.y) rightBack.setPower(ConstantVariables.K_RB_ADJUST);
else rightBack.setPower(0);
if (gamepad1.a) leftFront.setPower(ConstantVariables.K_LF_ADJUST);
else leftFront.setPower(0);
if (gamepad1.b) rightFront.setPower(ConstantVariables.K_RF_ADJUST);
else rightFront.setPower(0);
} else {
if (gamepad1.x) leftBack.setPower(1);
else leftBack.setPower(0);
if (gamepad1.y) rightBack.setPower(1);
else rightBack.setPower(0);
if (gamepad1.a) leftFront.setPower(1);
else leftFront.setPower(0);
if (gamepad1.b) rightFront.setPower(1);
else rightFront.setPower(0);
}
// lift motor
if (gamepad1.left_bumper)
set_lift1_target_pos((int)(-ConstantVariables.K_LIFT_ONE_REV * ConstantVariables.K_LIFT_NUM_REV_PER_STEP));
else if (gamepad1.right_bumper)
set_lift1_target_pos((int)(ConstantVariables.K_LIFT_ONE_REV * ConstantVariables.K_LIFT_NUM_REV_PER_STEP));
else
lift1.setPower(0);
/*if (gamepad1.left_bumper)
lift1.setPower(-1.0);
else if (gamepad1.right_bumper)
lift1.setPower(1.0);
else
lift1.setPower(0.0);
*/
//open servo (UP)
if (gamepad1.a) open_servos(); //find double through trial and error; set in constant variables
//close servo (DOWN)
if (gamepad1.b) close_servos(); //find double through trial and error; set in constant variables
if (gamepad1.left_stick_button) DEBUG = !DEBUG; // Toggle the debug flag
super.loop();
}
}