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
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.void
setState(double velocityRadPerSec)
Sets the flywheel's state.Methods inherited from class edu.wpi.first.wpilibj.simulation.LinearSystemSim
clampInput, getOutput, getOutput, setInput, setInput, setInput, setState, update, updateX
-
Constructor Details
-
FlywheelSim
Creates a simulated flywheel mechanism.- Parameters:
plant
- The linear system that represents the flywheel. This system can be created withLinearSystemId.createFlywheelSystem(DCMotor, double, double)
.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
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 Details
-
setState
Sets the flywheel's state.- Parameters:
velocityRadPerSec
- The new velocity in radians per second.
-
getAngularVelocityRadPerSec
Returns the flywheel velocity.- Returns:
- The flywheel velocity.
-
getAngularVelocityRPM
Returns the flywheel velocity in RPM.- Returns:
- The flywheel velocity in RPM.
-
getCurrentDrawAmps
Returns the flywheel current draw.- Overrides:
getCurrentDrawAmps
in classLinearSystemSim<N1,N1,N1>
- Returns:
- The flywheel current draw.
-
setInputVoltage
Sets the input voltage for the flywheel.- Parameters:
volts
- The input voltage.
-