Class Pivot

Direct Known Subclasses:
Pivot, Pivot

public class Pivot extends SmartPositionalMechanism
Pivot mechanism.

A Pivot is a single-jointed rotation mechanism that rotates around the vertical axis, such as a shooter hood or turret. This core class holds pivot state, physics simulation, and measurement/predicate logic only. Command and Trigger factories live on Pivot, which extends this class and has a full usage example in its Javadoc.

  • Constructor Details

  • Method Details

    • isBetween

      public boolean isBetween(org.wpilib.units.measure.Angle start, org.wpilib.units.measure.Angle end)
      Between two angles.
      Parameters:
      start - Start angle.
      end - End angle
      Returns:
      True if the pivot is between the given angles.
    • isGte

      public boolean isGte(org.wpilib.units.measure.Angle angle)
      Greater than or equal to angle.
      Parameters:
      angle - Angle to check against.
      Returns:
      True if the pivot's angle is greater than or equal to the given angle.
    • isLte

      public boolean isLte(org.wpilib.units.measure.Angle angle)
      Less than or equal to angle
      Parameters:
      angle - Angle to check against
      Returns:
      True if the pivot's angle is less than or equal to the given angle.
    • getAngle

      public org.wpilib.units.measure.Angle getAngle()
      Get the SmartMotorController Mechanism Position representing the pivot.
      Returns:
      Pivot Angle
    • isNear

      public boolean isNear(org.wpilib.units.measure.Angle angle, org.wpilib.units.measure.Angle within)
      Pivot is near an angle.
      Parameters:
      angle - Angle to be near.
      within - Angle within.
      Returns:
      True if the pivot is near another angle.
    • isAtMax

      public boolean isAtMax()
      Whether the pivot is at or above its maximum angle, defined by the motor controller upper soft limit if present, otherwise the pivot upper hard limit.
      Specified by:
      isAtMax in class SmartPositionalMechanism
      Returns:
      True if the pivot is at its configured maximum.
      Throws:
      PivotConfigurationException - if neither a motor controller upper soft limit nor a pivot upper hard limit is configured.
    • isAtMin

      public boolean isAtMin()
      Whether the pivot is at or below its minimum angle, defined by the motor controller lower soft limit if present, otherwise the pivot lower hard limit.
      Specified by:
      isAtMin in class SmartPositionalMechanism
      Returns:
      True if the pivot is at its configured minimum.
      Throws:
      PivotConfigurationException - if neither a motor controller lower soft limit nor a pivot lower hard limit is configured.
    • simIterate

      public void simIterate()
      Description copied from class: SmartMechanism
      Iterate sim
      Specified by:
      simIterate in class SmartMechanism
    • updateTelemetry

      public void updateTelemetry()
      Description copied from class: SmartMechanism
      Update the mechanism's telemetry.
      Specified by:
      updateTelemetry in class SmartMechanism
    • visualizationUpdate

      public void visualizationUpdate()
      Updates the angle of the mechanism ligament to match the current angle of the pivot.
      Specified by:
      visualizationUpdate in class SmartMechanism
    • getPose3d

      public org.wpilib.math.geometry.Pose3d getPose3d()
      Get the pivot's pose, for publishing to AdvantageScope as a component of a robot model: where it is mounted, as set in its MechanismPositionConfig, turned to the pivot's angle about the axis normal to its movement plane. A turret turns in the XY plane.
      Specified by:
      getPose3d in class SmartMechanism
      Returns:
      The pivot's Pose3d, relative to the robot.
    • getName

      public String getName()
      Description copied from class: SmartMechanism
      Get the name of the mechanism.
      Specified by:
      getName in class SmartMechanism
      Returns:
      String name.
    • getPivotConfig

      public PivotConfig getPivotConfig()
      Get the PivotConfig object for this Pivot
      Returns:
      The PivotConfig object for this Pivot