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