1 package org
.usfirst
.frc
.team3501
.robot
;
3 import org
.usfirst
.frc
.team3501
.robot
.commands
.driving
.SetLowGear
;
4 import org
.usfirst
.frc
.team3501
.robot
.commands
.driving
.TimeDrive
;
5 import org
.usfirst
.frc
.team3501
.robot
.subsystems
.DriveTrain
;
6 import org
.usfirst
.frc
.team3501
.robot
.subsystems
.IntakeArm
;
7 import org
.usfirst
.frc
.team3501
.robot
.subsystems
.Shooter
;
9 import edu
.wpi
.first
.wpilibj
.CameraServer
;
10 import edu
.wpi
.first
.wpilibj
.IterativeRobot
;
11 import edu
.wpi
.first
.wpilibj
.command
.Scheduler
;
12 import edu
.wpi
.first
.wpilibj
.smartdashboard
.SendableChooser
;
13 import edu
.wpi
.first
.wpilibj
.smartdashboard
.SmartDashboard
;
15 public class Robot
extends IterativeRobot
{
17 public static DriveTrain driveTrain
;
18 public static Shooter shooter
;
19 public static IntakeArm intakeArm
;
21 // Sendable Choosers send a drop down menu to the Smart Dashboard.
22 private static SendableChooser frontChooser
;
23 private static CameraServer camera
;
26 public void robotInit() {
27 driveTrain
= new DriveTrain();
28 shooter
= new Shooter();
29 intakeArm
= new IntakeArm();
33 initializeSendableChooser();
34 addFrontChooserOptions();
35 sendSendableChooserToSmartDashboard();
37 camera
= CameraServer
.getInstance();
38 camera
.setQuality(50);
39 camera
.startAutomaticCapture("cam0");
42 private void initializeSendableChooser() {
43 frontChooser
= new SendableChooser();
46 private void addFrontChooserOptions() {
47 frontChooser
.addDefault("Intake", false);
48 frontChooser
.addObject("Shooter", true);
51 private void sendSendableChooserToSmartDashboard() {
52 SmartDashboard
.putData("PositionChooser", frontChooser
);
56 public void autonomousInit() {
57 // get options chosen from drop down menu
58 boolean flip
= (boolean) frontChooser
.getSelected();
61 driveTrain
.toggleFlipped();
64 Scheduler
.getInstance().add(new TimeDrive(4, .7));
68 public void autonomousPeriodic() {
69 Scheduler
.getInstance().run();
73 public void teleopInit() {
74 Scheduler
.getInstance().add(new SetLowGear());
78 public void teleopPeriodic() {
79 Scheduler
.getInstance().run();