add command to robot.java to actually run the LimitSwitchTest
[3501/2015-FRC-Spark] / src / org / usfirst / frc3501 / RiceCatRobot / Robot.java
CommitLineData
f11ce98e
KZ
1package org.usfirst.frc3501.RiceCatRobot;
2
17f99e2c 3import org.usfirst.frc3501.RiceCatRobot.commands.LimitSwitchTest;
f11ce98e
KZ
4import org.usfirst.frc3501.RiceCatRobot.subsystems.Arm;
5import org.usfirst.frc3501.RiceCatRobot.subsystems.Claw;
6import org.usfirst.frc3501.RiceCatRobot.subsystems.DriveTrain;
7
8import edu.wpi.first.wpilibj.Compressor;
9import edu.wpi.first.wpilibj.IterativeRobot;
10import edu.wpi.first.wpilibj.Timer;
11import edu.wpi.first.wpilibj.command.Scheduler;
12
13public class Robot extends IterativeRobot {
e3bfff96
KZ
14 static Timer timer;
15 public static OI oi;
16 public static DriveTrain driveTrain;
17 public static Arm arm;
18 public static Claw claw;
19 public static Compressor compressor;
f11ce98e 20
e3bfff96
KZ
21 public void robotInit() {
22 RobotMap.init();
23 driveTrain = new DriveTrain();
24 arm = new Arm();
25 claw = new Claw();
26 oi = new OI();
27 compressor = new Compressor(RobotMap.COMPRESSOR_PORT);
28 }
f11ce98e 29
e3bfff96
KZ
30 public void autonomousInit() {
31 }
f11ce98e 32
e3bfff96
KZ
33 public void autonomousPeriodic() {
34 Scheduler.getInstance().run();
35 }
f11ce98e 36
e3bfff96
KZ
37 public void teleopInit() {
38 System.out.println("running teleopInit");
17f99e2c 39 Scheduler.getInstance().add(new LimitSwitchTest());
e3bfff96 40 }
f11ce98e 41
e3bfff96
KZ
42 public void teleopPeriodic() {
43 Scheduler.getInstance().run();
f11ce98e 44
e3bfff96 45 }
f11ce98e 46
e3bfff96
KZ
47 public void operate() {
48 driveTrain
49 .arcadeDrive(OI.rightJoystick.getY(), OI.rightJoystick.getTwist());
50 claw.doTriggerAction();
51 if (OI.leftJoystick.getRawButton(8)) {
52 arm.setArmSpeeds(0.3);
53 } else if (OI.leftJoystick.getRawButton(9)) {
54 arm.setArmSpeeds(-0.3);
55 } else if (OI.leftJoystick.getRawButton(6)) {
56 arm.setLeft(0.3);
57 } else if (OI.leftJoystick.getRawButton(7)) {
58 arm.setLeft(-0.3);
59 } else if (OI.leftJoystick.getRawButton(11)) {
60 arm.setRight(-0.3);
61 } else if (OI.leftJoystick.getRawButton(10)) {
62 arm.setRight(0.3);
63 }
64 if (Math.abs(OI.leftJoystick.getY()) < 0.05) {
65 arm.setArmSpeeds(0);
f11ce98e 66
e3bfff96
KZ
67 } else {
68 arm.fineTuneControl(OI.leftJoystick.getY());
f11ce98e 69 }
e3bfff96 70 }
b72e169c 71}