|
| 1 | + |
| 2 | +package org.usfirst.frc.team5518.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 | + |
| 9 | +import org.usfirst.frc.team5518.robot.commands.ArcadeDriveJoystick; |
| 10 | +import org.usfirst.frc.team5518.robot.commands.AutonomousCmd; |
| 11 | +import org.usfirst.frc.team5518.robot.subsystems.AutonomousSys; |
| 12 | +import org.usfirst.frc.team5518.robot.subsystems.DrivingSys; |
| 13 | + |
| 14 | +/** |
| 15 | + * The VM is configured to automatically run this class, and to call the |
| 16 | + * functions corresponding to each mode, as described in the IterativeRobot |
| 17 | + * documentation. If you change the name of this class or the package after |
| 18 | + * creating this project, you must also update the manifest file in the resource |
| 19 | + * directory. |
| 20 | + */ |
| 21 | +public class Robot extends IterativeRobot { |
| 22 | + |
| 23 | + public static AutonomousSys autoSys; |
| 24 | + public static DrivingSys driveSys; |
| 25 | + public static OI oi; |
| 26 | + |
| 27 | + Command autonomousCommand; |
| 28 | + |
| 29 | + /** |
| 30 | + * This function is run when the robot is first started up and should be |
| 31 | + * used for any initialization code. |
| 32 | + */ |
| 33 | + public void robotInit() { |
| 34 | + |
| 35 | + // initialize all subsystems and important classes |
| 36 | + oi = new OI(); |
| 37 | + autoSys = new AutonomousSys(); |
| 38 | + driveSys = new DrivingSys(); |
| 39 | + |
| 40 | + // instantiate the command used for the autonomous period |
| 41 | + autonomousCommand = new AutonomousCmd(); |
| 42 | + } |
| 43 | + |
| 44 | + public void disabledPeriodic() { |
| 45 | + Scheduler.getInstance().run(); |
| 46 | + } |
| 47 | + |
| 48 | + public void autonomousInit() { |
| 49 | + // schedule the autonomous command (example) |
| 50 | + if (autonomousCommand != null) autonomousCommand.start(); |
| 51 | + } |
| 52 | + |
| 53 | + /** |
| 54 | + * This function is called periodically during autonomous |
| 55 | + */ |
| 56 | + public void autonomousPeriodic() { |
| 57 | + Scheduler.getInstance().run(); |
| 58 | + driveSys.log(); |
| 59 | + } |
| 60 | + |
| 61 | + public void teleopInit() { |
| 62 | + // This makes sure that the autonomous stops running when |
| 63 | + // teleop starts running. If you want the autonomous to |
| 64 | + // continue until interrupted by another command, remove |
| 65 | + // this line or comment it out. |
| 66 | + if (autonomousCommand != null) autonomousCommand.cancel(); |
| 67 | + } |
| 68 | + |
| 69 | + /** |
| 70 | + * This function is called when the disabled button is hit. |
| 71 | + * You can use it to reset subsystems before shutting down. |
| 72 | + */ |
| 73 | + public void disabledInit(){ |
| 74 | + |
| 75 | + } |
| 76 | + |
| 77 | + /** |
| 78 | + * This function is called periodically during operator control |
| 79 | + */ |
| 80 | + public void teleopPeriodic() { |
| 81 | + Scheduler.getInstance().run(); |
| 82 | + driveSys.log(); |
| 83 | + } |
| 84 | + |
| 85 | + /** |
| 86 | + * This function is called periodically during test mode |
| 87 | + */ |
| 88 | + public void testPeriodic() { |
| 89 | + LiveWindow.run(); |
| 90 | + driveSys.log(); |
| 91 | + } |
| 92 | +} |
0 commit comments