Class ClimbSim


public class ClimbSim extends LinearSystemSim<N2,N1,N2>
A specialized simulation for a spring-extended, motor-retracted climber.
  • Constructor Details

    • ClimbSim

      public ClimbSim(DCMotor gearbox, double gearing, double armMassKg, double botMassKg, double drumRadiusMeters, double minHeightMeters, double maxHeightMeters, double springForceNewtons)
      Constructs a new ClimbSim.
      Parameters:
      gearbox - The climber motor gearbox.
      gearing - The total reduction (e.g., 50.0).
      armMassKg - The mass of the extending climber stage.
      botMassKg - The total mass of the robot.
      drumRadiusMeters - The radius of the spool/drum.
      minHeightMeters - The bottom limit (usually 0).
      maxHeightMeters - The height at which the hook catches the bar.
      springForceNewtons - The upward force provided by extension springs.
  • Method Details

    • setState

      public final void setState(double positionMeters, double velocityMetersPerSecond)
      Sets the state of the simulation.
      Parameters:
      positionMeters - The new position in meters.
      velocityMetersPerSecond - The new velocity in meters per second.
    • isHooked

      public boolean isHooked()
      Returns whether the climber has hooked onto the bar.
      Returns:
      True if hooked, false otherwise.
    • getPositionMeters

      public double getPositionMeters()
      Returns the current position of the climber.
      Returns:
      The position in meters.
    • getVelocityMetersPerSecond

      public double getVelocityMetersPerSecond()
      Returns the current velocity of the climber.
      Returns:
      The velocity in meters per second.
    • setInputVoltage

      public void setInputVoltage(double volts)
      Sets the input voltage for the climber motors.
      Parameters:
      volts - The input voltage to apply.
    • getCurrentDrawAmps

      public double getCurrentDrawAmps()
      Returns the simulated current draw of the climber.
      Returns:
      The current draw in amps.
    • updateX

      protected Matrix<N2,N1> updateX(Matrix<N2,N1> currentXhat, Matrix<N1,N1> u, double dtSeconds)
      Overrides:
      updateX in class LinearSystemSim<N2,N1,N2>