4
4
$endif $
5
5
using WPILib;
6
6
using WPILib . Commands ;
7
- using WPILib . livewindow ;
7
+ using WPILib . LiveWindow ;
8
8
using $safeprojectname $. Subsystems
9
9
using $safeprojectname$. Commands
10
10
11
11
namespace $safeprojectname$
12
12
{
13
- /**
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.
17
- */
13
+ /// <summary>
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.
17
+ /// </summary>
18
18
public class $safeprojectname $ : IterativeRobot
19
19
{
20
20
public static readonly ExampleSubsystem exampleSubsystem = new ExampleSubsystem ( ) ;
21
21
public static OI oi ;
22
22
23
23
Command autonomousCommand ;
24
+ SendableChooser chooser ;
24
25
25
- /**
26
- * This function is run when the robot is first started up and should be
27
- * used for any initialization code.
28
- */
29
- public override void RobotInit ( ) {
26
+ // This function is run when the robot is first started up and should be
27
+ // used for any initialization code.
28
+ //
29
+ public override void RobotInit ( )
30
+ {
30
31
oi = new OI ( ) ;
31
32
// instantiate the command used for the autonomous period
32
33
autonomousCommand = new ExampleCommand ( ) ;
34
+ chooser = new SendableChooser ( ) ;
35
+ chooser . AddDefault ( "Default Auto" , new ExampleCommand ( ) ) ;
36
+ //chooser.AddObject("My Auto", new MyAutoCommand);
33
37
}
34
38
35
- public override void DisabledPeriodic ( ) {
39
+ public override void DisabledPeriodic ( )
40
+ {
36
41
Scheduler . GetInstance ( ) . Run ( ) ;
37
42
}
38
43
39
- public override void AutonomousInit ( ) {
44
+ // This autonomous (along with the sendable chooser above) shows how to select between
45
+ // different autonomous modes using the dashboard. The senable chooser code works with
46
+ // the Java SmartDashboard. If you prefer the LabVIEW Dashboard, remove all the chooser
47
+ // code an uncomment the GetString code to get the uto name from the text box below
48
+ // the gyro.
49
+ // You can add additional auto modes by adding additional commands to the chooser code
50
+ // above (like the commented example) or additional comparisons to the switch structure
51
+ // below with additional strings and commands.
52
+ public override void AutonomousInit ( )
53
+ {
54
+ autonomousCommand = ( Command ) chooser . GetSelected ( ) ;
55
+
56
+ /*
57
+ string autoSelected = SmartDashboard.GetString("Auto Selector", "Default");
58
+ switch(autoSelected)
59
+ {
60
+ case "My Auto":
61
+ autonomousCommand = new MyAutoCommand();
62
+ break;
63
+ case "Default Auto"
64
+ default:
65
+ autonomousCommand = new ExampleCommand();
66
+ break;
67
+ }
68
+ */
40
69
// schedule the autonomous command (example)
41
70
if ( autonomousCommand != null ) autonomousCommand . Start ( ) ;
42
71
}
43
72
44
- /**
45
- * This function is called periodically during autonomous
46
- */
73
+
74
+ // This function is called periodically during autonomous
47
75
public override void AutonomousPeriodic ( ) {
48
76
Scheduler . GetInstance ( ) . Run ( ) ;
49
77
}
@@ -56,24 +84,24 @@ public override void TeleopInit() {
56
84
if ( autonomousCommand != null ) autonomousCommand . Cancel ( ) ;
57
85
}
58
86
59
- /**
60
- * This function is called when the disabled button is hit.
61
- * You can use it to reset subsystems before shutting down.
62
- * /
87
+ //
88
+ // This function is called when the disabled button is hit.
89
+ // You can use it to reset subsystems before shutting down.
90
+ / /
63
91
public override void DisabledInit ( ) {
64
92
65
93
}
66
94
67
- /**
68
- * This function is called periodically during operator control
69
- * /
95
+ //
96
+ // This function is called periodically during operator control
97
+ / /
70
98
public override void TeleopPeriodic ( ) {
71
99
Scheduler . GetInstance ( ) . Run ( ) ;
72
100
}
73
101
74
- /**
75
- * This function is called periodically during test mode
76
- * /
102
+ //
103
+ // This function is called periodically during test mode
104
+ / /
77
105
public override void TestPeriodic ( ) {
78
106
LiveWindow . Run ( ) ;
79
107
}
0 commit comments