/**
  * Uses the PID controller that is enabled/disabled in the main class to move to an upright
  * position
  */
 public void moveToUprightPos() {
   vm.autoUpright = true;
   stopJawPistons();
   neckControl.setSetpoint(vm.JAW_UPRIGHT_POS);
   // activate autoneck control if not within 5 ticks of upright position
   if (!(sFunctions.getNeckPot() == vm.JAW_UPRIGHT_POS)) {
     vm.autoUpright = true;
   } else {
     vm.autoUpright = false;
   }
 }
 public void autoCatch() {
   if (sFunctions.isBallOnUltraSound()) {
     setJawClose();
     vm.autoCatching = false;
   } else {
     setJawOpen();
   }
 }
Example #3
0
  /**
   * Runs through the assignments and reuses as many names as possible from the previously used
   * variable map. Updates reservedNames with the set of names that were reused.
   */
  private void reusePreviouslyUsedVariableMap() {
    for (Assignment a : assignments.values()) {
      String prevNewName = prevUsedRenameMap.lookupNewName(a.oldName);
      if (prevNewName == null || reservedNames.contains(prevNewName)) {
        continue;
      }

      if (a.oldName.startsWith(LOCAL_VAR_PREFIX)
          || (!externNames.contains(a.oldName) && prevNewName.startsWith(prefix))) {
        reservedNames.add(prevNewName);
        finalizeNameAssignment(a, prevNewName);
      }
    }
  }
 /** Runs a pickup routine to get the ball from behind */
 public void backPickUp() {
   vm.currentNeckSetPoint = vm.BACK_LOAD_POS;
   neckControl.setSetpoint(vm.currentNeckSetPoint);
   // Spin the rollers to swallow the ball
   moveRollerReverse();
   /* keep picking up until the ball is detected by the ultra sound
    * after which, roll only enough to move the ball to a good position
    * and finaly close on the ball and stop the pickup routine
    */
   //        if (sFunctions.isBallOnUltraSound()) {
   //            if (pickupEndTimer > 30) {
   //                pickupEndTimer = 0;
   //                turnRollerOff();
   //                vm.pickingUp = false;
   //            } else {
   //                pickupEndTimer++;
   //            }
   //        }
 }
 private static void assertVariableMapsEqual(VariableMap a, VariableMap b) {
   Map<String, String> ma = a.getOriginalNameToNewNameMap();
   Map<String, String> mb = b.getOriginalNameToNewNameMap();
   assertEquals("VariableMaps not equal", ma, mb);
 }
 public void setJawClose() {
   jawOpen.set(false);
   jawClose.set(true);
   vm.jawOpen = false;
   vm.fireCalledCycles = 0;
 }
 public void setJawOpen() {
   jawOpen.set(true);
   jawClose.set(false);
   vm.jawOpen = true;
 }