Package frc.robot.sim
Class SimPosition
java.lang.Object
frc.robot.sim.SimPosition
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 -
Constructor Summary
ConstructorsConstructorDescriptionSimPosition(double kp, double maxVelocity, double maxAccel) Creates a new position simulator. -
Method Summary
Modifier and TypeMethodDescriptionvoidupdate(double target) Advances the simulation one timestep toward the given target position.
-
Field Details
-
position
public double positionCurrent simulated position. -
velocity
public double velocityCurrent 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 errormaxVelocity- maximum allowed velocitymaxAccel- maximum allowed acceleration
-
-
Method Details
-
update
public void update(double target) Advances the simulation one timestep toward the given target position.
-