Commit | Line | Data |
---|---|---|
38a404b3 KZ |
1 | package org.usfirst.frc.team3501.robot; |
2 | ||
eeb6c3d9 | 3 | import org.usfirst.frc.team3501.robot.commands.driving.SetLowGear; |
1b977a14 | 4 | import org.usfirst.frc.team3501.robot.commands.driving.TimeDrive; |
047383c3 | 5 | import org.usfirst.frc.team3501.robot.subsystems.DriveTrain; |
e47f0862 | 6 | import org.usfirst.frc.team3501.robot.subsystems.IntakeArm; |
40348cab E |
7 | import org.usfirst.frc.team3501.robot.subsystems.Shooter; |
8 | ||
1b977a14 | 9 | import edu.wpi.first.wpilibj.CameraServer; |
38a404b3 KZ |
10 | import edu.wpi.first.wpilibj.IterativeRobot; |
11 | import edu.wpi.first.wpilibj.command.Scheduler; | |
9e9154af HD |
12 | import edu.wpi.first.wpilibj.smartdashboard.SendableChooser; |
13 | import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard; | |
38a404b3 KZ |
14 | |
15 | public class Robot extends IterativeRobot { | |
16 | public static OI oi; | |
17 | public static DriveTrain driveTrain; | |
40348cab | 18 | public static Shooter shooter; |
a96fa926 | 19 | public static IntakeArm intakeArm; |
3366a59a | 20 | |
9e9154af | 21 | // Sendable Choosers send a drop down menu to the Smart Dashboard. |
1b977a14 HD |
22 | private static SendableChooser frontChooser; |
23 | private static CameraServer camera; | |
9e9154af | 24 | |
38a404b3 KZ |
25 | @Override |
26 | public void robotInit() { | |
9742fe2e | 27 | driveTrain = new DriveTrain(); |
40348cab | 28 | shooter = new Shooter(); |
a96fa926 | 29 | intakeArm = new IntakeArm(); |
fab544eb HD |
30 | |
31 | oi = new OI(); | |
9e9154af | 32 | |
1b977a14 HD |
33 | initializeSendableChooser(); |
34 | addFrontChooserOptions(); | |
35 | sendSendableChooserToSmartDashboard(); | |
9e9154af | 36 | |
1b977a14 HD |
37 | camera = CameraServer.getInstance(); |
38 | camera.setQuality(50); | |
39 | camera.startAutomaticCapture("cam0"); | |
9e9154af HD |
40 | } |
41 | ||
1b977a14 HD |
42 | private void initializeSendableChooser() { |
43 | frontChooser = new SendableChooser(); | |
9e9154af HD |
44 | } |
45 | ||
1b977a14 HD |
46 | private void addFrontChooserOptions() { |
47 | frontChooser.addDefault("Intake", false); | |
48 | frontChooser.addObject("Shooter", true); | |
9e9154af HD |
49 | } |
50 | ||
1b977a14 HD |
51 | private void sendSendableChooserToSmartDashboard() { |
52 | SmartDashboard.putData("PositionChooser", frontChooser); | |
29d59f48 ME |
53 | } |
54 | ||
38a404b3 KZ |
55 | @Override |
56 | public void autonomousInit() { | |
9e9154af | 57 | // get options chosen from drop down menu |
1b977a14 HD |
58 | boolean flip = (boolean) frontChooser.getSelected(); |
59 | ||
60 | if (flip) { | |
61 | driveTrain.toggleFlipped(); | |
62 | } | |
63 | ||
64 | Scheduler.getInstance().add(new TimeDrive(4, .7)); | |
38a404b3 KZ |
65 | } |
66 | ||
67 | @Override | |
68 | public void autonomousPeriodic() { | |
69 | Scheduler.getInstance().run(); | |
38a404b3 KZ |
70 | } |
71 | ||
72 | @Override | |
73 | public void teleopInit() { | |
eeb6c3d9 | 74 | Scheduler.getInstance().add(new SetLowGear()); |
38a404b3 KZ |
75 | } |
76 | ||
77 | @Override | |
78 | public void teleopPeriodic() { | |
79 | Scheduler.getInstance().run(); | |
1e039ebd E |
80 | } |
81 | ||
38a404b3 | 82 | } |