Package yams.mechanisms.velocity
Class FlyWheel
java.lang.Object
yams.mechanisms.SmartMechanism
yams.mechanisms.velocity.SmartVelocityMechanism
yams.mechanisms.velocity.FlyWheel
FlyWheel mechanism.
-
Field Summary
Fields inherited from class yams.mechanisms.velocity.SmartVelocityMechanism
mechanismLigament, mechanismRootFields inherited from class yams.mechanisms.SmartMechanism
m_mechanismWindow, m_smc, m_subsystem, m_telemetry -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbetween(AngularVelocity start, AngularVelocity end) Between two velocities.Get theLinearVelocityof the FlyWheel.Deprecated.Mechanism velocity setpoint.getName()Get the name of the mechanism.Get the relative position of the mechanism, taking into account the relative position defined in theMechanismPositionConfig.Get theFlyWheelConfigobject for thisFlyWheelgetSpeed()Get theSmartMotorControllerMechanism velocity representing the FlyWheel.gte(AngularVelocity speed) Greater than or equal to angular velocity.isNear(AngularVelocity speed, AngularVelocity within) FlyWheel is near a speed.lte(AngularVelocity speed) Less than or equal to angular velocitymax()SmartVelocityMechanismis at max, defined by the soft limit or hard limit on theSmartVelocityMechanism.min()Minimum angle of theSmartVelocityMechanismgiven by the soft limit or hard limit of theSmartVelocityMechanism.run(AngularVelocity velocity) Set the FlyWheel to the given speed.run(LinearVelocity speed) Set the FlyWheel to the given speed.<T> CommandRun the FlyWheel to a given velocityrunTo(AngularVelocity velocity, AngularVelocity tolerance) Run the FlyWheel to a velocity within a tolerance, then end the command.runTo(LinearVelocity velocity, LinearVelocity tolerance) Run the FlyWheel to a velocity within a tolerance then end the command.runTo(Supplier<AngularVelocity> velocity, AngularVelocity tolerance) Run the FlyWheel to a velocity within a tolerance, then end the command.runTo(Supplier<LinearVelocity> velocity, LinearVelocity tolerance) Run the FlyWheel to a velocity within a tolerance then end the command.voidsetMeasurementPositionSetpoint(Distance distance) Deprecated.voidSet the FlyWheel to the given speed.setSpeed(AngularVelocity velocity) Set the FlyWheel to the given speed.setSpeed(Supplier<AngularVelocity> velocity) Set the FlyWheel to the given speed.voidIterate simsysId(Voltage maximumVoltage, Velocity<VoltageUnit> step, Time duration) Create the SysId routine and commands to run the SysId tests.voidUpdate the mechanism's telemetry.voidUpdates the angle of the mechanism ligament to match the current angle of the FlyWheel.Methods inherited from class yams.mechanisms.velocity.SmartVelocityMechanism
getMechanismLigament, getMechanismRoot, getMotorMethods inherited from class yams.mechanisms.SmartMechanism
gearbox, gearbox, gearing, gearing, getMechanismWindow, getMotorController, set, set, setDutyCycleSetpoint, setMechanismPositionSetpoint, setMechanismVelocitySetpoint, setVoltage, setVoltage, setVoltageSetpoint, sprocket, sprocket
-
Constructor Details
-
FlyWheel
Construct the FlyWheel class- Parameters:
config- FlyWheel configuration.
-
-
Method Details
-
between
Between two velocities.- Parameters:
start- Start Velocity.end- End velocity- Returns:
Trigger
-
gte
Greater than or equal to angular velocity.- Parameters:
speed-AngularVelocityto check against.- Returns:
Triggerfor FlyWheel.
-
lte
Less than or equal to angular velocity- Parameters:
speed-AngularVelocityto check against- Returns:
Trigger
-
getSpeed
Get theSmartMotorControllerMechanism velocity representing the FlyWheel.- Returns:
- FlyWheel
AngularVelocity
-
getLinearVelocity
Get theLinearVelocityof the FlyWheel.- Returns:
- FlyWheel
LinearVelocity
-
isNear
FlyWheel is near a speed.- Parameters:
speed-AngularVelocityto be near.within-AngularVelocitywithin.- Returns:
- Trigger on when the FlyWheel is near another speed.
-
setSpeed
Set the FlyWheel to the given speed.- Parameters:
velocity- FlyWheel speed to go to.- Returns:
Commandthat sets the FlyWheel to the desired speed.
-
setSpeed
Set the FlyWheel to the given speed.- Parameters:
velocity- FlyWheel speed to go to.- Returns:
Commandthat sets the FlyWheel to the desired speed.
-
run
Run the FlyWheel to a given velocity- Type Parameters:
T- Must be aLinearVelocityorAngularVelocity- Parameters:
velocity-SupplierofLinearVelocityorAngularVelocity- Returns:
RunCommandwhich runs the FlyWheel to the desired velocity with the closed loop controller.
-
run
Set the FlyWheel to the given speed.- Parameters:
velocity- FlyWheel speed to go to.- Returns:
Commandthat sets the FlyWheel to the desired speed.
-
runTo
Run the FlyWheel to a velocity within a tolerance, then end the command.- Parameters:
velocity-SupplierofAngularVelocitytolerance-AngularVelocitytolerance- Returns:
Commandthat runs the FlyWheel to the desired velocity then moves on.- Implementation Note:
- If you are using this function, try not to have a default command or else the default command will override the setting after this command ends.
-
runTo
Run the FlyWheel to a velocity within a tolerance, then end the command.- Parameters:
velocity-AngularVelocityto go to.tolerance-AngularVelocitytolerance- Returns:
Commandthat runs the FlyWheel to the desired velocity then moves on.- Implementation Note:
- If you are using this function, try not to have a default command or else the default command will override the setting after this command ends.
-
runTo
Run the FlyWheel to a velocity within a tolerance then end the command.- Parameters:
velocity-LinearVelocityto go to.tolerance-LinearVelocitytolerance- Returns:
Commandthat runs the FlyWheel to the desired velocity then moves on.- Implementation Note:
- If you are using this function, try not to have a default command or else the default command will override the setting after this command ends.
-
runTo
Run the FlyWheel to a velocity within a tolerance then end the command.- Parameters:
velocity-LinearVelocityto go to.tolerance-LinearVelocitytolerance- Returns:
Commandthat runs the FlyWheel to the desired velocity then moves on.- Implementation Note:
- If you are using this function, try not to have a default command or else the default command will override the setting after this command ends.
-
run
Set the FlyWheel to the given speed.- Parameters:
speed- FlyWheel speed to go to.- Returns:
Commandthat sets the FlyWheel to the desired speed.
-
getMechanismSetpointVelocity
Mechanism velocity setpoint.- Returns:
AngularVelocitysetpoint of the FlyWheel.
-
getMechanismSetpoint
Deprecated.Description copied from class:SmartMechanismGet theSmartMechanism's setpoint as anAngleif it exists.- Overrides:
getMechanismSetpointin classSmartMechanism- Returns:
OptionalsetpointAngleof the mechanism..
-
setMeasurementVelocitySetpoint
Set the FlyWheel to the given speed.- Overrides:
setMeasurementVelocitySetpointin classSmartMechanism- Parameters:
speed-LinearVelocityto go to.
-
setMeasurementPositionSetpoint
Deprecated.Description copied from class:SmartMechanismSets theSmartMotorControllerto the given distance.- Overrides:
setMeasurementPositionSetpointin classSmartMechanism- Parameters:
distance-Distanceto go to.
-
max
Description copied from class:SmartVelocityMechanismSmartVelocityMechanismis at max, defined by the soft limit or hard limit on theSmartVelocityMechanism.- Specified by:
maxin classSmartVelocityMechanism- Returns:
- Maximum angle for the
SmartVelocityMechanism.
-
min
Description copied from class:SmartVelocityMechanismMinimum angle of theSmartVelocityMechanismgiven by the soft limit or hard limit of theSmartVelocityMechanism.- Specified by:
minin classSmartVelocityMechanism- Returns:
Triggeron minimum of theSmartVelocityMechanism.
-
sysId
Description copied from class:SmartVelocityMechanismCreate the SysId routine and commands to run the SysId tests. The SysId test will run the mechanism up then down at a constant speed, then run the mechanism up at an increasing speed and down at an increasing speed. Requires the maximum and minimum limit to be set. Runs the mechanism within 1 degree of the maximum and minimum.- Specified by:
sysIdin classSmartVelocityMechanism- Parameters:
maximumVoltage- MaximumVoltageto give to theSmartVelocityMechanism, is the voltage given to run theSmartVelocityMechanismup at a static speed.step- StepVoltageto give to theSmartVelocityMechanism.duration- SysId test duration.- Returns:
SequentialCommandGrouprunning the SysId commands.
-
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 FlyWheel.- Specified by:
visualizationUpdatein classSmartMechanism
-
getRelativeMechanismPosition
Get the relative position of the mechanism, taking into account the relative position defined in theMechanismPositionConfig.- Specified by:
getRelativeMechanismPositionin classSmartMechanism- Returns:
- The relative position of the mechanism as a
Translation3d.
-
getName
Description copied from class:SmartMechanismGet the name of the mechanism.- Specified by:
getNamein classSmartMechanism- Returns:
Stringname.
-
getShooterConfig
Get theFlyWheelConfigobject for thisFlyWheel- Returns:
- The
FlyWheelConfigobject for thisFlyWheel
-