Package edu.wpi.first.wpilibj.simulation
Class FlywheelSim
java.lang.Object
edu.wpi.first.wpilibj.simulation.LinearSystemSim<N1,N1,N1>
edu.wpi.first.wpilibj.simulation.FlywheelSim
Represents a simulated flywheel mechanism.
-
Field Summary
Fields inherited from class edu.wpi.first.wpilibj.simulation.LinearSystemSim
m_measurementStdDevs, m_plant, m_u, m_x, m_y
-
Constructor Summary
ConstructorDescriptionFlywheelSim
(LinearSystem<N1, N1, N1> plant, DCMotor gearbox, double... measurementStdDevs) Creates a simulated flywheel mechanism. -
Method Summary
Modifier and TypeMethodDescriptionReturns the flywheel's acceleration.double
Returns the flywheel's acceleration in Radians Per Second Squared.Returns the flywheel's velocity.double
Returns the flywheel's velocity in Radians Per Second.double
Returns the flywheel's velocity in RPM.double
Returns the flywheel's current draw.Returns the gearbox for the flywheel.double
Returns the gear ratio of the flywheel.double
Gets the input voltage for the flywheel.double
Returns the moment of inertia in kilograms meters squared.double
Returns the flywheel's torque in Newton-Meters.void
setAngularVelocity
(double velocityRadPerSec) Sets the flywheel's angular velocity.void
setInputVoltage
(double volts) Sets the input voltage for the flywheel.
-
Constructor Details
-
FlywheelSim
Creates a simulated flywheel mechanism.- Parameters:
plant
- The linear system that represents the flywheel. Use eitherLinearSystemId.createFlywheelSystem(DCMotor, double, double)
if using physical constants orLinearSystemId.identifyVelocitySystem(double, double)
if using system characterization.gearbox
- The type of and number of motors in the flywheel gearbox.measurementStdDevs
- The standard deviations of the measurements. Can be omitted if no noise is desired. If present must have 1 element for velocity.
-
-
Method Details
-
setAngularVelocity
Sets the flywheel's angular velocity.- Parameters:
velocityRadPerSec
- The new velocity in radians per second.
-
getGearing
Returns the gear ratio of the flywheel.- Returns:
- the flywheel's gear ratio.
-
getJKgMetersSquared
Returns the moment of inertia in kilograms meters squared.- Returns:
- The flywheel's moment of inertia.
-
getGearbox
Returns the gearbox for the flywheel.- Returns:
- The flywheel's gearbox.
-
getAngularVelocityRadPerSec
Returns the flywheel's velocity in Radians Per Second.- Returns:
- The flywheel's velocity in Radians Per Second.
-
getAngularVelocityRPM
Returns the flywheel's velocity in RPM.- Returns:
- The flywheel's velocity in RPM.
-
getAngularVelocity
Returns the flywheel's velocity.- Returns:
- The flywheel's velocity
-
getAngularAccelerationRadPerSecSq
Returns the flywheel's acceleration in Radians Per Second Squared.- Returns:
- The flywheel's acceleration in Radians Per Second Squared.
-
getAngularAcceleration
Returns the flywheel's acceleration.- Returns:
- The flywheel's acceleration.
-
getTorqueNewtonMeters
Returns the flywheel's torque in Newton-Meters.- Returns:
- The flywheel's torque in Newton-Meters.
-
getCurrentDrawAmps
Returns the flywheel's current draw.- Returns:
- The flywheel's current draw.
-
getInputVoltage
Gets the input voltage for the flywheel.- Returns:
- The flywheel's input voltage.
-
setInputVoltage
Sets the input voltage for the flywheel.- Parameters:
volts
- The input voltage.
-