コード例 #1
0
 public boolean isDetensioned() {
   double curr_volts = sensor.getAverageVoltage();
   boolean on_target =
       ((curr_volts > (slack_tension_volts - threshold_volts))
           && (curr_volts < (slack_tension_volts + threshold_volts)));
   boolean at_min = leftMin.get();
   return (on_target || at_min);
 }
コード例 #2
0
  protected void usePIDOutput(double output) {

    //
    // Important:  invert the motor polarity!
    //             (Positive Motor Voltage -> Lower Tension)
    //

    output = -output;

    //
    // Only allow the arms to move in a direction away from a limit switch
    // if that limit switch is closed, unless the motor command is 0.0
    // (so the motor controller can be disabled)
    //

    if ((output > 0.0 && !leftMin.get()) || (output < 0.0 && !leftMax.get()) || (output == 0.0))
      this.leftSC.set(output);
    else this.leftSC.set(0);
  }