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
ConstructorsConstructorDescriptionFlywheelSim
(LinearSystem<N1, N1, N1> plant, DCMotor gearbox, double... measurementStdDevs) Creates a simulated flywheel mechanism. -
Method Summary
Modifier and TypeMethodDescriptiondouble
Returns the flywheel's acceleration.double
Returns the flywheel's velocity.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
getJ()
Returns the moment of inertia.double
Returns the flywheel's torque.void
setAngularVelocity
(double velocity) 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:
velocity
- The new velocity in radians per second.
-
getGearing
Returns the gear ratio of the flywheel.- Returns:
- the flywheel's gear ratio.
-
getJ
Returns the moment of inertia.- Returns:
- The flywheel's moment of inertia in kg-m².
-
getGearbox
Returns the gearbox for the flywheel.- Returns:
- The flywheel's gearbox.
-
getAngularVelocity
Returns the flywheel's velocity.- Returns:
- The flywheel's velocity in rad/s.
-
getAngularAcceleration
Returns the flywheel's acceleration.- Returns:
- The flywheel's acceleration in rad/s².
-
getTorque
Returns the flywheel's torque.- Returns:
- The flywheel's torque in Newton-meters.
-
getCurrentDraw
Returns the flywheel's current draw.- Returns:
- The flywheel's current draw in amps.
-
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.
-