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
-
public class FlywheelSim extends LinearSystemSim<N1,N1,N1>
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
Constructors Constructor Description FlywheelSim(LinearSystem<N1,N1,N1> plant, DCMotor gearbox, double gearing)
Creates a simulated flywheel mechanism.FlywheelSim(LinearSystem<N1,N1,N1> plant, DCMotor gearbox, double gearing, Matrix<N1,N1> measurementStdDevs)
Creates a simulated flywheel mechanism.FlywheelSim(DCMotor gearbox, double gearing, double jKgMetersSquared)
Creates a simulated flywheel mechanism.FlywheelSim(DCMotor gearbox, double gearing, double jKgMetersSquared, Matrix<N1,N1> measurementStdDevs)
Creates a simulated flywheel mechanism.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description double
getAngularVelocityRadPerSec()
Returns the flywheel velocity.double
getAngularVelocityRPM()
Returns the flywheel velocity in RPM.double
getCurrentDrawAmps()
Returns the flywheel current draw.void
setInputVoltage(double volts)
Sets the input voltage for the flywheel.-
Methods inherited from class edu.wpi.first.wpilibj.simulation.LinearSystemSim
clampInput, getOutput, getOutput, setInput, setInput, setInput, setState, update, updateX
-
-
-
-
Constructor Detail
-
FlywheelSim
public FlywheelSim(LinearSystem<N1,N1,N1> plant, DCMotor gearbox, double gearing)
Creates a simulated flywheel mechanism.- Parameters:
plant
- The linear system that represents the flywheel.gearbox
- The type of and number of motors in the flywheel gearbox.gearing
- The gearing of the flywheel (numbers greater than 1 represent reductions).
-
FlywheelSim
public FlywheelSim(LinearSystem<N1,N1,N1> plant, DCMotor gearbox, double gearing, Matrix<N1,N1> measurementStdDevs)
Creates a simulated flywheel mechanism.- Parameters:
plant
- The linear system that represents the flywheel.gearbox
- The type of and number of motors in the flywheel gearbox.gearing
- The gearing of the flywheel (numbers greater than 1 represent reductions).measurementStdDevs
- The standard deviations of the measurements.
-
FlywheelSim
public FlywheelSim(DCMotor gearbox, double gearing, double jKgMetersSquared)
Creates a simulated flywheel mechanism.- Parameters:
gearbox
- The type of and number of motors in the flywheel gearbox.gearing
- The gearing of the flywheel (numbers greater than 1 represent reductions).jKgMetersSquared
- The moment of inertia of the flywheel. If this is unknown, use theFlywheelSim(LinearSystem, DCMotor, double, Matrix)
constructor.
-
FlywheelSim
public FlywheelSim(DCMotor gearbox, double gearing, double jKgMetersSquared, Matrix<N1,N1> measurementStdDevs)
Creates a simulated flywheel mechanism.- Parameters:
gearbox
- The type of and number of motors in the flywheel gearbox.gearing
- The gearing of the flywheel (numbers greater than 1 represent reductions).jKgMetersSquared
- The moment of inertia of the flywheel. If this is unknown, use theFlywheelSim(LinearSystem, DCMotor, double, Matrix)
constructor.measurementStdDevs
- The standard deviations of the measurements.
-
-
Method Detail
-
getAngularVelocityRadPerSec
public double getAngularVelocityRadPerSec()
Returns the flywheel velocity.- Returns:
- The flywheel velocity.
-
getAngularVelocityRPM
public double getAngularVelocityRPM()
Returns the flywheel velocity in RPM.- Returns:
- The flywheel velocity in RPM.
-
getCurrentDrawAmps
public double getCurrentDrawAmps()
Returns the flywheel current draw.- Overrides:
getCurrentDrawAmps
in classLinearSystemSim<N1,N1,N1>
- Returns:
- The flywheel current draw.
-
setInputVoltage
public void setInputVoltage(double volts)
Sets the input voltage for the flywheel.- Parameters:
volts
- The input voltage.
-
-