-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRobot.java
66 lines (58 loc) · 2.42 KB
/
Robot.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
package org.firstinspires.ftc.teamcode;
import com.qualcomm.robotcore.hardware.DcMotor;
import com.qualcomm.robotcore.hardware.HardwareMap;
import com.qualcomm.robotcore.hardware.Servo;
import com.qualcomm.robotcore.util.ElapsedTime;
/**
* This is NOT an opmode.
* <p>
* This class can be used to define all the specific hardware for a single robot.
* In this case that robot is a Pushbot.
* See PushbotTeleopTank_Iterative and others classes starting with "Pushbot" for usage examples.
* <p>
* This hardware class assumes the following device names have been configured on the robot:
* Note: All names are lower case and some have single spaces between words.
* <p>
* Motor channel: Left drive motor: "left_drive"
* Motor channel: Right drive motor: "right_drive"
* Motor channel: Manipulator drive motor: "left_arm"
* Servo channel: Servo to open left claw: "left_hand"
* Servo channel: Servo to open right claw: "right_hand"
*/
public class Robot {
/* Public OpMode members. */
public DcMotor frontLeft = null;
public DcMotor backLeft = null;
public DcMotor frontRight = null;
public DcMotor backRight = null;
public DcMotor lift = null;
public Servo clawLeft = null;
public Servo clawRight = null;
public Servo flipper = null;
/* local OpMode members. */
HardwareMap hwMap = null;
private ElapsedTime period = new ElapsedTime();
/* Constructor */
public Robot() {
}
/* Initialize standard Hardware interfaces */
public void init(HardwareMap ahwMap) {
// Save reference to Hardware map
hwMap = ahwMap;
// Define and Initialize Motors
frontLeft = hwMap.get(DcMotor.class, "frontLeft");
backLeft = hwMap.get(DcMotor.class, "backLeft");
frontRight = hwMap.get(DcMotor.class, "frontRight");
backRight = hwMap.get(DcMotor.class, "backRight");
lift = hwMap.get(DcMotor.class, "lift");
flipper = hwMap.get(Servo.class, "flipper");
clawRight = hwMap.get(Servo.class, "clawRight");
clawLeft = hwMap.get(Servo.class, "clawLeft");
/*
leftFront.setDirection(DcMotor.Direction.FORWARD); // Set to REVERSE if using AndyMark motors
leftBack.setDirection(DcMotor.Direction.FORWARD);
rightFront.setDirection(DcMotor.Direction.FORWARD);// Set to FORWARD if using AndyMark motors
rightBack.setDirection(DcMotor.Direction.FORWARD);
*/
}
}