Class Parts.ServoPart

java.lang.Object
com.crossbotics.ftchelper.robot.Parts.ServoPart
Enclosing class:
Parts

public static final class Parts.ServoPart extends Object
One servo: how far it turns and over which pulse. The FTC SDK sends 600 to 2400 microseconds for positions 0 to 1 unless the code asks for its full range (.fullRange()), so a servo that turns 300 degrees over 500-2500 us turns 270 over 0 to 1 on a normal hub (sdkRangeDeg()).
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    final boolean
    True for a servo described in Robot.java (Parts.customServo(java.lang.String, double, double)), not from the catalog.
    final String
    The parts catalog id, e.g.
    final double
    The seller's pulse range, microseconds; NaN = not given (then 500 to 2500 is assumed).
    final double
    The seller's pulse range, microseconds; NaN = not given (then 500 to 2500 is assumed).
    final double
    The seller's full turn, degrees, over pulseMinUs to pulseMaxUs; NaN = not given.
    final double
    Seconds to turn 60 degrees with no load at about the hub's servo voltage (a REV hub gives its servos 5 V): the seller's 4.8 V number, or its 6 V one when it gives no 4.8 V number (then the real servo is a little slower).
  • Method Summary

    Modifier and Type
    Method
    Description
    double
    degreesOver(double lowUs, double highUs)
    How far positions 0 to 1 turn it with this pulse range.
    double
    Degrees per microsecond of pulse (goBILDA 2000: 0.15); NaN when the range is not given.
    double
    The pulse for position 1 with full range: the seller's, or 2500 us when it gives none.
    double
    The pulse for position 0 with full range: the seller's, or 500 us when it gives none.
    double
    fullMoveSec(boolean fullRange)
    About how long a move from position 0 to 1 takes on a hub, from the seller's speed: a starting value for a part's travelSec (goBILDA 2000 torque on the normal range: 270 degrees at 0.25 s per 60 = 1.13 s).
    double
    Degrees over 0 to 1 with the SDK's normal 600-2400 us (goBILDA 2000: 270).
    simWords(double lowUs, double highUs)
    The words for the simulator's robot file: part=ID for a catalog servo; for a custom one its turn over the file's pulse range and its speed (rangeDeg=270, secPer60=0.2), "" when those are not known.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • id

      public final String id
      The parts catalog id, e.g. "gobilda-2000-speed".
    • rangeDeg

      public final double rangeDeg
      The seller's full turn, degrees, over pulseMinUs to pulseMaxUs; NaN = not given.
    • pulseMinUs

      public final double pulseMinUs
      The seller's pulse range, microseconds; NaN = not given (then 500 to 2500 is assumed).
    • pulseMaxUs

      public final double pulseMaxUs
      The seller's pulse range, microseconds; NaN = not given (then 500 to 2500 is assumed).
    • secPer60Deg

      public final double secPer60Deg
      Seconds to turn 60 degrees with no load at about the hub's servo voltage (a REV hub gives its servos 5 V): the seller's 4.8 V number, or its 6 V one when it gives no 4.8 V number (then the real servo is a little slower).
    • custom

      public final boolean custom
      True for a servo described in Robot.java (Parts.customServo(java.lang.String, double, double)), not from the catalog.
  • Method Details

    • fullMoveSec

      public double fullMoveSec(boolean fullRange)
      About how long a move from position 0 to 1 takes on a hub, from the seller's speed: a starting value for a part's travelSec (goBILDA 2000 torque on the normal range: 270 degrees at 0.25 s per 60 = 1.13 s).
      Parameters:
      fullRange - true with .fullRange() (0 to 1 is the servo's whole turn)
      Returns:
      seconds, or NaN when the catalog lacks the servo's turn or speed
    • simWords

      public String simWords(double lowUs, double highUs)
      The words for the simulator's robot file: part=ID for a catalog servo; for a custom one its turn over the file's pulse range and its speed (rangeDeg=270, secPer60=0.2), "" when those are not known.
      Parameters:
      lowUs - the pulse at position 0 in the robot file (600 normally, 500 with full range)
      highUs - the pulse at position 1
    • fullLowUs

      public double fullLowUs()
      The pulse for position 0 with full range: the seller's, or 500 us when it gives none.
    • fullHighUs

      public double fullHighUs()
      The pulse for position 1 with full range: the seller's, or 2500 us when it gives none.
    • degreesPerMicrosecond

      public double degreesPerMicrosecond()
      Degrees per microsecond of pulse (goBILDA 2000: 0.15); NaN when the range is not given.
    • degreesOver

      public double degreesOver(double lowUs, double highUs)
      How far positions 0 to 1 turn it with this pulse range.
      Parameters:
      lowUs - microseconds at position 0
      highUs - microseconds at position 1
      Returns:
      degrees (NaN when the range is not given)
    • sdkRangeDeg

      public double sdkRangeDeg()
      Degrees over 0 to 1 with the SDK's normal 600-2400 us (goBILDA 2000: 270).