add command to robot.java to actually run the LimitSwitchTest
[3501/2015-FRC-Spark] / src / org / usfirst / frc3501 / RiceCatRobot / Robot.java
1 package org.usfirst.frc3501.RiceCatRobot;
2
3 import org.usfirst.frc3501.RiceCatRobot.commands.LimitSwitchTest;
4 import org.usfirst.frc3501.RiceCatRobot.subsystems.Arm;
5 import org.usfirst.frc3501.RiceCatRobot.subsystems.Claw;
6 import org.usfirst.frc3501.RiceCatRobot.subsystems.DriveTrain;
7
8 import edu.wpi.first.wpilibj.Compressor;
9 import edu.wpi.first.wpilibj.IterativeRobot;
10 import edu.wpi.first.wpilibj.Timer;
11 import edu.wpi.first.wpilibj.command.Scheduler;
12
13 public class Robot extends IterativeRobot {
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;
20
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 }
29
30 public void autonomousInit() {
31 }
32
33 public void autonomousPeriodic() {
34 Scheduler.getInstance().run();
35 }
36
37 public void teleopInit() {
38 System.out.println("running teleopInit");
39 Scheduler.getInstance().add(new LimitSwitchTest());
40 }
41
42 public void teleopPeriodic() {
43 Scheduler.getInstance().run();
44
45 }
46
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);
66
67 } else {
68 arm.fineTuneControl(OI.leftJoystick.getY());
69 }
70 }
71 }