Exemple #1
0
  /**
   * Use a thumb wheel switch to set the autonomous mode setting.
   *
   * @return Autonomous setting to run.
   */
  public int getAutonSetting() {
    try {
      int switchNum = 0;
      int[] binaryValue = new int[3];

      boolean[] dIO = {
        !enhancedIO.getDigital(BIT_1_CHANNEL),
        !enhancedIO.getDigital(BIT_2_CHANNEL),
        !enhancedIO.getDigital(BIT_3_CHANNEL)
      };

      for (int i = 0; i < 3; i++) {
        if (dIO[i]) {
          binaryValue[i] = 1;
        } else {
          binaryValue[i] = 0;
        }
      }

      binaryValue[0] *= 4; // convert all binaryValues to decimal values
      binaryValue[1] *= 2;

      for (int i = 0; i < 3; i++) { // finish binary -> decimal conversion
        switchNum += binaryValue[i];
      }

      return switchNum;
    } catch (EnhancedIOException e) {
      return -1; // Do nothing in case of failure
    }
  }
Exemple #2
0
 /**
  * Gets value of hoop height toggle switch.
  *
  * @return true if high setting, false if middle
  */
 public boolean getStingerSwitch() {
   try {
     return !enhancedIO.getDigital(STINGER_SWITCH_CHANNEL);
   } catch (EnhancedIOException ex) {
     return true;
   }
 }
Exemple #3
0
 // For debugging purposes.
 public boolean getDigitalValue(int channel) {
   boolean b = false;
   try {
     b = !enhancedIO.getDigital(channel);
   } catch (EnhancedIOException e) {
   }
   return b;
 }
Exemple #4
0
 public boolean getNandoSwitch() throws EnhancedIOException {
   return ds.getDigital(5);
 }
Exemple #5
0
 public boolean getAngleSwitch() throws EnhancedIOException {
   return ds.getDigital(2);
 }
Exemple #6
0
 public boolean getCompressorSwitch() throws EnhancedIOException {
   return ds.getDigital(1);
 }
Exemple #7
0
 public boolean getAutoRight() throws EnhancedIOException {
   return ds.getDigital(7);
 }
Exemple #8
0
 public boolean getAutoLeft() throws EnhancedIOException {
   return ds.getDigital(3);
 }
Exemple #9
0
 public boolean getDisckLockButton() throws EnhancedIOException {
   return ds.getDigital(8);
 }