Package frc.robot.sim

Class SimPosition

java.lang.Object
frc.robot.sim.SimPosition

public class SimPosition extends Object
Simple position and velocity simulator for mechanism motion.

This class models a 1D mechanism using a proportional position controller with configurable velocity and acceleration limits. It is intended for lightweight simulation of mechanism motion where full physics modeling is unnecessary.

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    double
    Current simulated position.
    double
    Current simulated velocity.
  • Constructor Summary

    Constructors
    Constructor
    Description
    SimPosition(double kp, double maxVelocity, double maxAccel)
    Creates a new position simulator.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    update(double target)
    Advances the simulation one timestep toward the given target position.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • position

      public double position
      Current simulated position.
    • velocity

      public double velocity
      Current simulated velocity.
  • Constructor Details

    • SimPosition

      public SimPosition(double kp, double maxVelocity, double maxAccel)
      Creates a new position simulator.
      Parameters:
      kp - proportional gain applied to position error
      maxVelocity - maximum allowed velocity
      maxAccel - maximum allowed acceleration
  • Method Details

    • update

      public void update(double target)
      Advances the simulation one timestep toward the given target position.