Class FlywheelSim
Represents a simulated flywheel mechanism.
-
Field Summary
Fields inherited from class 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 TypeMethodDescriptiondoubleReturns the flywheel's acceleration.doubleReturns the flywheel's velocity.doubleReturns the flywheel's current draw.Returns the gearbox for the flywheel.doubleReturns the gear ratio of the flywheel.doubleGets the input voltage for the flywheel.doublegetJ()Returns the moment of inertia.doubleReturns the flywheel's torque.voidsetAngularVelocity(double velocity) Sets the flywheel's angular velocity.voidsetInputVoltage(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 eitherModels.flywheelFromPhysicalConstants(DCMotor, double, double)if using physical constants orModels.flywheelFromSysId(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
public void setAngularVelocity(double velocity) Sets the flywheel's angular velocity.- Parameters:
velocity- The new velocity in radians per second.
-
getGearing
public double getGearing()Returns the gear ratio of the flywheel.- Returns:
- the flywheel's gear ratio.
-
getJ
public double getJ()Returns the moment of inertia.- Returns:
- The flywheel's moment of inertia in kg-m².
-
getGearbox
-
getAngularVelocity
public double getAngularVelocity()Returns the flywheel's velocity.- Returns:
- The flywheel's velocity in rad/s.
-
getAngularAcceleration
public double getAngularAcceleration()Returns the flywheel's acceleration.- Returns:
- The flywheel's acceleration in rad/s².
-
getTorque
public double getTorque()Returns the flywheel's torque.- Returns:
- The flywheel's torque in Newton-meters.
-
getCurrentDraw
public double getCurrentDraw()Returns the flywheel's current draw.- Returns:
- The flywheel's current draw in amps.
-
getInputVoltage
public double getInputVoltage()Gets the input voltage for the flywheel.- Returns:
- The flywheel's input voltage.
-
setInputVoltage
public void setInputVoltage(double volts) Sets the input voltage for the flywheel.- Parameters:
volts- The input voltage.
-