Class Arm
java.lang.Object
yams.core.mechanisms.SmartMechanism
yams.core.mechanisms.positional.SmartPositionalMechanism
yams.core.mechanisms.positional.Arm
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.
-
Field Summary
Fields inherited from class SmartPositionalMechanism
m_mechanismLigament, m_mechanismRootFields inherited from class SmartMechanism
m_mechanismWindow, m_smc, m_telemetry -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedArm(ArmConfig config, SmartMotorController smc) Constructor for the Arm mechanism. -
Method Summary
Modifier and TypeMethodDescriptionorg.wpilib.units.measure.AnglegetAngle()Get theSmartMotorControllerMechanism Position representing the arm.getName()Get the name of the mechanism.org.wpilib.math.geometry.Pose3dGet the arm's pose, for publishing to AdvantageScope as a component of a robot model: where it is mounted, as set in itsMechanismPositionConfig, turned to the arm's angle about the axis normal to its movement plane.booleanisAtMax()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.booleanisAtMin()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.booleanisBetween(org.wpilib.units.measure.Angle start, org.wpilib.units.measure.Angle end) Between two angles.booleanisGte(org.wpilib.units.measure.Angle angle) Greater than or equal to angle.booleanisLte(org.wpilib.units.measure.Angle angle) Less than or equal to anglebooleanisNear(org.wpilib.units.measure.Angle angle, org.wpilib.units.measure.Angle within) Arm is near an angle.voidIterate simvoidUpdate the mechanism's telemetry.voidUpdates the mechanism ligament with the current angle of the arm.Methods inherited from class SmartPositionalMechanism
getMechanismLigament, getMechanismRoot, getMotorMethods inherited from class SmartMechanism
getMeasurementSetpoint, getMechanismSetpoint, getMechanismWindow, getMotorController, publishMechanismWindow, setDutyCycleSetpoint, setMeasurementPositionSetpoint, setMeasurementVelocitySetpoint, setMechanismPositionSetpoint, setMechanismVelocitySetpoint, setVoltageSetpoint
-
Constructor Details
-
Arm
Constructor for the Arm mechanism.- Parameters:
config-ArmConfigto use.smc-SmartMotorControllerfor the Arm.- Throws:
ArmConfigurationException- if running in simulation and the arm length is not set.ArmConfigurationException- if running in simulation and the lower or upper hard limit is not set.ArmConfigurationException- if running in simulation and neither a starting position nor an external encoder zero offset is set on theSmartMotorControllerConfig.ArmConfigurationException- if running in simulation and the starting position is outside the hard limits.- Implementation Note:
- Protected so only
Armcan construct this.
-
-
Method Details
-
updateTelemetry
public void updateTelemetry()Description copied from class:SmartMechanismUpdate the mechanism's telemetry.- Specified by:
updateTelemetryin classSmartMechanism
-
simIterate
public void simIterate()Description copied from class:SmartMechanismIterate sim- Specified by:
simIteratein classSmartMechanism
-
visualizationUpdate
public void visualizationUpdate()Updates the mechanism ligament with the current angle of the arm.- Specified by:
visualizationUpdatein classSmartMechanism- 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 itsMechanismPositionConfig, turned to the arm's angle about the axis normal to its movement plane.- Specified by:
getPose3din classSmartMechanism- Returns:
- The arm's
Pose3d, relative to the robot.
-
getName
Description copied from class:SmartMechanismGet the name of the mechanism.- Specified by:
getNamein classSmartMechanism- Returns:
Stringname.
-
getAngle
public org.wpilib.units.measure.Angle getAngle()Get theSmartMotorControllerMechanism 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-Angleto be near.within-Anglewithin.- 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:
isAtMaxin classSmartPositionalMechanism- 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:
isAtMinin classSmartPositionalMechanism- 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-Angleto 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
-