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 angularPositionRad, double angularVelocityRadPerSec)
      Sets the state of the DC motor.
      Parameters:
      angularPositionRad - The new position in radians.
      angularVelocityRadPerSec - The new velocity in radians per second.
    • setAngle

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

      public void setAngularVelocity(double angularVelocityRadPerSec)
      Sets the DC motor's angular velocity.
      Parameters:
      angularVelocityRadPerSec - 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.
    • getJKgMetersSquared

      public double getJKgMetersSquared()
      Returns the moment of inertia of the DC motor.
      Returns:
      The DC motor's moment of inertia.
    • getGearbox

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

      public double getAngularPositionRad()
      Returns the DC motor's position.
      Returns:
      The DC motor's position.
    • getAngularPositionRotations

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

      Returns the DC motor's position.
      Returns:
      The DC motor's position
    • getAngularVelocityRadPerSec

      public double getAngularVelocityRadPerSec()
      Returns the DC motor's velocity.
      Returns:
      The DC motor's velocity.
    • getAngularVelocityRPM

      public double getAngularVelocityRPM()
      Returns the DC motor's velocity in RPM.
      Returns:
      The DC motor's velocity in RPM.
    • getAngularVelocity

      Returns the DC motor's velocity.
      Returns:
      The DC motor's velocity
    • getAngularAccelerationRadPerSecSq

      Returns the DC motor's acceleration in Radians Per Second Squared.
      Returns:
      The DC motor's acceleration in Radians Per Second Squared.
    • getAngularAcceleration

      Returns the DC motor's acceleration.
      Returns:
      The DC motor's acceleration.
    • getTorqueNewtonMeters

      public double getTorqueNewtonMeters()
      Returns the DC motor's torque in Newton-Meters.
      Returns:
      The DC motor's torque in Newton-Meters.
    • getCurrentDrawAmps

      public double getCurrentDrawAmps()
      Returns the DC motor's current draw.
      Returns:
      The DC motor's current draw.
    • 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.