Package tagalong.subsystems.micro
Class Elevator
java.lang.Object
tagalong.subsystems.micro.Microsystem
tagalong.subsystems.micro.Elevator
Elevator Microsystem
-
Field Summary
FieldsModifier and TypeFieldDescriptionfinal doubleDefault lower tolerance of the elevator in meters, Default upper tolerance of the elevator in metersfinal doubleDefault lower tolerance of the elevator in meters, Default upper tolerance of the elevator in metersprotected MechanismLigament2dBase stage ligamentfinal ElevatorConfConfiguration for the elevatorprotected ElevatorFeedforwardFeedforward model for the elevatorfinal doubleMinimum height of the elevator in meters, Maximum height of the elevator in metersfinal doubleMinimum height of the elevator in meters, Maximum height of the elevator in metersprotected ElevatorSimSimulation for the elevatorprotected MechanismLigament2dStage 1 ligamentfinal doubleDuration of stalling in seconds necessary for the elevator zero command to finishfinal doublePower for zeroing the elevatorfinal doublePositional tolerance in meters for zeroing the elevatorfinal doubleMaximum velocity of the elevator in meters per second, Maximum acceleration of the elevator in meters per second squaredfinal doubleMaximum velocity of the elevator in meters per second, Maximum acceleration of the elevator in meters per second squaredprotected final doubleRatio between motor rotations and drum rotationsprotected booleanWhether or not the primary motor is invertedprotected doubleVelocity of the simulated elevator in meters per secondFields inherited from class tagalong.subsystems.micro.Microsystem
_allMotors, _conf, _configuredMicrosystemDisable, _currentPositionEntry, _currentVelocityEntry, _curState, _followProfile, _goalState, _isFFTuningMicro, _isMicrosystemDisabled, _isPIDTuningMicro, _isShuffleboardMicro, _KAEntry, _KGEntry, _KSEntry, _KVEntry, _mechanism, _primaryMotor, _primaryMotorSim, _profileTimer, _requestedPositionVoltage, _requestedTorqueCurrent, _requestedVelocityVoltage, _root, _slot0DFactorEntry, _slot0IFactorEntry, _slot0PFactorEntry, _slot1DFactorEntry, _slot1IFactorEntry, _slot1PFactorEntry, _slot2DFactorEntry, _slot2IFactorEntry, _slot2PFactorEntry, _targetPositionEntry, _targetVelocityEntry, _toleranceTimer, _trapProfile, _tuningTabCounter -
Constructor Summary
ConstructorsConstructorDescriptionElevator(ElevatorConf conf) Constructs an elevator microsystem with the below configurations -
Method Summary
Modifier and TypeMethodDescriptiondoubleclampElevatorPosition(double target) Clamps the elevator position to be within height limitsvoidConfigures devicesvoidConfigure shuffleboard for the elevatorvoidCalculates the next state according to the trapezoidal profile and requests the elevator motor(s) to arrive at the next position with feedforwardRetrieves base stage ligament attached to elevator Mechanism2ddoubleGets the height of the elevator in metersRetrieves stage 1 ligament attached to elevator Mechanism2ddoubleGets the velocity of the elevator in meters per secondvoidSets the power of the primary motor to zerobooleanisElevatorInTolerance(double lowerBound, double upperBound) Bounds checking function that uses the current elevator positionbooleanChecks whether or not it's safe for the elevator to movedoublemetersToMotor(double meter) Converts elevator height to motor rotationsdoublemotorToMeters(double rotation) Converts motor rotations to elevator heightvoidreturns nothing if micro system is disabledvoidonEnable()Sets break mode for all motors If system is in PID tuning mode is updates all PID related settings If the system is in Feedforward Tuning mode, it sets the primary motor to coast mode.voidperiodic()Periodic update functionvoidsetElevatorHeight(double height) Sets the position of the elevator in metersvoidsetElevatorProfile(double goalPositionM) Creates a new trapezoidal profile for the elevator to followvoidsetElevatorProfile(double goalPositionM, double goalVelocityMPS) Creates a new trapezoidal profile for the elevatorvoidsetElevatorProfile(double goalPositionM, double goalVelocityMPS, double maxVelocityMPS) Creates a new trapezoidal profile for the elevatorvoidsetElevatorProfile(double goalPositionM, double goalVelocityMPS, double maxVelocityMPS, double maxAccelerationMPS2) Creates a new trapezoidal profile for the elevatorvoidsetElevatorProfile(double goalPositionM, double goalVelocityMPS, double maxVelocityMPS, double maxAccelerationMPS2, boolean setCurrentState) Creates a new trapezoidal profile for the elevatorvoidsetElevatorProfile(Height goalPosition) Creates a new trapezoidal profile for the elevator to followvoidsetElevatorProfile(Height goalPosition, double goalVelocityMPS) Creates a new trapezoidal profile for the elevator to followvoidsetElevatorProfile(Height goalPosition, double goalVelocityMPS, double maxVelocityMPS) Creates a new trapezoidal profile for the elevator to followvoidsetElevatorProfile(Height goalPosition, double goalVelocityMPS, double maxVelocityMPS, double maxAccelerationMPS2) Creates a new trapezoidal profile for the elevator to followvoidsetElevatorProfile(Height goalPosition, double goalVelocityMPS, double maxVelocityMPS, double maxAccelerationMPS2, boolean setCurrentState) Creates a new trapezoidal profile for the elevator to followvoidsetElevatorVelocity(double mps, boolean withFF) Sets the velocity of the elevator in MPSvoidInitializes simulationvoidPeriodic function during simulationvoidUpdates shuffleboardMethods inherited from class tagalong.subsystems.micro.Microsystem
checkInitStatus, checkToleranceTime, configTuningModes, disableMicrosystem, getPrimaryMotor, getPrimaryMotorPosition, getPrimaryMotorPower, getPrimaryMotorVelocity, getRoot, isProfileFinished, motorResetConfig, onTeleopDisable, resetToleranceTimer, setBrakeMode, setFollowProfile, setHoldPosition, setPrimaryPower, updateAllPIDSGVA, waitForInitialization
-
Field Details
-
_elevatorConf
Configuration for the elevator -
_motorToMechRatio
Ratio between motor rotations and drum rotations -
_elevatorMinHeightM
Minimum height of the elevator in meters, Maximum height of the elevator in meters -
_elevatorMaxHeightM
Minimum height of the elevator in meters, Maximum height of the elevator in meters -
_maxVelocityMPS
Maximum velocity of the elevator in meters per second, Maximum acceleration of the elevator in meters per second squared -
_maxAccelerationMPS2
Maximum velocity of the elevator in meters per second, Maximum acceleration of the elevator in meters per second squared -
_defaultElevatorLowerToleranceM
Default lower tolerance of the elevator in meters, Default upper tolerance of the elevator in meters -
_defaultElevatorUpperToleranceM
Default lower tolerance of the elevator in meters, Default upper tolerance of the elevator in meters -
_elevatorZeroingPower
Power for zeroing the elevator -
_elevatorZeroingStallToleranceM
Positional tolerance in meters for zeroing the elevator -
_elevatorZeroingDurationS
Duration of stalling in seconds necessary for the elevator zero command to finish -
_elevatorFF
Feedforward model for the elevator -
_elevatorSim
Simulation for the elevator -
_elevatorBaseStageLigament
Base stage ligament -
_elevatorStage1Ligament
Stage 1 ligament -
_simVelocityMPS
Velocity of the simulated elevator in meters per second -
_primaryMotorInverted
Whether or not the primary motor is inverted
-
-
Constructor Details
-
Elevator
Constructs an elevator microsystem with the below configurations- Parameters:
conf- Configuration for the elevator
-
-
Method Details
-
configAllDevices
Description copied from class:MicrosystemConfigures devices- Overrides:
configAllDevicesin classMicrosystem
-
followLastProfile
Calculates the next state according to the trapezoidal profile and requests the elevator motor(s) to arrive at the next position with feedforward -
setElevatorProfile
Creates a new trapezoidal profile for the elevator to follow- Parameters:
goalPosition- goal position in meters
-
setElevatorProfile
Creates a new trapezoidal profile for the elevator to follow- Parameters:
goalPosition- goal position in metersgoalVelocityMPS- goal velocity in meters per second
-
setElevatorProfile
Creates a new trapezoidal profile for the elevator to follow- Parameters:
goalPosition- goal position in metersgoalVelocityMPS- goal velocity in meters per secondmaxVelocityMPS- maximum velocity in meters per second
-
setElevatorProfile
public void setElevatorProfile(Height goalPosition, double goalVelocityMPS, double maxVelocityMPS, double maxAccelerationMPS2) Creates a new trapezoidal profile for the elevator to follow- Parameters:
goalPosition- goal position in metersgoalVelocityMPS- goal velocity in meters per secondmaxVelocityMPS- maximum velocity in meters per secondmaxAccelerationMPS2- maximum acceleration in meters per second squared
-
setElevatorProfile
public void setElevatorProfile(Height goalPosition, double goalVelocityMPS, double maxVelocityMPS, double maxAccelerationMPS2, boolean setCurrentState) Creates a new trapezoidal profile for the elevator to follow- Parameters:
goalPosition- goal position in metersgoalVelocityMPS- goal velocity in meters per secondmaxVelocityMPS- maximum velocity in meters per secondmaxAccelerationMPS2- maximum acceleration in meters per second squaredsetCurrentState- True if the profiles current state should base itself off sensor values rather than continue from the existing state
-
setElevatorProfile
Creates a new trapezoidal profile for the elevator to follow- Parameters:
goalPositionM- goal position in meters
-
setElevatorProfile
Creates a new trapezoidal profile for the elevator- Parameters:
goalPositionM- The goal position to reach, in metersgoalVelocityMPS- The goal velocity to reach, in meters per second
-
setElevatorProfile
Creates a new trapezoidal profile for the elevator- Parameters:
goalPositionM- The goal position to reach, in metersgoalVelocityMPS- The goal velocity to reach, in meters per secondmaxVelocityMPS- The maximum velocity, in meters per second
-
setElevatorProfile
public void setElevatorProfile(double goalPositionM, double goalVelocityMPS, double maxVelocityMPS, double maxAccelerationMPS2) Creates a new trapezoidal profile for the elevator- Parameters:
goalPositionM- The goal position to reach, in metersgoalVelocityMPS- The goal velocity to reach, in meters per secondmaxVelocityMPS- The maximum velocity, in meters per secondmaxAccelerationMPS2- The maximum acceleration, in meters per second squared
-
setElevatorProfile
public void setElevatorProfile(double goalPositionM, double goalVelocityMPS, double maxVelocityMPS, double maxAccelerationMPS2, boolean setCurrentState) Creates a new trapezoidal profile for the elevator- Parameters:
goalPositionM- The goal position to reach, in metersgoalVelocityMPS- The goal velocity to reach, in meters per secondmaxVelocityMPS- The maximum velocity, in meters per secondmaxAccelerationMPS2- The maximum acceleration, in meters per second squaredsetCurrentState- True if the profiles current state should base itself off sensor values rather than continue from the existing state
-
getElevatorHeightM
Gets the height of the elevator in meters- Returns:
- height in meters
-
getElevatorVelocityMPS
Gets the velocity of the elevator in meters per second- Returns:
- velocity in meters per second
-
setElevatorVelocity
Sets the velocity of the elevator in MPS- Parameters:
mps- Desired velocity in meters per secondwithFF- with feedforward
-
clampElevatorPosition
Clamps the elevator position to be within height limits- Parameters:
target- goal position of the elevator in meters- Returns:
- clamped goal position in meters
-
onEnable
Description copied from class:MicrosystemSets break mode for all motors If system is in PID tuning mode is updates all PID related settings If the system is in Feedforward Tuning mode, it sets the primary motor to coast mode.- Overrides:
onEnablein classMicrosystem
-
onDisable
Description copied from class:Microsystemreturns nothing if micro system is disabled- Overrides:
onDisablein classMicrosystem
-
periodic
Description copied from class:MicrosystemPeriodic update function- Overrides:
periodicin classMicrosystem
-
simulationInit
Description copied from class:MicrosystemInitializes simulation- Overrides:
simulationInitin classMicrosystem
-
simulationPeriodic
Description copied from class:MicrosystemPeriodic function during simulation- Overrides:
simulationPeriodicin classMicrosystem
-
updateShuffleboard
Description copied from class:MicrosystemUpdates shuffleboard- Overrides:
updateShuffleboardin classMicrosystem
-
configShuffleboard
Configure shuffleboard for the elevator- Overrides:
configShuffleboardin classMicrosystem
-
motorToMeters
Converts motor rotations to elevator height- Parameters:
rotation- motor position in rotations- Returns:
- elevator position in meters
-
metersToMotor
Converts elevator height to motor rotations- Parameters:
meter- elevator position in meters- Returns:
- motor position in rotations
-
isSafeToMove
Checks whether or not it's safe for the elevator to move- Returns:
- whether or not it's safe to move
-
isElevatorInTolerance
Bounds checking function that uses the current elevator position- Parameters:
lowerBound- minimum of acceptable rangeupperBound- maximum of acceptable range- Returns:
- if the current position is in specified acceptable range
-
setElevatorHeight
Sets the position of the elevator in meters- Parameters:
height- goal position in meters
-
holdCurrentPosition
Description copied from class:MicrosystemSets the power of the primary motor to zero- Overrides:
holdCurrentPositionin classMicrosystem
-
getElevatorBaseStageLigament
Retrieves base stage ligament attached to elevator Mechanism2d- Returns:
- elevator base stage ligament
-
getElevatorStage1Ligament
Retrieves stage 1 ligament attached to elevator Mechanism2d- Returns:
- elevator stage 1 ligament
-