From a8020a69ab8d8d87f56d945f67670b4968401eb1 Mon Sep 17 00:00:00 2001 From: Jack-Haefele <113944276+Jack-Haefele@users.noreply.github.com> Date: Thu, 1 Feb 2024 19:06:44 -0600 Subject: [PATCH 1/5] created set heading correction in drive subsystem --- src/main/java/frc/robot/subsystems/Drive.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/java/frc/robot/subsystems/Drive.java b/src/main/java/frc/robot/subsystems/Drive.java index 142e3eb5..aaf9c6e1 100644 --- a/src/main/java/frc/robot/subsystems/Drive.java +++ b/src/main/java/frc/robot/subsystems/Drive.java @@ -77,6 +77,10 @@ public void enterXMode() { drive.lockPose(); } + public void setHeadingCorrection(boolean state) { + drive.setHeadingCorrection(state); + } + /** * Takes [-1, 1] joystick-like inputs and converts them to a {@link ChassisSpeeds} object that * represents the commanded robot velocities From 49a55b8b12ebc6cdbf16cbe9f48d1cdebbe93c9c Mon Sep 17 00:00:00 2001 From: Jack-Haefele <113944276+Jack-Haefele@users.noreply.github.com> Date: Thu, 1 Feb 2024 19:11:41 -0600 Subject: [PATCH 2/5] put heading correction in initialize and end --- .../commands/drive/DriveFieldOrientedHeadingSnapping.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/main/java/frc/robot/commands/drive/DriveFieldOrientedHeadingSnapping.java b/src/main/java/frc/robot/commands/drive/DriveFieldOrientedHeadingSnapping.java index c2c8df73..5c8a41a4 100644 --- a/src/main/java/frc/robot/commands/drive/DriveFieldOrientedHeadingSnapping.java +++ b/src/main/java/frc/robot/commands/drive/DriveFieldOrientedHeadingSnapping.java @@ -37,7 +37,9 @@ public DriveFieldOrientedHeadingSnapping() { // Called when the command is initially scheduled. @Override - public void initialize() {} + public void initialize() { + drive.setHeadingCorrection(true); + } // Called every time the scheduler runs while the command is scheduled. @Override @@ -78,7 +80,9 @@ public void execute() { // Called once the command ends or is interrupted. @Override - public void end(boolean interrupted) {} + public void end(boolean interrupted) { + drive.setHeadingCorrection(false); + } // Returns true when the command should end. @Override From 5e1659b8c62bb723835012feb59b418f3a3f0dd9 Mon Sep 17 00:00:00 2001 From: Jack-Haefele <113944276+Jack-Haefele@users.noreply.github.com> Date: Thu, 1 Feb 2024 19:11:48 -0600 Subject: [PATCH 3/5] javadoc --- src/main/java/frc/robot/subsystems/Drive.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/main/java/frc/robot/subsystems/Drive.java b/src/main/java/frc/robot/subsystems/Drive.java index aaf9c6e1..d7f3301a 100644 --- a/src/main/java/frc/robot/subsystems/Drive.java +++ b/src/main/java/frc/robot/subsystems/Drive.java @@ -77,6 +77,11 @@ public void enterXMode() { drive.lockPose(); } + /** + * Set the heading correction capabilitys of YAGSL. + * + * @param state SwerveDrive.headingCorrection state + */ public void setHeadingCorrection(boolean state) { drive.setHeadingCorrection(state); } From 98456085ad8fee8e9468479d1a08eea2c12ec886 Mon Sep 17 00:00:00 2001 From: Jack-Haefele <113944276+Jack-Haefele@users.noreply.github.com> Date: Thu, 1 Feb 2024 19:33:47 -0600 Subject: [PATCH 4/5] javadoc --- src/main/java/frc/robot/subsystems/Drive.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/java/frc/robot/subsystems/Drive.java b/src/main/java/frc/robot/subsystems/Drive.java index d7f3301a..372c4a04 100644 --- a/src/main/java/frc/robot/subsystems/Drive.java +++ b/src/main/java/frc/robot/subsystems/Drive.java @@ -78,9 +78,10 @@ public void enterXMode() { } /** - * Set the heading correction capabilitys of YAGSL. + * Set the heading correction capabilities of YAGSL. Should only be enabled when heading + * correction capabilities are in use * - * @param state SwerveDrive.headingCorrection state + * @param state {@link swervelib.SwerveDrive.headingCorrection} state */ public void setHeadingCorrection(boolean state) { drive.setHeadingCorrection(state); From 479a8e8837159ba2576a1329e51e55338e2e121f Mon Sep 17 00:00:00 2001 From: Jack-Haefele <113944276+Jack-Haefele@users.noreply.github.com> Date: Thu, 1 Feb 2024 19:36:58 -0600 Subject: [PATCH 5/5] javadoc --- src/main/java/frc/robot/subsystems/Drive.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/frc/robot/subsystems/Drive.java b/src/main/java/frc/robot/subsystems/Drive.java index 372c4a04..6d4877ad 100644 --- a/src/main/java/frc/robot/subsystems/Drive.java +++ b/src/main/java/frc/robot/subsystems/Drive.java @@ -81,7 +81,7 @@ public void enterXMode() { * Set the heading correction capabilities of YAGSL. Should only be enabled when heading * correction capabilities are in use * - * @param state {@link swervelib.SwerveDrive.headingCorrection} state + * @param state SwerveDrive.headingCorrection state */ public void setHeadingCorrection(boolean state) { drive.setHeadingCorrection(state);