Updated YAGSL

This commit is contained in:
thenetworkgrinch
2023-02-22 20:50:16 -06:00
parent 8bfa4a8824
commit dd7d432e90
111 changed files with 497 additions and 276 deletions

View File

@@ -11,6 +11,7 @@ import swervelib.math.SwerveModuleState2;
public class SwerveModuleSimulation
{
/**
* Main timer to simulate the passage of time.
*/
@@ -59,11 +60,12 @@ public class SwerveModuleSimulation
public void updateStateAndPosition(SwerveModuleState2 desiredState)
{
dt = timer.get() - lastTime;
fakePos += (fakeSpeed * dt);
lastTime = timer.get();
state = desiredState;
fakeSpeed = desiredState.speedMetersPerSecond;
fakePos += (fakeSpeed * dt);
}
/**
@@ -73,6 +75,7 @@ public class SwerveModuleSimulation
*/
public SwerveModulePosition getPosition()
{
return new SwerveModulePosition(
fakePos, state.angle.plus(new Rotation2d(state.omegaRadPerSecond * dt)));
}