From: iefomit Date: Mon, 6 Apr 2026 17:14:42 +0000 (-0700) Subject: Merge branch 'main' into phoenix-pro X-Git-Url: https://git.taranathan.com/?a=commitdiff_plain;h=603db04bbf5753fe350b764137120bd27cb0f07a;p=FRC2026.git Merge branch 'main' into phoenix-pro --- 603db04bbf5753fe350b764137120bd27cb0f07a diff --cc src/main/java/frc/robot/subsystems/drivetrain/GyroIO.java index 1cd5394,dd63dcd..53c36d5 --- a/src/main/java/frc/robot/subsystems/drivetrain/GyroIO.java +++ b/src/main/java/frc/robot/subsystems/drivetrain/GyroIO.java @@@ -32,6 -30,10 +32,13 @@@ public interface GyroIO public default void updateInputs(GyroIOInputs inputs) {} + /** returns the yaw status signal for time-synced odometry. */ + public default StatusSignal getYawSignal() { return null; } ++ + /** + * set the yaw angle of the gyro. + * + * @param rotation the new yaw angle + */ + public default void setYaw(Rotation2d rotation) {} } diff --cc src/main/java/frc/robot/subsystems/drivetrain/GyroIOPigeon2.java index 5b1d9e3,c6211f5..1e08361 --- a/src/main/java/frc/robot/subsystems/drivetrain/GyroIOPigeon2.java +++ b/src/main/java/frc/robot/subsystems/drivetrain/GyroIOPigeon2.java @@@ -72,8 -72,8 +72,13 @@@ public class GyroIOPigeon2 implements G yawPositionQueue.clear(); } + @Override + public StatusSignal getYawSignal() { + return yaw; + } ++ + @Override + public void setYaw(Rotation2d rotation) { + pigeon.getConfigurator().setYaw(rotation.getDegrees()); + } } diff --cc src/main/java/frc/robot/subsystems/drivetrain/Module.java index bfdf755,49910f1..9c26df3 --- a/src/main/java/frc/robot/subsystems/drivetrain/Module.java +++ b/src/main/java/frc/robot/subsystems/drivetrain/Module.java @@@ -249,10 -250,12 +252,12 @@@ public class Module implements ModuleIO } if (isOpenLoop) { double percentOutput = desiredState.speedMetersPerSecond / DriveConstants.MAX_SPEED; - driveMotor.set(percentOutput); + driveMotor.setControl(new DutyCycleOut(percentOutput).withEnableFOC(true)); } else { double velocity = desiredState.speedMetersPerSecond/DriveConstants.WHEEL_RADIUS/2/Math.PI*DriveConstants.DRIVE_GEAR_RATIO; - Logger.recordOutput("desired vel" + moduleConstants.ordinal(), velocity); + if (!Constants.DISABLE_LOGGING) { + Logger.recordOutput("desired vel" + moduleConstants.ordinal(), velocity); + } double feedforward = velocity * moduleConstants.getDriveV(); driveMotor.setControl( @@@ -439,22 -450,4 +466,22 @@@ return inputs.odometryTimestamps; } + /** returns the drive position status signal for time-synced odometry. */ + public StatusSignal getDrivePositionSignal() { + return drivePosition; + } + + /** returns the turn position status signal for time-synced odometry. */ + public StatusSignal getTurnPositionSignal() { + return turnPosition; + } + + /** returns the turn absolute position status signal for time-synced odometry. */ + public StatusSignal getTurnAbsolutePositionSignal() { + return turnAbsolutePosition; + } + + public TalonFX[] getMotors() { + return new TalonFX[]{angleMotor, driveMotor}; + } - } + }