Commit | Line | Data |
---|---|---|
f11ce98e KZ |
1 | package org.usfirst.frc3501.RiceCatRobot; |
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 { | |
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; | |
19 | ||
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 | } | |
28 | ||
29 | public void autonomousInit() { | |
30 | } | |
31 | ||
32 | public void autonomousPeriodic() { | |
33 | Scheduler.getInstance().run(); | |
34 | } | |
35 | ||
36 | public void teleopInit() { | |
37 | System.out.println("running teleopInit"); | |
38 | } | |
39 | ||
40 | public void teleopPeriodic() { | |
41 | Scheduler.getInstance().run(); | |
42 | ||
43 | } | |
44 | ||
45 | public void operate() { | |
46 | driveTrain.arcadeDrive(OI.rightJoystick.getY(), | |
47 | 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); | |
64 | ||
65 | } else { | |
66 | arm.fineTuneControl(OI.leftJoystick.getY()); | |
67 | } | |
68 | } | |
69 | } |