Class Pivot
java.lang.Object
yams.core.mechanisms.SmartMechanism
yams.core.mechanisms.positional.SmartPositionalMechanism
yams.core.mechanisms.positional.Pivot
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.
-
Field Summary
Fields inherited from class SmartPositionalMechanism
m_mechanismLigament, m_mechanismRootFields inherited from class SmartMechanism
m_mechanismWindow, m_smc, m_telemetry -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedPivot(PivotConfig config, SmartMotorController smc) Construct the Pivot class -
Method Summary
Modifier and TypeMethodDescriptionorg.wpilib.units.measure.AnglegetAngle()Get theSmartMotorControllerMechanism Position representing the pivot.getName()Get the name of the mechanism.Get thePivotConfigobject for thisPivotorg.wpilib.math.geometry.Pose3dGet the pivot's pose, for publishing to AdvantageScope as a component of a robot model: where it is mounted, as set in itsMechanismPositionConfig, turned to the pivot's angle about the axis normal to its movement plane.booleanisAtMax()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.booleanisAtMin()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.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) Pivot is near an angle.voidIterate simvoidUpdate the mechanism's telemetry.voidUpdates the angle of the mechanism ligament to match the current angle of the pivot.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
-
Pivot
Construct the Pivot class- Parameters:
config- Pivot configuration.smc-SmartMotorControllerdriving the pivot.- Throws:
PivotConfigurationException- if running in simulation and the lower or upper hard limit is not set.PivotConfigurationException- if running in simulation and the starting position is not set on theSmartMotorControllerConfig.PivotConfigurationException- if running in simulation and the starting position is outside the hard limits.- Implementation Note:
- Protected so only
Pivotcan construct this.
-
-
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-Angleto 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 theSmartMotorControllerMechanism 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-Angleto be near.within-Anglewithin.- 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:
isAtMaxin classSmartPositionalMechanism- 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:
isAtMinin classSmartPositionalMechanism- 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:SmartMechanismIterate sim- Specified by:
simIteratein classSmartMechanism
-
updateTelemetry
public void updateTelemetry()Description copied from class:SmartMechanismUpdate the mechanism's telemetry.- Specified by:
updateTelemetryin classSmartMechanism
-
visualizationUpdate
public void visualizationUpdate()Updates the angle of the mechanism ligament to match the current angle of the pivot.- Specified by:
visualizationUpdatein classSmartMechanism
-
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 itsMechanismPositionConfig, turned to the pivot's angle about the axis normal to its movement plane. A turret turns in the XY plane.- Specified by:
getPose3din classSmartMechanism- Returns:
- The pivot's
Pose3d, relative to the robot.
-
getName
Description copied from class:SmartMechanismGet the name of the mechanism.- Specified by:
getNamein classSmartMechanism- Returns:
Stringname.
-
getPivotConfig
Get thePivotConfigobject for thisPivot- Returns:
- The
PivotConfigobject for thisPivot
-