SHARE
TWEET
Robot2013.java
a guest
Feb 16th, 2013
9
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
- package edu.wpi.first.wpilibj.templates;
- import edu.wpi.first.wpilibj.Relay;
- import edu.wpi.first.wpilibj.SimpleRobot;
- import edu.wpi.first.wpilibj.Timer;
- public class Robot2013 extends SimpleRobot {
- public static final double REFRESH_RATE = 0.05;
- private DriveStation driveStation;
- private static boolean auto;
- private static boolean teleop;
- public Robot2013() {
- getWatchdog().setEnabled(false);
- this.driveStation = new DriveStation();
- new Relay(1).set(Relay.Value.kForward);
- }
- public void autonomous() {
- auto = true;
- teleop = false;
- if(isAutonomousMode() && isEnabled())
- {
- driveStation.autonomousControl();
- driveStation.updateLCD();
- }
- }
- public void operatorControl() {
- auto = false;
- teleop = true;
- driveStation.updateLCD();
- while (isOperatorControl() && isEnabled()) {
- driveStation.operatorControl();
- Timer.delay(REFRESH_RATE);
- }
- }
- public boolean isAutonomousMode() {
- return (isAutonomous() && isEnabled());
- }
- public boolean isOperatorMode() {
- return (this.isOperatorControl() && isEnabled());
- }
- public static boolean isAuto()
- {
- return auto;
- }
- public static boolean isTeleop()
- {
- return teleop;
- }
- }
RAW Paste Data
