-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathETTeleopFourWheel.java
More file actions
63 lines (43 loc) · 1.96 KB
/
ETTeleopFourWheel.java
File metadata and controls
63 lines (43 loc) · 1.96 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
60
61
62
63
package org.firstinspires.ftc.teamcode.etrobot;
import com.qualcomm.robotcore.eventloop.opmode.TeleOp;
import com.qualcomm.robotcore.util.Range;
import org.firstinspires.ftc.robotcontroller.external.samples.HardwarePushbot;
import org.firstinspires.ftc.robotcontroller.external.samples.PushbotTeleopTank_Iterative;
/**
* Created by megan on 10/25/2016.
*/
@TeleOp(name="Robot: Teleop ET", group="ET Robot")
public class ETTeleopFourWheel extends PushbotTeleopTank_Iterative {
SNRobotHardware robot = new SNRobotHardware(); // use the class created to define a Pushbot's hardware
boolean isArmMotorRunning = false;
@Override
public void init() {
/* Initialize the hardware variables.
* The init() method of the hardware class does all the work here
*/
robot.init(hardwareMap);
// Send telemetry message to signify robot waiting;
telemetry.addData("Say", "Hello ET Driver"); //
}
@Override
public void loop() {
double leftFront;
double rightFront;
double forwardArm;
// Run wheels in tank mode (note: The joystick goes negative when pushed forwards, so negate it)
leftFront = -gamepad1.left_stick_y;
rightFront = -gamepad1.right_stick_y;
robot.leftFrontMotor.setPower(leftFront);
robot.rightFrontMotor.setPower(-rightFront);
forwardArm = -gamepad2.left_stick_y;
robot.armMotor.setPower(forwardArm);
//detect if B button is pressed
//find out previous state of armMotor (at rest or running)
//toggle armMotor (if at rest, run; if running, stop)
//adjust power of 2.0 as needed
if (gamepad2.a) robot.armMotor.setPower(0);
// Send telemetry message to signify robot running;
telemetry.addData("left_front", "%.2f", leftFront);
telemetry.addData("right_front", "%.2f", rightFront);
}
}