Class Arm

Direct Known Subclasses:
Arm, Arm

public class Arm extends SmartPositionalMechanism
Arm mechanism.

This core class holds arm state, physics simulation, and measurement/predicate logic only. Command and Trigger factories (setAngle, run, runTo, near, max, min, ...) live on Arm, which extends this class and has a full usage example in its Javadoc.

  • Constructor Details

  • Method Details

    • updateTelemetry

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

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

      public void visualizationUpdate()
      Updates the mechanism ligament with the current angle of the arm.
      Specified by:
      visualizationUpdate in class SmartMechanism
      See Also:
    • getPose3d

      public org.wpilib.math.geometry.Pose3d getPose3d()
      Get the arm'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 arm's angle about the axis normal to its movement plane.
      Specified by:
      getPose3d in class SmartMechanism
      Returns:
      The arm'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.
    • getAngle

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

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

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

      public boolean isAtMin()
      Whether the arm is at or below its minimum angle, defined by the motor controller lower soft limit if present, otherwise the arm lower hard limit.
      Specified by:
      isAtMin in class SmartPositionalMechanism
      Returns:
      True if the arm is at its configured minimum.
      Throws:
      ArmConfigurationException - if neither a motor controller lower soft limit nor an arm lower hard limit is configured.
    • 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 arm is between the given angles.
    • 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 arm's angle is less than or equal to the given angle.
    • 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 arm's angle is greater than or equal to the given angle.
    • getArmConfig

      public ArmConfig getArmConfig()
      Get the ArmConfig for this Arm.
      Returns:
      The ArmConfig used to configure this Arm.