summaryrefslogtreecommitdiff
path: root/src/org/usfirst/frc/team4272/robot2017/Robot.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/org/usfirst/frc/team4272/robot2017/Robot.java')
-rw-r--r--src/org/usfirst/frc/team4272/robot2017/Robot.java48
1 files changed, 41 insertions, 7 deletions
diff --git a/src/org/usfirst/frc/team4272/robot2017/Robot.java b/src/org/usfirst/frc/team4272/robot2017/Robot.java
index b65ce35..851f3f1 100644
--- a/src/org/usfirst/frc/team4272/robot2017/Robot.java
+++ b/src/org/usfirst/frc/team4272/robot2017/Robot.java
@@ -43,27 +43,43 @@ public class Robot extends IterativeRobot {
private Autonomous auto;
private Teleop teleop;
+ private boolean networkInitialized = false;
+ private void networkInit() {
+ Autonomous.networkInit();
+ }
+
/**
* This function is run when the robot is first started up and should be
* used for any initialization code.
*/
public void robotInit() {
- Autonomous.robotInit();
}
public void autonomousInit() {
try {
+ if (!networkInitialized) {
+ networkInit();
+ networkInitialized = true;
+ }
auto = new Autonomous(robot);
- } catch (Exception e) {}
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
}
public void autonomousPeriodic() {
try {
robot.run(auto.run(control));
- } catch (Exception e) {}
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
}
public void teleopInit() {
try {
+ if (!networkInitialized) {
+ networkInit();
+ networkInitialized = true;
+ }
teleop = new Teleop(robot);
} catch (Exception e) {}
}
@@ -71,18 +87,36 @@ public class Robot extends IterativeRobot {
public void teleopPeriodic() {
try {
robot.run(teleop.run(control, oi));
- } catch (Exception e) {}
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
}
public void disabledInit() {
+ try {
+ if (!networkInitialized) {
+ networkInit();
+ networkInitialized = true;
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
}
public void disabledPeriodic() {
}
- /**
- * This function is called periodically during test mode
- */
+ public void testInit() {
+ try {
+ if (!networkInitialized) {
+ networkInit();
+ networkInitialized = true;
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
public void testPeriodic() {
}
}