2 package org
.usfirst
.frc
.team3501
.robot
;
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 org
.usfirst
.frc
.team3501
.robot
.commands
.ExampleCommand
;
9 import org
.usfirst
.frc
.team3501
.robot
.subsystems
.ExampleSubsystem
;
10 import edu
.wpi
.first
.wpilibj
.smartdashboard
.SendableChooser
;
11 import edu
.wpi
.first
.wpilibj
.smartdashboard
.SmartDashboard
;
14 * The VM is configured to automatically run this class, and to call the
15 * functions corresponding to each mode, as described in the IterativeRobot
16 * documentation. If you change the name of this class or the package after
17 * creating this project, you must also update the manifest file in the resource
20 public class Robot
extends IterativeRobot
{
22 public static final ExampleSubsystem exampleSubsystem
= new ExampleSubsystem();
25 Command autonomousCommand
;
26 SendableChooser chooser
;
29 * This function is run when the robot is first started up and should be
30 * used for any initialization code.
32 public void robotInit() {
34 chooser
= new SendableChooser();
35 chooser
.addDefault("Default Auto", new ExampleCommand());
36 // chooser.addObject("My Auto", new MyAutoCommand());
37 SmartDashboard
.putData("Auto mode", chooser
);
41 * This function is called once each time the robot enters Disabled mode.
42 * You can use it to reset any subsystem information you want to clear when
43 * the robot is disabled.
45 public void disabledInit(){
49 public void disabledPeriodic() {
50 Scheduler
.getInstance().run();
54 * This autonomous (along with the chooser code above) shows how to select between different autonomous modes
55 * using the dashboard. The sendable chooser code works with the Java SmartDashboard. If you prefer the LabVIEW
56 * Dashboard, remove all of the chooser code and uncomment the getString code to get the auto name from the text box
59 * You can add additional auto modes by adding additional commands to the chooser code above (like the commented example)
60 * or additional comparisons to the switch structure below with additional strings & commands.
62 public void autonomousInit() {
63 autonomousCommand
= (Command
) chooser
.getSelected();
65 /* String autoSelected = SmartDashboard.getString("Auto Selector", "Default");
66 switch(autoSelected) {
68 autonomousCommand = new MyAutoCommand();
72 autonomousCommand = new ExampleCommand();
76 // schedule the autonomous command (example)
77 if (autonomousCommand
!= null) autonomousCommand
.start();
81 * This function is called periodically during autonomous
83 public void autonomousPeriodic() {
84 Scheduler
.getInstance().run();
87 public void teleopInit() {
88 // This makes sure that the autonomous stops running when
89 // teleop starts running. If you want the autonomous to
90 // continue until interrupted by another command, remove
91 // this line or comment it out.
92 if (autonomousCommand
!= null) autonomousCommand
.cancel();
96 * This function is called periodically during operator control
98 public void teleopPeriodic() {
99 Scheduler
.getInstance().run();
103 * This function is called periodically during test mode
105 public void testPeriodic() {