Class DCMotorSim

java.lang.Object
edu.wpi.first.wpilibj.simulation.LinearSystemSim<N2,N1,N2>
edu.wpi.first.wpilibj.simulation.DCMotorSim

public class DCMotorSim extends LinearSystemSim<N2,N1,N2>
Represents a simulated DC motor mechanism.
  • Constructor Details

  • Method Details

    • setState

      public void setState(double angularPosition, double angularVelocity)
      Sets the state of the DC motor.
      Parameters:
      angularPosition - The new position in radians.
      angularVelocity - The new velocity in radians per second.
    • setAngle

      public void setAngle(double angularPosition)
      Sets the DC motor's angular position.
      Parameters:
      angularPosition - The new position in radians.
    • setAngularVelocity

      public void setAngularVelocity(double angularVelocity)
      Sets the DC motor's angular velocity.
      Parameters:
      angularVelocity - The new velocity in radians per second.
    • getGearing

      public double getGearing()
      Returns the gear ratio of the DC motor.
      Returns:
      the DC motor's gear ratio.
    • getJ

      public double getJ()
      Returns the moment of inertia of the DC motor.
      Returns:
      The DC motor's moment of inertia in kg-m².
    • getGearbox

      public DCMotor getGearbox()
      Returns the gearbox for the DC motor.
      Returns:
      The DC motor's gearbox.
    • getAngularPosition

      public double getAngularPosition()
      Returns the DC motor's position.
      Returns:
      The DC motor's position in radians.
    • getAngularVelocity

      public double getAngularVelocity()
      Returns the DC motor's velocity.
      Returns:
      The DC motor's velocity in radians per second.
    • getAngularAcceleration

      public double getAngularAcceleration()
      Returns the DC motor's acceleration.
      Returns:
      The DC motor's acceleration in rad/s².
    • getTorque

      public double getTorque()
      Returns the DC motor's torque in.
      Returns:
      The DC motor's torque in Newton-meters.
    • getCurrentDraw

      public double getCurrentDraw()
      Returns the DC motor's current draw.
      Returns:
      The DC motor's current draw in amps.
    • getInputVoltage

      public double getInputVoltage()
      Gets the input voltage for the DC motor.
      Returns:
      The DC motor's input voltage.
    • setInputVoltage

      public void setInputVoltage(double volts)
      Sets the input voltage for the DC motor.
      Parameters:
      volts - The input voltage.