From 80d56cfffe7b21ea1a6608243fb4cf9c0b6f77d3 Mon Sep 17 00:00:00 2001 From: caTrixLiu Date: Thu, 28 Nov 2024 12:40:53 +0800 Subject: [PATCH] upgraded phoenix version to 2025 --- .../frc/robot/constants/TunerConstants.java | 105 ++++++++++-------- vendordeps/Phoenix6-frc2025-beta-latest.json | 77 ++++++++----- 2 files changed, 105 insertions(+), 77 deletions(-) diff --git a/src/main/java/frc/robot/constants/TunerConstants.java b/src/main/java/frc/robot/constants/TunerConstants.java index d7fa666..60084f9 100644 --- a/src/main/java/frc/robot/constants/TunerConstants.java +++ b/src/main/java/frc/robot/constants/TunerConstants.java @@ -13,6 +13,7 @@ import com.ctre.phoenix6.configs.Pigeon2Configuration; import com.ctre.phoenix6.configs.Slot0Configs; import com.ctre.phoenix6.configs.TalonFXConfiguration; +import com.ctre.phoenix6.signals.StaticFeedforwardSignValue; import com.ctre.phoenix6.swerve.SwerveDrivetrainConstants; import com.ctre.phoenix6.swerve.SwerveModuleConstants; import com.ctre.phoenix6.swerve.SwerveModuleConstants.ClosedLoopOutputType; @@ -25,8 +26,8 @@ /** * For CTRE Chassis, generate this file using the Tuner * - *

TODO: after generated, you MUST replace all "public" labels with "public" (do it with the replace function of your - * IDE) + *

TODO: after generated, you MUST replace all "private" labels with "public" (do it with the replace function of + * your IDE) * *

TODO: you MUST delete the last two lines of this file * @@ -38,16 +39,17 @@ public class TunerConstants { // The steer motor uses any SwerveModule.SteerRequestType control request with the // output type specified by SwerveModuleConstants.SteerMotorClosedLoopOutput public static final Slot0Configs steerGains = new Slot0Configs() - .withKP(100) + .withKP(100.0) .withKI(0) - .withKD(2.0) - .withKS(0.2) - .withKV(1.5) - .withKA(0); + .withKD(1.0) + .withKS(0.08) + .withKV(2.66) + .withKA(0) + .withStaticFeedforwardSign(StaticFeedforwardSignValue.UseClosedLoopSign); // When using closed-loop control, the drive motor uses the control // output type specified by SwerveModuleConstants.DriveMotorClosedLoopOutput public static final Slot0Configs driveGains = - new Slot0Configs().withKP(0.1).withKI(0).withKD(0).withKS(0).withKV(0.12); + new Slot0Configs().withKP(0.08).withKI(0).withKD(0).withKS(0.05).withKV(0.124); // The closed-loop output type to use for the steer motors; // This affects the PID/FF gains for the steer motors @@ -77,23 +79,26 @@ public class TunerConstants { // Configs for the Pigeon 2; leave this null to skip applying Pigeon 2 configs public static final Pigeon2Configuration pigeonConfigs = null; + // CAN bus that the devices are located on; + // All swerve devices must share the same CAN bus + public static final CANBus kCANBus = new CANBus("ChassisCanivore", "./logs/example.hoot"); + // Theoretical free speed (m/s) at 12 V applied output; // This needs to be tuned to your individual robot - public static final LinearVelocity kSpeedAt12Volts = MetersPerSecond.of(4.70); + public static final LinearVelocity kSpeedAt12Volts = MetersPerSecond.of(4.73); // Every 1 rotation of the azimuth results in kCoupleRatio drive motor turns; // This may need to be tuned to your individual robot - public static final double kCoupleRatio = 3.5; + public static final double kCoupleRatio = 3.5714285714285716; - public static final double kDriveGearRatio = 7.363636364; - public static final double kSteerGearRatio = 12.8; - public static final Distance kWheelRadius = Inches.of(2.167); + public static final double kDriveGearRatio = 6.746031746031747; + public static final double kSteerGearRatio = 21.428571428571427; + public static final Distance kWheelRadius = Inches.of(2); public static final boolean kInvertLeftSide = false; public static final boolean kInvertRightSide = true; - public static final CANBus kCANBus = new CANBus("rio", "./logs/example.hoot"); - public static final int kPigeonId = 1; + public static final int kPigeonId = 0; // These are only used for simulation public static final double kSteerInertia = 0.01; @@ -128,44 +133,48 @@ public class TunerConstants { .withDriveFrictionVoltage(kDriveFrictionVoltage); // Front Left - public static final int kFrontLeftDriveMotorId = 1; - public static final int kFrontLeftSteerMotorId = 2; - public static final int kFrontLeftEncoderId = 1; - public static final Angle kFrontLeftEncoderOffset = Rotations.of(-0.305419921875); + public static final int kFrontLeftDriveMotorId = 3; + public static final int kFrontLeftSteerMotorId = 4; + public static final int kFrontLeftEncoderId = 10; + public static final Angle kFrontLeftEncoderOffset = Rotations.of(0.4677734375); public static final boolean kFrontLeftSteerMotorInverted = true; + public static final boolean kFrontLeftCANcoderInverted = false; - public static final Distance kFrontLeftXPos = Inches.of(10.5); - public static final Distance kFrontLeftYPos = Inches.of(10.5); + public static final Distance kFrontLeftXPos = Inches.of(10); + public static final Distance kFrontLeftYPos = Inches.of(10); // Front Right - public static final int kFrontRightDriveMotorId = 3; - public static final int kFrontRightSteerMotorId = 4; - public static final int kFrontRightEncoderId = 2; - public static final Angle kFrontRightEncoderOffset = Rotations.of(-0.230712890625); + public static final int kFrontRightDriveMotorId = 6; + public static final int kFrontRightSteerMotorId = 5; + public static final int kFrontRightEncoderId = 11; + public static final Angle kFrontRightEncoderOffset = Rotations.of(-0.792724609375); public static final boolean kFrontRightSteerMotorInverted = true; + public static final boolean kFrontRightCANcoderInverted = false; - public static final Distance kFrontRightXPos = Inches.of(10.5); - public static final Distance kFrontRightYPos = Inches.of(-10.5); + public static final Distance kFrontRightXPos = Inches.of(10); + public static final Distance kFrontRightYPos = Inches.of(-10); // Back Left - public static final int kBackLeftDriveMotorId = 5; - public static final int kBackLeftSteerMotorId = 6; - public static final int kBackLeftEncoderId = 3; - public static final Angle kBackLeftEncoderOffset = Rotations.of(-0.221435546875); + public static final int kBackLeftDriveMotorId = 1; + public static final int kBackLeftSteerMotorId = 2; + public static final int kBackLeftEncoderId = 9; + public static final Angle kBackLeftEncoderOffset = Rotations.of(-0.047607421875); public static final boolean kBackLeftSteerMotorInverted = true; + public static final boolean kBackLeftCANcoderInverted = false; - public static final Distance kBackLeftXPos = Inches.of(-10.5); - public static final Distance kBackLeftYPos = Inches.of(10.5); + public static final Distance kBackLeftXPos = Inches.of(-10); + public static final Distance kBackLeftYPos = Inches.of(10); // Back Right - public static final int kBackRightDriveMotorId = 7; - public static final int kBackRightSteerMotorId = 8; - public static final int kBackRightEncoderId = 4; - public static final Angle kBackRightEncoderOffset = Rotations.of(-0.05419921875); + public static final int kBackRightDriveMotorId = 8; + public static final int kBackRightSteerMotorId = 7; + public static final int kBackRightEncoderId = 12; + public static final Angle kBackRightEncoderOffset = Rotations.of(-0.513671875); public static final boolean kBackRightSteerMotorInverted = true; + public static final boolean kBackRightCANcoderInverted = false; - public static final Distance kBackRightXPos = Inches.of(-10.5); - public static final Distance kBackRightYPos = Inches.of(-10.5); + public static final Distance kBackRightXPos = Inches.of(-10); + public static final Distance kBackRightYPos = Inches.of(-10); public static final SwerveModuleConstants FrontLeft = ConstantCreator.createModuleConstants( kFrontLeftSteerMotorId, @@ -175,7 +184,8 @@ public class TunerConstants { kFrontLeftXPos, kFrontLeftYPos, kInvertLeftSide, - kFrontLeftSteerMotorInverted); + kFrontLeftSteerMotorInverted, + kFrontLeftCANcoderInverted); public static final SwerveModuleConstants FrontRight = ConstantCreator.createModuleConstants( kFrontRightSteerMotorId, kFrontRightDriveMotorId, @@ -184,7 +194,8 @@ public class TunerConstants { kFrontRightXPos, kFrontRightYPos, kInvertRightSide, - kFrontRightSteerMotorInverted); + kFrontRightSteerMotorInverted, + kFrontRightCANcoderInverted); public static final SwerveModuleConstants BackLeft = ConstantCreator.createModuleConstants( kBackLeftSteerMotorId, kBackLeftDriveMotorId, @@ -193,7 +204,8 @@ public class TunerConstants { kBackLeftXPos, kBackLeftYPos, kInvertLeftSide, - kBackLeftSteerMotorInverted); + kBackLeftSteerMotorInverted, + kBackLeftCANcoderInverted); public static final SwerveModuleConstants BackRight = ConstantCreator.createModuleConstants( kBackRightSteerMotorId, kBackRightDriveMotorId, @@ -202,12 +214,11 @@ public class TunerConstants { kBackRightXPos, kBackRightYPos, kInvertRightSide, - kBackRightSteerMotorInverted); + kBackRightSteerMotorInverted, + kBackRightCANcoderInverted); - // These must be removed: + // TODO: these two lines should be removed: // public static CommandSwerveDrivetrain createDrivetrain() { - // return new CommandSwerveDrivetrain( - // DrivetrainConstants, FrontLeft, FrontRight, BackLeft, BackRight - // ); + // return new CommandSwerveDrivetrain(DrivetrainConstants, FrontLeft, FrontRight, BackLeft, BackRight); // } } diff --git a/vendordeps/Phoenix6-frc2025-beta-latest.json b/vendordeps/Phoenix6-frc2025-beta-latest.json index c56e61a..ff0b8c9 100644 --- a/vendordeps/Phoenix6-frc2025-beta-latest.json +++ b/vendordeps/Phoenix6-frc2025-beta-latest.json @@ -1,7 +1,7 @@ { - "fileName": "Phoenix6-25.0.0-beta-2.json", + "fileName": "Phoenix6-frc2025-beta-latest.json", "name": "CTRE-Phoenix (v6)", - "version": "25.0.0-beta-2", + "version": "25.0.0-beta-3", "frcYear": "2025", "uuid": "e995de00-2c64-4df5-8831-c1441420ff19", "mavenUrls": [ @@ -9,11 +9,6 @@ ], "jsonUrl": "https://maven.ctr-electronics.com/release/com/ctre/phoenix6/latest/Phoenix6-frc2025-beta-latest.json", "conflictsWith": [ - { - "uuid": "3fcf3402-e646-4fa6-971e-18afe8173b1a", - "errorMessage": "The combined Phoenix-6-And-5 vendordep is no longer supported. Please remove the vendordep and instead add both the latest Phoenix 6 vendordep and Phoenix 5 vendordep.", - "offlineFileName": "Phoenix6And5.json" - }, { "uuid": "e7900d8d-826f-4dca-a1ff-182f658e98af", "errorMessage": "Users can not have both the replay and regular Phoenix 6 vendordeps in their robot program.", @@ -24,19 +19,20 @@ { "groupId": "com.ctre.phoenix6", "artifactId": "wpiapi-java", - "version": "25.0.0-beta-2" + "version": "25.0.0-beta-3" } ], "jniDependencies": [ { "groupId": "com.ctre.phoenix6", "artifactId": "api-cpp", - "version": "25.0.0-beta-2", + "version": "25.0.0-beta-3", "isJar": false, "skipInvalidPlatforms": true, "validPlatforms": [ "windowsx86-64", "linuxx86-64", + "linuxarm64", "linuxathena" ], "simMode": "hwsim" @@ -44,12 +40,13 @@ { "groupId": "com.ctre.phoenix6", "artifactId": "tools", - "version": "25.0.0-beta-2", + "version": "25.0.0-beta-3", "isJar": false, "skipInvalidPlatforms": true, "validPlatforms": [ "windowsx86-64", "linuxx86-64", + "linuxarm64", "linuxathena" ], "simMode": "hwsim" @@ -57,12 +54,13 @@ { "groupId": "com.ctre.phoenix6.sim", "artifactId": "api-cpp-sim", - "version": "25.0.0-beta-2", + "version": "25.0.0-beta-3", "isJar": false, "skipInvalidPlatforms": true, "validPlatforms": [ "windowsx86-64", "linuxx86-64", + "linuxarm64", "osxuniversal" ], "simMode": "swsim" @@ -70,12 +68,13 @@ { "groupId": "com.ctre.phoenix6.sim", "artifactId": "tools-sim", - "version": "25.0.0-beta-2", + "version": "25.0.0-beta-3", "isJar": false, "skipInvalidPlatforms": true, "validPlatforms": [ "windowsx86-64", "linuxx86-64", + "linuxarm64", "osxuniversal" ], "simMode": "swsim" @@ -83,12 +82,13 @@ { "groupId": "com.ctre.phoenix6.sim", "artifactId": "simTalonSRX", - "version": "25.0.0-beta-2", + "version": "25.0.0-beta-3", "isJar": false, "skipInvalidPlatforms": true, "validPlatforms": [ "windowsx86-64", "linuxx86-64", + "linuxarm64", "osxuniversal" ], "simMode": "swsim" @@ -96,12 +96,13 @@ { "groupId": "com.ctre.phoenix6.sim", "artifactId": "simVictorSPX", - "version": "25.0.0-beta-2", + "version": "25.0.0-beta-3", "isJar": false, "skipInvalidPlatforms": true, "validPlatforms": [ "windowsx86-64", "linuxx86-64", + "linuxarm64", "osxuniversal" ], "simMode": "swsim" @@ -109,12 +110,13 @@ { "groupId": "com.ctre.phoenix6.sim", "artifactId": "simPigeonIMU", - "version": "25.0.0-beta-2", + "version": "25.0.0-beta-3", "isJar": false, "skipInvalidPlatforms": true, "validPlatforms": [ "windowsx86-64", "linuxx86-64", + "linuxarm64", "osxuniversal" ], "simMode": "swsim" @@ -122,12 +124,13 @@ { "groupId": "com.ctre.phoenix6.sim", "artifactId": "simCANCoder", - "version": "25.0.0-beta-2", + "version": "25.0.0-beta-3", "isJar": false, "skipInvalidPlatforms": true, "validPlatforms": [ "windowsx86-64", "linuxx86-64", + "linuxarm64", "osxuniversal" ], "simMode": "swsim" @@ -135,12 +138,13 @@ { "groupId": "com.ctre.phoenix6.sim", "artifactId": "simProTalonFX", - "version": "25.0.0-beta-2", + "version": "25.0.0-beta-3", "isJar": false, "skipInvalidPlatforms": true, "validPlatforms": [ "windowsx86-64", "linuxx86-64", + "linuxarm64", "osxuniversal" ], "simMode": "swsim" @@ -148,12 +152,13 @@ { "groupId": "com.ctre.phoenix6.sim", "artifactId": "simProCANcoder", - "version": "25.0.0-beta-2", + "version": "25.0.0-beta-3", "isJar": false, "skipInvalidPlatforms": true, "validPlatforms": [ "windowsx86-64", "linuxx86-64", + "linuxarm64", "osxuniversal" ], "simMode": "swsim" @@ -161,12 +166,13 @@ { "groupId": "com.ctre.phoenix6.sim", "artifactId": "simProPigeon2", - "version": "25.0.0-beta-2", + "version": "25.0.0-beta-3", "isJar": false, "skipInvalidPlatforms": true, "validPlatforms": [ "windowsx86-64", "linuxx86-64", + "linuxarm64", "osxuniversal" ], "simMode": "swsim" @@ -176,7 +182,7 @@ { "groupId": "com.ctre.phoenix6", "artifactId": "wpiapi-cpp", - "version": "25.0.0-beta-2", + "version": "25.0.0-beta-3", "libName": "CTRE_Phoenix6_WPI", "headerClassifier": "headers", "sharedLibrary": true, @@ -184,6 +190,7 @@ "binaryPlatforms": [ "windowsx86-64", "linuxx86-64", + "linuxarm64", "linuxathena" ], "simMode": "hwsim" @@ -191,7 +198,7 @@ { "groupId": "com.ctre.phoenix6", "artifactId": "tools", - "version": "25.0.0-beta-2", + "version": "25.0.0-beta-3", "libName": "CTRE_PhoenixTools", "headerClassifier": "headers", "sharedLibrary": true, @@ -199,6 +206,7 @@ "binaryPlatforms": [ "windowsx86-64", "linuxx86-64", + "linuxarm64", "linuxathena" ], "simMode": "hwsim" @@ -206,7 +214,7 @@ { "groupId": "com.ctre.phoenix6.sim", "artifactId": "wpiapi-cpp-sim", - "version": "25.0.0-beta-2", + "version": "25.0.0-beta-3", "libName": "CTRE_Phoenix6_WPISim", "headerClassifier": "headers", "sharedLibrary": true, @@ -214,6 +222,7 @@ "binaryPlatforms": [ "windowsx86-64", "linuxx86-64", + "linuxarm64", "osxuniversal" ], "simMode": "swsim" @@ -221,7 +230,7 @@ { "groupId": "com.ctre.phoenix6.sim", "artifactId": "tools-sim", - "version": "25.0.0-beta-2", + "version": "25.0.0-beta-3", "libName": "CTRE_PhoenixTools_Sim", "headerClassifier": "headers", "sharedLibrary": true, @@ -229,6 +238,7 @@ "binaryPlatforms": [ "windowsx86-64", "linuxx86-64", + "linuxarm64", "osxuniversal" ], "simMode": "swsim" @@ -236,7 +246,7 @@ { "groupId": "com.ctre.phoenix6.sim", "artifactId": "simTalonSRX", - "version": "25.0.0-beta-2", + "version": "25.0.0-beta-3", "libName": "CTRE_SimTalonSRX", "headerClassifier": "headers", "sharedLibrary": true, @@ -244,6 +254,7 @@ "binaryPlatforms": [ "windowsx86-64", "linuxx86-64", + "linuxarm64", "osxuniversal" ], "simMode": "swsim" @@ -251,7 +262,7 @@ { "groupId": "com.ctre.phoenix6.sim", "artifactId": "simVictorSPX", - "version": "25.0.0-beta-2", + "version": "25.0.0-beta-3", "libName": "CTRE_SimVictorSPX", "headerClassifier": "headers", "sharedLibrary": true, @@ -259,6 +270,7 @@ "binaryPlatforms": [ "windowsx86-64", "linuxx86-64", + "linuxarm64", "osxuniversal" ], "simMode": "swsim" @@ -266,7 +278,7 @@ { "groupId": "com.ctre.phoenix6.sim", "artifactId": "simPigeonIMU", - "version": "25.0.0-beta-2", + "version": "25.0.0-beta-3", "libName": "CTRE_SimPigeonIMU", "headerClassifier": "headers", "sharedLibrary": true, @@ -274,6 +286,7 @@ "binaryPlatforms": [ "windowsx86-64", "linuxx86-64", + "linuxarm64", "osxuniversal" ], "simMode": "swsim" @@ -281,7 +294,7 @@ { "groupId": "com.ctre.phoenix6.sim", "artifactId": "simCANCoder", - "version": "25.0.0-beta-2", + "version": "25.0.0-beta-3", "libName": "CTRE_SimCANCoder", "headerClassifier": "headers", "sharedLibrary": true, @@ -289,6 +302,7 @@ "binaryPlatforms": [ "windowsx86-64", "linuxx86-64", + "linuxarm64", "osxuniversal" ], "simMode": "swsim" @@ -296,7 +310,7 @@ { "groupId": "com.ctre.phoenix6.sim", "artifactId": "simProTalonFX", - "version": "25.0.0-beta-2", + "version": "25.0.0-beta-3", "libName": "CTRE_SimProTalonFX", "headerClassifier": "headers", "sharedLibrary": true, @@ -304,6 +318,7 @@ "binaryPlatforms": [ "windowsx86-64", "linuxx86-64", + "linuxarm64", "osxuniversal" ], "simMode": "swsim" @@ -311,7 +326,7 @@ { "groupId": "com.ctre.phoenix6.sim", "artifactId": "simProCANcoder", - "version": "25.0.0-beta-2", + "version": "25.0.0-beta-3", "libName": "CTRE_SimProCANcoder", "headerClassifier": "headers", "sharedLibrary": true, @@ -319,6 +334,7 @@ "binaryPlatforms": [ "windowsx86-64", "linuxx86-64", + "linuxarm64", "osxuniversal" ], "simMode": "swsim" @@ -326,7 +342,7 @@ { "groupId": "com.ctre.phoenix6.sim", "artifactId": "simProPigeon2", - "version": "25.0.0-beta-2", + "version": "25.0.0-beta-3", "libName": "CTRE_SimProPigeon2", "headerClassifier": "headers", "sharedLibrary": true, @@ -334,6 +350,7 @@ "binaryPlatforms": [ "windowsx86-64", "linuxx86-64", + "linuxarm64", "osxuniversal" ], "simMode": "swsim"