mirror of
https://github.com/BroncBotz3481/YAGSL
synced 2026-06-19 06:21:40 +00:00
Update add function
This commit is contained in:
@@ -174,6 +174,9 @@ public class SwerveModule
|
||||
{
|
||||
// Prevents module rotation if speed is less than 1%
|
||||
SwerveMath.antiJitter(desiredState, lastState, configuration.maxSpeed);
|
||||
} else
|
||||
{
|
||||
desiredState.omegaRadPerSecond = 0;
|
||||
}
|
||||
|
||||
if (SwerveDriveTelemetry.verbosity == TelemetryVerbosity.HIGH)
|
||||
@@ -190,18 +193,20 @@ public class SwerveModule
|
||||
if (desiredState.angle != lastState.angle || synchronizeEncoderQueued)
|
||||
{
|
||||
// Synchronize encoders if queued and send in the current position as the value from the absolute encoder.
|
||||
double feedforward = Math.toDegrees(desiredState.omegaRadPerSecond) * configuration.angleKV;
|
||||
System.out.println((float) (Math.toDegrees(0) * configuration.angleKV));
|
||||
if (absoluteEncoder != null && synchronizeEncoderQueued)
|
||||
{
|
||||
double absoluteEncoderPosition = getAbsolutePosition();
|
||||
angleMotor.setPosition(absoluteEncoderPosition);
|
||||
angleMotor.setReference(desiredState.angle.getDegrees(),
|
||||
Math.toDegrees(desiredState.omegaRadPerSecond) * configuration.angleKV,
|
||||
feedforward,
|
||||
absoluteEncoderPosition);
|
||||
synchronizeEncoderQueued = false;
|
||||
} else
|
||||
{
|
||||
angleMotor.setReference(desiredState.angle.getDegrees(),
|
||||
Math.toDegrees(desiredState.omegaRadPerSecond) * configuration.angleKV);
|
||||
feedforward);
|
||||
}
|
||||
}
|
||||
lastState = desiredState;
|
||||
|
||||
Reference in New Issue
Block a user