Java 类edu.wpi.first.wpilibj.RobotState 实例源码

项目:snobot-2017    文件:Command.java   
/**
 * The run method is used internally to actually run the commands.
 *
 * @return whether or not the command should stay within the {@link Scheduler}.
 */
synchronized boolean run() {
  if (!m_runWhenDisabled && m_parent == null && RobotState.isDisabled()) {
    cancel();
  }
  if (isCanceled()) {
    return false;
  }
  if (!m_initialized) {
    m_initialized = true;
    startTiming();
    _initialize();
    initialize();
  }
  _execute();
  execute();
  return !isFinished();
}
项目:turtleshell    文件:CrossBaseline.java   
/**
 * Runs the autonomous program.
 *
 * This will drive the robot forward 9.5 feet at 0.8 speed and then 2 feet at 0.3 speed
 */
@Override
public void auto(){
    Timer t = new Timer();
    t.start();
    while (t.get() < 2 && RobotState.isAutonomous() && RobotState.isEnabled()) {
        chassis.tankDrive(new MotorValue(-.28), new MotorValue(-.28));
        System.out.println(t.get() + " " + chassis.getLeftDistance().getInches() + " " +
        chassis.getRightDistance().getInches() + " ");
    }
    while (t.get() < 3.5 && RobotState.isAutonomous() && RobotState.isEnabled()) {
        chassis.tankDrive(new MotorValue(-.15),new MotorValue(-.15));
    }
    while (t.get() < 4.0 && RobotState.isAutonomous() && RobotState.isEnabled()) {
        chassis.tankDrive(new MotorValue(0),new MotorValue(0));
    }
    while (t.get() < 4.30 && RobotState.isAutonomous() && RobotState.isEnabled()) {//icnreased from 4.1 to 4.3
        chassis.tankDrive(new MotorValue(.15),new MotorValue(.15));
    }
    chassis.stop();
}
项目:blanket    文件:Action.java   
@Override
public final Object call() throws Exception {
    if (isActive) {
        if (RobotState.isDisabled()) cancel();
        if (isCancelled()) return null;
        startTiming();
        initialize();
        while (!isFinished() && !isTimedOut()) {
            if (isCancelled()) {
                interrupted();
                return isCancelled();
            } else execute();
        }
        end();
    } else {
        throw new InactiveActionException();
    }
    return null;
}
项目:CasseroleLib    文件:CsvLogger.java   
private static String getOpModeName() {
    if(RobotState.isAutonomous()){
        return "Auto";
    } else {
        return "Teleop";
    }
}
项目:turtleshell    文件:BlastoiseDataLogger.java   
private static int getRobotState() {
    if(RobotState.isDisabled()){
        return 0;
    } else if (RobotState.isAutonomous()) {
        return 1;
    } else if (RobotState.isOperatorControl()) {
        return 2;
    } else if (RobotState.isTest()) {
        return 3;
    }
    return -1;
}
项目:FlashLib    文件:FRCHIDInterface.java   
@Override
public double getHIDAxis(int hid, int axis) {
    if(FlashRobotUtil.inEmergencyStop() || RobotState.isDisabled())
        return 0;
    return ds.getStickAxis(hid, axis);
}
项目:FlashLib    文件:FRCHIDInterface.java   
@Override
public boolean getHIDButton(int hid, int button) {
    if(FlashRobotUtil.inEmergencyStop() || RobotState.isDisabled())
        return false;
    return ds.getStickButton(hid, (byte)button);
}
项目:FlashLib    文件:FRCHIDInterface.java   
@Override
public int getHIDPOV(int hid, int pov) {
    if(FlashRobotUtil.inEmergencyStop() || RobotState.isDisabled())
        return -1;
    return ds.getStickPOV(hid, pov);
}
项目:turtleshell    文件:Robot.java   
public void operatorControl() {
    TurtleDashboard.teleop();
    while (RobotState.isOperatorControl() && RobotState.isEnabled()) {
        teleUpdate();
    }
}
项目:turtleshell    文件:TankDrive.java   
public static boolean isAutonomous() {
    return RobotState.isAutonomous();
}