| 1 | |
| 2 | package org.usfirst.frc.team3501.robot; |
| 3 | |
| 4 | import edu.wpi.first.wpilibj.IterativeRobot; |
| 5 | import edu.wpi.first.wpilibj.command.Command; |
| 6 | import edu.wpi.first.wpilibj.command.Scheduler; |
| 7 | import edu.wpi.first.wpilibj.livewindow.LiveWindow; |
| 8 | import edu.wpi.first.wpilibj.smartdashboard.SendableChooser; |
| 9 | import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard; |
| 10 | |
| 11 | import org.usfirst.frc.team3501.robot.autons.*; |
| 12 | import org.usfirst.frc.team3501.robot.subsystems.*; |
| 13 | |
| 14 | public class Robot extends IterativeRobot { |
| 15 | |
| 16 | public static final Drivetrain drivetrain = new Drivetrain(); |
| 17 | public static final Arm arm = new Arm(); |
| 18 | public static final Claw claw = new Claw(); |
| 19 | |
| 20 | public static OI oi; |
| 21 | |
| 22 | private SendableChooser autoChooser; |
| 23 | |
| 24 | private Command autonomousCommand; |
| 25 | |
| 26 | public void robotInit() { |
| 27 | oi = new OI(); |
| 28 | |
| 29 | chooseAuto(); |
| 30 | } |
| 31 | |
| 32 | public void disabledPeriodic() { |
| 33 | Scheduler.getInstance().run(); |
| 34 | } |
| 35 | |
| 36 | public void autonomousInit() { |
| 37 | autonomousCommand = (Command) autoChooser.getSelected(); |
| 38 | autonomousCommand.start(); |
| 39 | } |
| 40 | |
| 41 | public void autonomousPeriodic() { |
| 42 | Scheduler.getInstance().run(); |
| 43 | } |
| 44 | |
| 45 | public void teleopInit() { |
| 46 | autonomousCommand.cancel(); |
| 47 | } |
| 48 | |
| 49 | public void teleopPeriodic() { |
| 50 | Scheduler.getInstance().run(); |
| 51 | } |
| 52 | |
| 53 | public void testPeriodic() { |
| 54 | LiveWindow.run(); |
| 55 | } |
| 56 | |
| 57 | private void chooseAuto() { |
| 58 | autoChooser = new SendableChooser(); |
| 59 | |
| 60 | autoChooser.addDefault("Drive over step", new DriveOverStep()); |
| 61 | autoChooser.addObject("Drive past step", new DrivePastStep()); |
| 62 | |
| 63 | SmartDashboard.putData("Auto Mode", autoChooser); |
| 64 | } |
| 65 | } |