mirror of
https://github.com/BroncBotz3481/YAGSL
synced 2026-06-19 06:21:40 +00:00
Fixed NetworkAlerts
This commit is contained in:
@@ -11,7 +11,6 @@ import edu.wpi.first.math.geometry.Rotation3d;
|
||||
import edu.wpi.first.math.geometry.Transform2d;
|
||||
import edu.wpi.first.math.geometry.Translation2d;
|
||||
import edu.wpi.first.math.geometry.Translation3d;
|
||||
import edu.wpi.first.math.geometry.Twist2d;
|
||||
import edu.wpi.first.math.kinematics.ChassisSpeeds;
|
||||
import edu.wpi.first.math.kinematics.SwerveDriveKinematics;
|
||||
import edu.wpi.first.math.kinematics.SwerveModulePosition;
|
||||
@@ -67,6 +66,10 @@ public class SwerveDrive
|
||||
* Odometry lock to ensure thread safety.
|
||||
*/
|
||||
private final Lock odometryLock = new ReentrantLock();
|
||||
/**
|
||||
* Deadband for speeds in heading correction.
|
||||
*/
|
||||
private final double HEADING_CORRECTION_DEADBAND = 0.01;
|
||||
/**
|
||||
* Field object.
|
||||
*/
|
||||
@@ -100,14 +103,14 @@ public class SwerveDrive
|
||||
* correction.
|
||||
*/
|
||||
public boolean chassisVelocityCorrection = true;
|
||||
/**
|
||||
* Whether heading correction PID is currently active.
|
||||
*/
|
||||
private boolean correctionEnabled = false;
|
||||
/**
|
||||
* Whether to correct heading when driving translationally. Set to true to enable.
|
||||
*/
|
||||
public boolean headingCorrection = false;
|
||||
/**
|
||||
* Whether heading correction PID is currently active.
|
||||
*/
|
||||
private boolean correctionEnabled = false;
|
||||
/**
|
||||
* Swerve IMU device for sensing the heading of the robot.
|
||||
*/
|
||||
@@ -120,10 +123,6 @@ public class SwerveDrive
|
||||
* Counter to synchronize the modules relative encoder with absolute encoder when not moving.
|
||||
*/
|
||||
private int moduleSynchronizationCounter = 0;
|
||||
/**
|
||||
* Deadband for speeds in heading correction.
|
||||
*/
|
||||
private final double HEADING_CORRECTION_DEADBAND = 0.01;
|
||||
/**
|
||||
* The last heading set in radians.
|
||||
*/
|
||||
@@ -413,10 +412,10 @@ public class SwerveDrive
|
||||
if (headingCorrection)
|
||||
{
|
||||
if (Math.abs(velocity.omegaRadiansPerSecond) < HEADING_CORRECTION_DEADBAND
|
||||
&& (Math.abs(velocity.vxMetersPerSecond) > HEADING_CORRECTION_DEADBAND
|
||||
|| Math.abs(velocity.vyMetersPerSecond) > HEADING_CORRECTION_DEADBAND))
|
||||
&& (Math.abs(velocity.vxMetersPerSecond) > HEADING_CORRECTION_DEADBAND
|
||||
|| Math.abs(velocity.vyMetersPerSecond) > HEADING_CORRECTION_DEADBAND))
|
||||
{
|
||||
if (!correctionEnabled)
|
||||
if (!correctionEnabled)
|
||||
{
|
||||
lastHeadingRadians = getYaw().getRadians();
|
||||
correctionEnabled = true;
|
||||
|
||||
Reference in New Issue
Block a user