From 7fe350bd108f1c6bb4561e17221421f86b1daad2 Mon Sep 17 00:00:00 2001 From: dannynotsmart <75951607+dannynotsmart@users.noreply.github.com> Date: Sat, 6 Jan 2024 01:12:12 -0500 Subject: [PATCH 01/10] not done with gyroio --- build.gradle | 2 +- .../sciborgs1155/robot/drive/gyro/GyroIO.java | 47 ++ .../sciborgs1155/robot/drive/gyro/Navx.java | 38 ++ .../sciborgs1155/robot/drive/gyro/Pigeon.java | 39 ++ vendordeps/NavX.json | 40 ++ vendordeps/Phoenix.json | 423 ++++++++++++++++ vendordeps/Phoenix6And5.json | 458 ++++++++++++++++++ vendordeps/photonlib.json | 42 ++ 8 files changed, 1088 insertions(+), 1 deletion(-) create mode 100644 src/main/java/org/sciborgs1155/robot/drive/gyro/GyroIO.java create mode 100644 src/main/java/org/sciborgs1155/robot/drive/gyro/Navx.java create mode 100644 src/main/java/org/sciborgs1155/robot/drive/gyro/Pigeon.java create mode 100644 vendordeps/NavX.json create mode 100644 vendordeps/Phoenix.json create mode 100644 vendordeps/Phoenix6And5.json create mode 100644 vendordeps/photonlib.json diff --git a/build.gradle b/build.gradle index 81650d6..7c80686 100644 --- a/build.gradle +++ b/build.gradle @@ -1,6 +1,6 @@ plugins { id "java" - id "edu.wpi.first.GradleRIO" version "2024.1.1-beta-3" + id "edu.wpi.first.GradleRIO" version "2024.1.1-beta-4" id 'com.diffplug.spotless' version '6.23.3' } diff --git a/src/main/java/org/sciborgs1155/robot/drive/gyro/GyroIO.java b/src/main/java/org/sciborgs1155/robot/drive/gyro/GyroIO.java new file mode 100644 index 0000000..b438fd7 --- /dev/null +++ b/src/main/java/org/sciborgs1155/robot/drive/gyro/GyroIO.java @@ -0,0 +1,47 @@ +package org.sciborgs1155.robot.drive.gyro; + +import org.sciborgs1155.lib.Fallible; + +import edu.wpi.first.math.geometry.Rotation2d; +import edu.wpi.first.math.geometry.Rotation3d; +import edu.wpi.first.util.sendable.SendableBuilder; + +/** Generalized gyroscope. Pigeon2, Navx, and SimGyro are to be implemented */ +public interface GyroIO extends Fallible, AutoCloseable { + /** Calibrates the gyroscope. Pigeon2 does not need to do anything here. */ + public default void calibrate() {} + + /** Returns the rate of rotation. */ + public double getRate(); + + /** Returns the heading of the robot as a Rotation2d. */ + public default Rotation2d getRotation2d() { + return getRotation3d().toRotation2d(); + } + + /** Returns the heading of the robot as a Rotation3d. */ + public default Rotation3d getRotation3d() { + return new Rotation3d(getYaw(), getPitch(), getPitch()); + } + + /** Returns the yaw value */ + public double getYaw(); + + /** Returns the pitch value */ + public double getPitch(); + + /** Returns the roll value */ + public double getRoll(); + + /** Resets heading to 0 */ + public void reset(); + + @Override + default void initSendable(SendableBuilder builder) { + Fallible.super.initSendable(builder); + builder.addDoubleProperty("current rate", () -> getRate(), null); + builder.addDoubleProperty("current yaw", () -> getYaw(), null); + builder.addDoubleProperty("current pitch", () -> getPitch(), null); + builder.addDoubleProperty("current roll", () -> getRoll(), null); + } +} \ No newline at end of file diff --git a/src/main/java/org/sciborgs1155/robot/drive/gyro/Navx.java b/src/main/java/org/sciborgs1155/robot/drive/gyro/Navx.java new file mode 100644 index 0000000..1152a90 --- /dev/null +++ b/src/main/java/org/sciborgs1155/robot/drive/gyro/Navx.java @@ -0,0 +1,38 @@ +package org.sciborgs1155.robot.drive.gyro; + +import com.kauailabs.navx.frc.AHRS; + +import edu.wpi.first.math.geometry.Rotation3d; +import edu.wpi.first.wpilibj.SPI; + +public class Navx implements GyroIO { + private AHRS ahrs; + + public Navx() { + ahrs = new AHRS(SPI.Port.kMXP); + } + + public double getRate() { + return ahrs.getRate(); + } + + public Rotation3d getRotation3d() { + return ahrs.getRotation3d(); + } + + public double getYaw() { + return ahrs.getYaw(); + } + + public double getPitch() { + return ahrs.getPitch(); + } + + public double getRoll() { + return ahrs.getRoll(); + } + + public void reset() { + ahrs.reset(); + } +} diff --git a/src/main/java/org/sciborgs1155/robot/drive/gyro/Pigeon.java b/src/main/java/org/sciborgs1155/robot/drive/gyro/Pigeon.java new file mode 100644 index 0000000..a3b9cd6 --- /dev/null +++ b/src/main/java/org/sciborgs1155/robot/drive/gyro/Pigeon.java @@ -0,0 +1,39 @@ +package org.sciborgs1155.robot.drive.gyro; + +import com.ctre.phoenix.sensors.WPI_PigeonIMU; + +import edu.wpi.first.math.geometry.Rotation2d; +import edu.wpi.first.math.geometry.Rotation3d; + +// PigeonIMU implementation +public class Pigeon implements GyroIO { + private WPI_PigeonIMU pigeon; + + public Pigeon(int deviceId) { + pigeon = new WPI_PigeonIMU(deviceId); + } + + public double getRate() { + return pigeon.getRate(); + } + + public Rotation3d getRotation3d() { + return new Rotation3d(getYaw(), getPitch(), getPitch()); + } + + public double getYaw() { + return pigeon.getYaw(); + } + + public double getPitch() { + return pigeon.getPitch(); + } + + public double getRoll() { + return pigeon.getRoll(); + } + + public void reset() { + pigeon.reset(); + } +} diff --git a/vendordeps/NavX.json b/vendordeps/NavX.json new file mode 100644 index 0000000..2a29835 --- /dev/null +++ b/vendordeps/NavX.json @@ -0,0 +1,40 @@ +{ + "fileName": "NavX.json", + "name": "NavX", + "version": "2024.0.1-beta-4", + "uuid": "cb311d09-36e9-4143-a032-55bb2b94443b", + "frcYear": "2024", + "mavenUrls": [ + "https://dev.studica.com/maven/release/2024/" + ], + "jsonUrl": "https://dev.studica.com/releases/2024/NavX.json", + "javaDependencies": [ + { + "groupId": "com.kauailabs.navx.frc", + "artifactId": "navx-frc-java", + "version": "2024.0.1-beta-4" + } + ], + "jniDependencies": [], + "cppDependencies": [ + { + "groupId": "com.kauailabs.navx.frc", + "artifactId": "navx-frc-cpp", + "version": "2024.0.1-beta-4", + "headerClassifier": "headers", + "sourcesClassifier": "sources", + "sharedLibrary": false, + "libName": "navx_frc", + "skipInvalidPlatforms": true, + "binaryPlatforms": [ + "linuxathena", + "linuxraspbian", + "linuxarm32", + "linuxarm64", + "linuxx86-64", + "osxuniversal", + "windowsx86-64" + ] + } + ] +} \ No newline at end of file diff --git a/vendordeps/Phoenix.json b/vendordeps/Phoenix.json new file mode 100644 index 0000000..614dc3a --- /dev/null +++ b/vendordeps/Phoenix.json @@ -0,0 +1,423 @@ +{ + "fileName": "Phoenix.json", + "name": "CTRE-Phoenix (v5)", + "version": "5.31.0+23.2.2", + "frcYear": 2023, + "uuid": "ab676553-b602-441f-a38d-f1296eff6537", + "mavenUrls": [ + "https://maven.ctr-electronics.com/release/" + ], + "jsonUrl": "https://maven.ctr-electronics.com/release/com/ctre/phoenix/Phoenix5-frc2023-latest.json", + "javaDependencies": [ + { + "groupId": "com.ctre.phoenix", + "artifactId": "api-java", + "version": "5.31.0" + }, + { + "groupId": "com.ctre.phoenix", + "artifactId": "wpiapi-java", + "version": "5.31.0" + } + ], + "jniDependencies": [ + { + "groupId": "com.ctre.phoenix", + "artifactId": "cci", + "version": "5.31.0", + "isJar": false, + "skipInvalidPlatforms": true, + "validPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "linuxathena" + ], + "simMode": "hwsim" + }, + { + "groupId": "com.ctre.phoenix.sim", + "artifactId": "cci-sim", + "version": "5.31.0", + "isJar": false, + "skipInvalidPlatforms": true, + "validPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "osxuniversal" + ], + "simMode": "swsim" + }, + { + "groupId": "com.ctre.phoenix6", + "artifactId": "tools", + "version": "23.2.2", + "isJar": false, + "skipInvalidPlatforms": true, + "validPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "linuxathena" + ], + "simMode": "hwsim" + }, + { + "groupId": "com.ctre.phoenix6.sim", + "artifactId": "tools-sim", + "version": "23.2.2", + "isJar": false, + "skipInvalidPlatforms": true, + "validPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "osxuniversal" + ], + "simMode": "swsim" + }, + { + "groupId": "com.ctre.phoenix6.sim", + "artifactId": "simTalonSRX", + "version": "23.2.2", + "isJar": false, + "skipInvalidPlatforms": true, + "validPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "osxuniversal" + ], + "simMode": "swsim" + }, + { + "groupId": "com.ctre.phoenix6.sim", + "artifactId": "simTalonFX", + "version": "23.2.2", + "isJar": false, + "skipInvalidPlatforms": true, + "validPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "osxuniversal" + ], + "simMode": "swsim" + }, + { + "groupId": "com.ctre.phoenix6.sim", + "artifactId": "simVictorSPX", + "version": "23.2.2", + "isJar": false, + "skipInvalidPlatforms": true, + "validPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "osxuniversal" + ], + "simMode": "swsim" + }, + { + "groupId": "com.ctre.phoenix6.sim", + "artifactId": "simPigeonIMU", + "version": "23.2.2", + "isJar": false, + "skipInvalidPlatforms": true, + "validPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "osxuniversal" + ], + "simMode": "swsim" + }, + { + "groupId": "com.ctre.phoenix6.sim", + "artifactId": "simCANCoder", + "version": "23.2.2", + "isJar": false, + "skipInvalidPlatforms": true, + "validPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "osxuniversal" + ], + "simMode": "swsim" + }, + { + "groupId": "com.ctre.phoenix6.sim", + "artifactId": "simProTalonFX", + "version": "23.2.2", + "isJar": false, + "skipInvalidPlatforms": true, + "validPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "osxuniversal" + ], + "simMode": "swsim" + }, + { + "groupId": "com.ctre.phoenix6.sim", + "artifactId": "simProCANcoder", + "version": "23.2.2", + "isJar": false, + "skipInvalidPlatforms": true, + "validPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "osxuniversal" + ], + "simMode": "swsim" + }, + { + "groupId": "com.ctre.phoenix6.sim", + "artifactId": "simProPigeon2", + "version": "23.2.2", + "isJar": false, + "skipInvalidPlatforms": true, + "validPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "osxuniversal" + ], + "simMode": "swsim" + } + ], + "cppDependencies": [ + { + "groupId": "com.ctre.phoenix", + "artifactId": "wpiapi-cpp", + "version": "5.31.0", + "libName": "CTRE_Phoenix_WPI", + "headerClassifier": "headers", + "sharedLibrary": true, + "skipInvalidPlatforms": true, + "binaryPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "linuxathena" + ], + "simMode": "hwsim" + }, + { + "groupId": "com.ctre.phoenix", + "artifactId": "api-cpp", + "version": "5.31.0", + "libName": "CTRE_Phoenix", + "headerClassifier": "headers", + "sharedLibrary": true, + "skipInvalidPlatforms": true, + "binaryPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "linuxathena" + ], + "simMode": "hwsim" + }, + { + "groupId": "com.ctre.phoenix", + "artifactId": "cci", + "version": "5.31.0", + "libName": "CTRE_PhoenixCCI", + "headerClassifier": "headers", + "sharedLibrary": true, + "skipInvalidPlatforms": true, + "binaryPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "linuxathena" + ], + "simMode": "hwsim" + }, + { + "groupId": "com.ctre.phoenix6", + "artifactId": "tools", + "version": "23.2.2", + "libName": "CTRE_PhoenixTools", + "headerClassifier": "headers", + "sharedLibrary": true, + "skipInvalidPlatforms": true, + "binaryPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "linuxathena" + ], + "simMode": "hwsim" + }, + { + "groupId": "com.ctre.phoenix.sim", + "artifactId": "wpiapi-cpp-sim", + "version": "5.31.0", + "libName": "CTRE_Phoenix_WPISim", + "headerClassifier": "headers", + "sharedLibrary": true, + "skipInvalidPlatforms": true, + "binaryPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "osxuniversal" + ], + "simMode": "swsim" + }, + { + "groupId": "com.ctre.phoenix.sim", + "artifactId": "api-cpp-sim", + "version": "5.31.0", + "libName": "CTRE_PhoenixSim", + "headerClassifier": "headers", + "sharedLibrary": true, + "skipInvalidPlatforms": true, + "binaryPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "osxuniversal" + ], + "simMode": "swsim" + }, + { + "groupId": "com.ctre.phoenix.sim", + "artifactId": "cci-sim", + "version": "5.31.0", + "libName": "CTRE_PhoenixCCISim", + "headerClassifier": "headers", + "sharedLibrary": true, + "skipInvalidPlatforms": true, + "binaryPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "osxuniversal" + ], + "simMode": "swsim" + }, + { + "groupId": "com.ctre.phoenix6.sim", + "artifactId": "tools-sim", + "version": "23.2.2", + "libName": "CTRE_PhoenixTools_Sim", + "headerClassifier": "headers", + "sharedLibrary": true, + "skipInvalidPlatforms": true, + "binaryPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "osxuniversal" + ], + "simMode": "swsim" + }, + { + "groupId": "com.ctre.phoenix6.sim", + "artifactId": "simTalonSRX", + "version": "23.2.2", + "libName": "CTRE_SimTalonSRX", + "headerClassifier": "headers", + "sharedLibrary": true, + "skipInvalidPlatforms": true, + "binaryPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "osxuniversal" + ], + "simMode": "swsim" + }, + { + "groupId": "com.ctre.phoenix6.sim", + "artifactId": "simTalonFX", + "version": "23.2.2", + "libName": "CTRE_SimTalonFX", + "headerClassifier": "headers", + "sharedLibrary": true, + "skipInvalidPlatforms": true, + "binaryPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "osxuniversal" + ], + "simMode": "swsim" + }, + { + "groupId": "com.ctre.phoenix6.sim", + "artifactId": "simVictorSPX", + "version": "23.2.2", + "libName": "CTRE_SimVictorSPX", + "headerClassifier": "headers", + "sharedLibrary": true, + "skipInvalidPlatforms": true, + "binaryPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "osxuniversal" + ], + "simMode": "swsim" + }, + { + "groupId": "com.ctre.phoenix6.sim", + "artifactId": "simPigeonIMU", + "version": "23.2.2", + "libName": "CTRE_SimPigeonIMU", + "headerClassifier": "headers", + "sharedLibrary": true, + "skipInvalidPlatforms": true, + "binaryPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "osxuniversal" + ], + "simMode": "swsim" + }, + { + "groupId": "com.ctre.phoenix6.sim", + "artifactId": "simCANCoder", + "version": "23.2.2", + "libName": "CTRE_SimCANCoder", + "headerClassifier": "headers", + "sharedLibrary": true, + "skipInvalidPlatforms": true, + "binaryPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "osxuniversal" + ], + "simMode": "swsim" + }, + { + "groupId": "com.ctre.phoenix6.sim", + "artifactId": "simProTalonFX", + "version": "23.2.2", + "libName": "CTRE_SimProTalonFX", + "headerClassifier": "headers", + "sharedLibrary": true, + "skipInvalidPlatforms": true, + "binaryPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "osxuniversal" + ], + "simMode": "swsim" + }, + { + "groupId": "com.ctre.phoenix6.sim", + "artifactId": "simProCANcoder", + "version": "23.2.2", + "libName": "CTRE_SimProCANcoder", + "headerClassifier": "headers", + "sharedLibrary": true, + "skipInvalidPlatforms": true, + "binaryPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "osxuniversal" + ], + "simMode": "swsim" + }, + { + "groupId": "com.ctre.phoenix6.sim", + "artifactId": "simProPigeon2", + "version": "23.2.2", + "libName": "CTRE_SimProPigeon2", + "headerClassifier": "headers", + "sharedLibrary": true, + "skipInvalidPlatforms": true, + "binaryPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "osxuniversal" + ], + "simMode": "swsim" + } + ] +} \ No newline at end of file diff --git a/vendordeps/Phoenix6And5.json b/vendordeps/Phoenix6And5.json new file mode 100644 index 0000000..c74983c --- /dev/null +++ b/vendordeps/Phoenix6And5.json @@ -0,0 +1,458 @@ +{ + "fileName": "Phoenix6And5.json", + "name": "CTRE-Phoenix (v6 And v5)", + "version": "23.2.2", + "frcYear": 2023, + "uuid": "3fcf3402-e646-4fa6-971e-18afe8173b1a", + "mavenUrls": [ + "https://maven.ctr-electronics.com/release/" + ], + "jsonUrl": "https://maven.ctr-electronics.com/release/com/ctre/phoenix6/latest/Phoenix6And5-frc2023-latest.json", + "javaDependencies": [ + { + "groupId": "com.ctre.phoenix", + "artifactId": "api-java", + "version": "5.31.0" + }, + { + "groupId": "com.ctre.phoenix", + "artifactId": "wpiapi-java", + "version": "5.31.0" + }, + { + "groupId": "com.ctre.phoenix6", + "artifactId": "wpiapi-java", + "version": "23.2.2" + } + ], + "jniDependencies": [ + { + "groupId": "com.ctre.phoenix", + "artifactId": "cci", + "version": "5.31.0", + "isJar": false, + "skipInvalidPlatforms": true, + "validPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "linuxathena" + ], + "simMode": "hwsim" + }, + { + "groupId": "com.ctre.phoenix.sim", + "artifactId": "cci-sim", + "version": "5.31.0", + "isJar": false, + "skipInvalidPlatforms": true, + "validPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "osxuniversal" + ], + "simMode": "swsim" + }, + { + "groupId": "com.ctre.phoenix6", + "artifactId": "tools", + "version": "23.2.2", + "isJar": false, + "skipInvalidPlatforms": true, + "validPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "linuxathena" + ], + "simMode": "hwsim" + }, + { + "groupId": "com.ctre.phoenix6.sim", + "artifactId": "tools-sim", + "version": "23.2.2", + "isJar": false, + "skipInvalidPlatforms": true, + "validPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "osxuniversal" + ], + "simMode": "swsim" + }, + { + "groupId": "com.ctre.phoenix6.sim", + "artifactId": "simTalonSRX", + "version": "23.2.2", + "isJar": false, + "skipInvalidPlatforms": true, + "validPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "osxuniversal" + ], + "simMode": "swsim" + }, + { + "groupId": "com.ctre.phoenix6.sim", + "artifactId": "simTalonFX", + "version": "23.2.2", + "isJar": false, + "skipInvalidPlatforms": true, + "validPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "osxuniversal" + ], + "simMode": "swsim" + }, + { + "groupId": "com.ctre.phoenix6.sim", + "artifactId": "simVictorSPX", + "version": "23.2.2", + "isJar": false, + "skipInvalidPlatforms": true, + "validPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "osxuniversal" + ], + "simMode": "swsim" + }, + { + "groupId": "com.ctre.phoenix6.sim", + "artifactId": "simPigeonIMU", + "version": "23.2.2", + "isJar": false, + "skipInvalidPlatforms": true, + "validPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "osxuniversal" + ], + "simMode": "swsim" + }, + { + "groupId": "com.ctre.phoenix6.sim", + "artifactId": "simCANCoder", + "version": "23.2.2", + "isJar": false, + "skipInvalidPlatforms": true, + "validPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "osxuniversal" + ], + "simMode": "swsim" + }, + { + "groupId": "com.ctre.phoenix6.sim", + "artifactId": "simProTalonFX", + "version": "23.2.2", + "isJar": false, + "skipInvalidPlatforms": true, + "validPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "osxuniversal" + ], + "simMode": "swsim" + }, + { + "groupId": "com.ctre.phoenix6.sim", + "artifactId": "simProCANcoder", + "version": "23.2.2", + "isJar": false, + "skipInvalidPlatforms": true, + "validPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "osxuniversal" + ], + "simMode": "swsim" + }, + { + "groupId": "com.ctre.phoenix6.sim", + "artifactId": "simProPigeon2", + "version": "23.2.2", + "isJar": false, + "skipInvalidPlatforms": true, + "validPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "osxuniversal" + ], + "simMode": "swsim" + } + ], + "cppDependencies": [ + { + "groupId": "com.ctre.phoenix", + "artifactId": "wpiapi-cpp", + "version": "5.31.0", + "libName": "CTRE_Phoenix_WPI", + "headerClassifier": "headers", + "sharedLibrary": true, + "skipInvalidPlatforms": true, + "binaryPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "linuxathena" + ], + "simMode": "hwsim" + }, + { + "groupId": "com.ctre.phoenix", + "artifactId": "api-cpp", + "version": "5.31.0", + "libName": "CTRE_Phoenix", + "headerClassifier": "headers", + "sharedLibrary": true, + "skipInvalidPlatforms": true, + "binaryPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "linuxathena" + ], + "simMode": "hwsim" + }, + { + "groupId": "com.ctre.phoenix", + "artifactId": "cci", + "version": "5.31.0", + "libName": "CTRE_PhoenixCCI", + "headerClassifier": "headers", + "sharedLibrary": true, + "skipInvalidPlatforms": true, + "binaryPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "linuxathena" + ], + "simMode": "hwsim" + }, + { + "groupId": "com.ctre.phoenix6", + "artifactId": "tools", + "version": "23.2.2", + "libName": "CTRE_PhoenixTools", + "headerClassifier": "headers", + "sharedLibrary": true, + "skipInvalidPlatforms": true, + "binaryPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "linuxathena" + ], + "simMode": "hwsim" + }, + { + "groupId": "com.ctre.phoenix.sim", + "artifactId": "wpiapi-cpp-sim", + "version": "5.31.0", + "libName": "CTRE_Phoenix_WPISim", + "headerClassifier": "headers", + "sharedLibrary": true, + "skipInvalidPlatforms": true, + "binaryPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "osxuniversal" + ], + "simMode": "swsim" + }, + { + "groupId": "com.ctre.phoenix.sim", + "artifactId": "api-cpp-sim", + "version": "5.31.0", + "libName": "CTRE_PhoenixSim", + "headerClassifier": "headers", + "sharedLibrary": true, + "skipInvalidPlatforms": true, + "binaryPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "osxuniversal" + ], + "simMode": "swsim" + }, + { + "groupId": "com.ctre.phoenix.sim", + "artifactId": "cci-sim", + "version": "5.31.0", + "libName": "CTRE_PhoenixCCISim", + "headerClassifier": "headers", + "sharedLibrary": true, + "skipInvalidPlatforms": true, + "binaryPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "osxuniversal" + ], + "simMode": "swsim" + }, + { + "groupId": "com.ctre.phoenix6.sim", + "artifactId": "tools-sim", + "version": "23.2.2", + "libName": "CTRE_PhoenixTools_Sim", + "headerClassifier": "headers", + "sharedLibrary": true, + "skipInvalidPlatforms": true, + "binaryPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "osxuniversal" + ], + "simMode": "swsim" + }, + { + "groupId": "com.ctre.phoenix6.sim", + "artifactId": "simTalonSRX", + "version": "23.2.2", + "libName": "CTRE_SimTalonSRX", + "headerClassifier": "headers", + "sharedLibrary": true, + "skipInvalidPlatforms": true, + "binaryPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "osxuniversal" + ], + "simMode": "swsim" + }, + { + "groupId": "com.ctre.phoenix6.sim", + "artifactId": "simTalonFX", + "version": "23.2.2", + "libName": "CTRE_SimTalonFX", + "headerClassifier": "headers", + "sharedLibrary": true, + "skipInvalidPlatforms": true, + "binaryPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "osxuniversal" + ], + "simMode": "swsim" + }, + { + "groupId": "com.ctre.phoenix6.sim", + "artifactId": "simVictorSPX", + "version": "23.2.2", + "libName": "CTRE_SimVictorSPX", + "headerClassifier": "headers", + "sharedLibrary": true, + "skipInvalidPlatforms": true, + "binaryPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "osxuniversal" + ], + "simMode": "swsim" + }, + { + "groupId": "com.ctre.phoenix6.sim", + "artifactId": "simPigeonIMU", + "version": "23.2.2", + "libName": "CTRE_SimPigeonIMU", + "headerClassifier": "headers", + "sharedLibrary": true, + "skipInvalidPlatforms": true, + "binaryPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "osxuniversal" + ], + "simMode": "swsim" + }, + { + "groupId": "com.ctre.phoenix6.sim", + "artifactId": "simCANCoder", + "version": "23.2.2", + "libName": "CTRE_SimCANCoder", + "headerClassifier": "headers", + "sharedLibrary": true, + "skipInvalidPlatforms": true, + "binaryPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "osxuniversal" + ], + "simMode": "swsim" + }, + { + "groupId": "com.ctre.phoenix6.sim", + "artifactId": "simProTalonFX", + "version": "23.2.2", + "libName": "CTRE_SimProTalonFX", + "headerClassifier": "headers", + "sharedLibrary": true, + "skipInvalidPlatforms": true, + "binaryPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "osxuniversal" + ], + "simMode": "swsim" + }, + { + "groupId": "com.ctre.phoenix6.sim", + "artifactId": "simProCANcoder", + "version": "23.2.2", + "libName": "CTRE_SimProCANcoder", + "headerClassifier": "headers", + "sharedLibrary": true, + "skipInvalidPlatforms": true, + "binaryPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "osxuniversal" + ], + "simMode": "swsim" + }, + { + "groupId": "com.ctre.phoenix6.sim", + "artifactId": "simProPigeon2", + "version": "23.2.2", + "libName": "CTRE_SimProPigeon2", + "headerClassifier": "headers", + "sharedLibrary": true, + "skipInvalidPlatforms": true, + "binaryPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "osxuniversal" + ], + "simMode": "swsim" + }, + { + "groupId": "com.ctre.phoenix6", + "artifactId": "wpiapi-cpp", + "version": "23.2.2", + "libName": "CTRE_Phoenix6_WPI", + "headerClassifier": "headers", + "sharedLibrary": true, + "skipInvalidPlatforms": true, + "binaryPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "linuxathena" + ], + "simMode": "hwsim" + }, + { + "groupId": "com.ctre.phoenix6.sim", + "artifactId": "wpiapi-cpp-sim", + "version": "23.2.2", + "libName": "CTRE_Phoenix6_WPISim", + "headerClassifier": "headers", + "sharedLibrary": true, + "skipInvalidPlatforms": true, + "binaryPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "osxuniversal" + ], + "simMode": "swsim" + } + ] +} \ No newline at end of file diff --git a/vendordeps/photonlib.json b/vendordeps/photonlib.json new file mode 100644 index 0000000..c940b75 --- /dev/null +++ b/vendordeps/photonlib.json @@ -0,0 +1,42 @@ +{ + "fileName": "photonlib.json", + "name": "photonlib", + "version": "v2024.1.1-beta-3.2", + "uuid": "515fe07e-bfc6-11fa-b3de-0242ac130004", + "frcYear": "2024", + "mavenUrls": [ + "https://maven.photonvision.org/repository/internal", + "https://maven.photonvision.org/repository/snapshots" + ], + "jsonUrl": "https://maven.photonvision.org/repository/internal/org/photonvision/PhotonLib-json/1.0/PhotonLib-json-1.0.json", + "jniDependencies": [], + "cppDependencies": [ + { + "groupId": "org.photonvision", + "artifactId": "PhotonLib-cpp", + "version": "v2024.1.1-beta-3.2", + "libName": "Photon", + "headerClassifier": "headers", + "sharedLibrary": true, + "skipInvalidPlatforms": true, + "binaryPlatforms": [ + "windowsx86-64", + "linuxathena", + "linuxx86-64", + "osxuniversal" + ] + } + ], + "javaDependencies": [ + { + "groupId": "org.photonvision", + "artifactId": "PhotonLib-java", + "version": "v2024.1.1-beta-3.2" + }, + { + "groupId": "org.photonvision", + "artifactId": "PhotonTargeting-java", + "version": "v2024.1.1-beta-3.2" + } + ] +} \ No newline at end of file From db66d1c343cdfa8e7220e7f372048e9a8552995b Mon Sep 17 00:00:00 2001 From: dannynotsmart <75951607+dannynotsmart@users.noreply.github.com> Date: Sun, 7 Jan 2024 01:28:45 -0500 Subject: [PATCH 02/10] finished gyroio, implemented navx and pigeonimu, updated drive with new io class. simgyro is not complete --- .../org/sciborgs1155/robot/drive/Drive.java | 11 ++--- .../sciborgs1155/robot/drive/gyro/Navx.java | 9 ++++- .../gyro/{Pigeon.java => PigeonIMU.java} | 8 +--- .../robot/drive/gyro/SimGyro.java | 40 +++++++++++++++++++ 4 files changed, 56 insertions(+), 12 deletions(-) rename src/main/java/org/sciborgs1155/robot/drive/gyro/{Pigeon.java => PigeonIMU.java} (77%) create mode 100644 src/main/java/org/sciborgs1155/robot/drive/gyro/SimGyro.java diff --git a/src/main/java/org/sciborgs1155/robot/drive/Drive.java b/src/main/java/org/sciborgs1155/robot/drive/Drive.java index 58d6dd7..a067921 100644 --- a/src/main/java/org/sciborgs1155/robot/drive/Drive.java +++ b/src/main/java/org/sciborgs1155/robot/drive/Drive.java @@ -4,7 +4,6 @@ import static org.sciborgs1155.robot.Ports.Drive.*; import static org.sciborgs1155.robot.drive.DriveConstants.*; -import com.kauailabs.navx.frc.AHRS; import edu.wpi.first.math.MathUtil; import edu.wpi.first.math.estimator.SwerveDrivePoseEstimator; import edu.wpi.first.math.filter.SlewRateLimiter; @@ -26,6 +25,8 @@ import org.photonvision.EstimatedRobotPose; import org.sciborgs1155.robot.Constants; import org.sciborgs1155.robot.Robot; +import org.sciborgs1155.robot.drive.gyro.GyroIO; +import org.sciborgs1155.robot.drive.gyro.Navx; public class Drive extends SubsystemBase implements Logged, AutoCloseable { @@ -36,7 +37,7 @@ public class Drive extends SubsystemBase implements Logged, AutoCloseable { private final List modules; - @LogBoth private final AHRS imu = new AHRS(); + @LogBoth private final GyroIO gyro = new Navx(); public final SwerveDriveKinematics kinematics = new SwerveDriveKinematics(MODULE_OFFSET); @@ -96,7 +97,7 @@ public Pose2d getPose() { * @return A Rotation2d of our angle */ public Rotation2d getHeading() { - return Robot.isReal() ? imu.getRotation2d() : Rotation2d.fromRadians(simulatedHeading); + return Robot.isReal() ? gyro.getRotation2d() : Rotation2d.fromRadians(simulatedHeading); } /** @@ -167,12 +168,12 @@ public void resetEncoders() { /** Zeroes the heading of the robot. */ public Command zeroHeading() { - return runOnce(imu::reset); + return runOnce(gyro::reset); } /** Returns the pitch of the drive gyro */ public double getPitch() { - return imu.getPitch(); + return gyro.getPitch(); } private SwerveModuleState[] getModuleStates() { diff --git a/src/main/java/org/sciborgs1155/robot/drive/gyro/Navx.java b/src/main/java/org/sciborgs1155/robot/drive/gyro/Navx.java index 1152a90..81ce313 100644 --- a/src/main/java/org/sciborgs1155/robot/drive/gyro/Navx.java +++ b/src/main/java/org/sciborgs1155/robot/drive/gyro/Navx.java @@ -2,6 +2,7 @@ import com.kauailabs.navx.frc.AHRS; +import edu.wpi.first.math.geometry.Rotation2d; import edu.wpi.first.math.geometry.Rotation3d; import edu.wpi.first.wpilibj.SPI; @@ -16,8 +17,14 @@ public double getRate() { return ahrs.getRate(); } + @Override + public Rotation2d getRotation2d() { + return ahrs.getRotation2d(); // dunno if using the built in method is faster/better, but if not, this can be removed + } + + @Override public Rotation3d getRotation3d() { - return ahrs.getRotation3d(); + return ahrs.getRotation3d(); // dunno if using the built in method is faster/better, but if not, this can be removed } public double getYaw() { diff --git a/src/main/java/org/sciborgs1155/robot/drive/gyro/Pigeon.java b/src/main/java/org/sciborgs1155/robot/drive/gyro/PigeonIMU.java similarity index 77% rename from src/main/java/org/sciborgs1155/robot/drive/gyro/Pigeon.java rename to src/main/java/org/sciborgs1155/robot/drive/gyro/PigeonIMU.java index a3b9cd6..e2dc723 100644 --- a/src/main/java/org/sciborgs1155/robot/drive/gyro/Pigeon.java +++ b/src/main/java/org/sciborgs1155/robot/drive/gyro/PigeonIMU.java @@ -6,10 +6,10 @@ import edu.wpi.first.math.geometry.Rotation3d; // PigeonIMU implementation -public class Pigeon implements GyroIO { +public class PigeonIMU implements GyroIO { private WPI_PigeonIMU pigeon; - public Pigeon(int deviceId) { + public PigeonIMU(int deviceId) { pigeon = new WPI_PigeonIMU(deviceId); } @@ -17,10 +17,6 @@ public double getRate() { return pigeon.getRate(); } - public Rotation3d getRotation3d() { - return new Rotation3d(getYaw(), getPitch(), getPitch()); - } - public double getYaw() { return pigeon.getYaw(); } diff --git a/src/main/java/org/sciborgs1155/robot/drive/gyro/SimGyro.java b/src/main/java/org/sciborgs1155/robot/drive/gyro/SimGyro.java new file mode 100644 index 0000000..5f19ada --- /dev/null +++ b/src/main/java/org/sciborgs1155/robot/drive/gyro/SimGyro.java @@ -0,0 +1,40 @@ +package org.sciborgs1155.robot.drive.gyro; + +public class SimGyro implements GyroIO { + // TODO: somehow add values to yaw + private double yaw; + private double pitch; + private double roll; + + public SimGyro(double yaw, double pitch, double roll) { + this.yaw = yaw; + this.pitch = pitch; + this.roll = roll; + } + + public SimGyro() { + this(0, 0, 0); + } + + public double getRate() { + return 0; // ?? + } + + public double getYaw() { + return yaw; + } + + public double getPitch() { + return pitch; + } + + public double getRoll() { + return roll; + } + + public void reset() { + yaw = 0; + pitch = 0; + roll = 0; + } +} From dc12c36c470e78983a29596ccf82471f25247d7b Mon Sep 17 00:00:00 2001 From: Danny <75951607+dannynotsmart@users.noreply.github.com> Date: Tue, 9 Jan 2024 17:24:30 -0500 Subject: [PATCH 03/10] fixed simgyro? --- .../org/sciborgs1155/robot/drive/Drive.java | 21 +++++----- .../robot/drive/gyro/SimGyro.java | 40 ------------------- 2 files changed, 9 insertions(+), 52 deletions(-) delete mode 100644 src/main/java/org/sciborgs1155/robot/drive/gyro/SimGyro.java diff --git a/src/main/java/org/sciborgs1155/robot/drive/Drive.java b/src/main/java/org/sciborgs1155/robot/drive/Drive.java index a067921..7e126d1 100644 --- a/src/main/java/org/sciborgs1155/robot/drive/Drive.java +++ b/src/main/java/org/sciborgs1155/robot/drive/Drive.java @@ -55,6 +55,8 @@ public class Drive extends SubsystemBase implements Logged, AutoCloseable { @LogBoth private double speedMultiplier = 1; + @LogBoth private Rotation2d lastRotation = new Rotation2d(); + public static Drive create() { return Robot.isReal() ? new Drive( @@ -97,7 +99,7 @@ public Pose2d getPose() { * @return A Rotation2d of our angle */ public Rotation2d getHeading() { - return Robot.isReal() ? gyro.getRotation2d() : Rotation2d.fromRadians(simulatedHeading); + return Robot.isReal() ? gyro.getRotation2d() : lastRotation; } /** @@ -166,14 +168,13 @@ public void resetEncoders() { modules.forEach(ModuleIO::resetEncoders); } - /** Zeroes the heading of the robot. */ - public Command zeroHeading() { - return runOnce(gyro::reset); + public void resetLastRotation() { + lastRotation = new Rotation2d(); } - /** Returns the pitch of the drive gyro */ - public double getPitch() { - return gyro.getPitch(); + /** Zeroes the heading of the robot. */ + public Command zeroHeading() { + return runOnce(Robot.isReal() ? gyro::reset : this::resetLastRotation); // could be a lambda, idk i dont have intellisense so } private SwerveModuleState[] getModuleStates() { @@ -205,13 +206,9 @@ public void periodic() { } } - // jank - private double simulatedHeading = 0.0; - @Override public void simulationPeriodic() { - simulatedHeading += - kinematics.toChassisSpeeds(getModuleStates()).omegaRadiansPerSecond * Constants.PERIOD; + lastRotation = lastRotation.rotateBy​(new Rotation2d(kinematics.toChassisSpeeds(getModuleStates()).omegaRadiansPerSecond * Constants.PERIOD)); } /** Stops drivetrain */ diff --git a/src/main/java/org/sciborgs1155/robot/drive/gyro/SimGyro.java b/src/main/java/org/sciborgs1155/robot/drive/gyro/SimGyro.java deleted file mode 100644 index 5f19ada..0000000 --- a/src/main/java/org/sciborgs1155/robot/drive/gyro/SimGyro.java +++ /dev/null @@ -1,40 +0,0 @@ -package org.sciborgs1155.robot.drive.gyro; - -public class SimGyro implements GyroIO { - // TODO: somehow add values to yaw - private double yaw; - private double pitch; - private double roll; - - public SimGyro(double yaw, double pitch, double roll) { - this.yaw = yaw; - this.pitch = pitch; - this.roll = roll; - } - - public SimGyro() { - this(0, 0, 0); - } - - public double getRate() { - return 0; // ?? - } - - public double getYaw() { - return yaw; - } - - public double getPitch() { - return pitch; - } - - public double getRoll() { - return roll; - } - - public void reset() { - yaw = 0; - pitch = 0; - roll = 0; - } -} From a203a0972eec25ba7e16ebddee2026b03477990c Mon Sep 17 00:00:00 2001 From: dannynotsmart <75951607+dannynotsmart@users.noreply.github.com> Date: Sun, 14 Jan 2024 22:52:18 -0500 Subject: [PATCH 04/10] got rid of 5, 6 --- vendordeps/Phoenix.json | 423 --------------------------------------- vendordeps/Phoenix6.json | 339 ------------------------------- 2 files changed, 762 deletions(-) delete mode 100644 vendordeps/Phoenix.json delete mode 100644 vendordeps/Phoenix6.json diff --git a/vendordeps/Phoenix.json b/vendordeps/Phoenix.json deleted file mode 100644 index 614dc3a..0000000 --- a/vendordeps/Phoenix.json +++ /dev/null @@ -1,423 +0,0 @@ -{ - "fileName": "Phoenix.json", - "name": "CTRE-Phoenix (v5)", - "version": "5.31.0+23.2.2", - "frcYear": 2023, - "uuid": "ab676553-b602-441f-a38d-f1296eff6537", - "mavenUrls": [ - "https://maven.ctr-electronics.com/release/" - ], - "jsonUrl": "https://maven.ctr-electronics.com/release/com/ctre/phoenix/Phoenix5-frc2023-latest.json", - "javaDependencies": [ - { - "groupId": "com.ctre.phoenix", - "artifactId": "api-java", - "version": "5.31.0" - }, - { - "groupId": "com.ctre.phoenix", - "artifactId": "wpiapi-java", - "version": "5.31.0" - } - ], - "jniDependencies": [ - { - "groupId": "com.ctre.phoenix", - "artifactId": "cci", - "version": "5.31.0", - "isJar": false, - "skipInvalidPlatforms": true, - "validPlatforms": [ - "windowsx86-64", - "linuxx86-64", - "linuxathena" - ], - "simMode": "hwsim" - }, - { - "groupId": "com.ctre.phoenix.sim", - "artifactId": "cci-sim", - "version": "5.31.0", - "isJar": false, - "skipInvalidPlatforms": true, - "validPlatforms": [ - "windowsx86-64", - "linuxx86-64", - "osxuniversal" - ], - "simMode": "swsim" - }, - { - "groupId": "com.ctre.phoenix6", - "artifactId": "tools", - "version": "23.2.2", - "isJar": false, - "skipInvalidPlatforms": true, - "validPlatforms": [ - "windowsx86-64", - "linuxx86-64", - "linuxathena" - ], - "simMode": "hwsim" - }, - { - "groupId": "com.ctre.phoenix6.sim", - "artifactId": "tools-sim", - "version": "23.2.2", - "isJar": false, - "skipInvalidPlatforms": true, - "validPlatforms": [ - "windowsx86-64", - "linuxx86-64", - "osxuniversal" - ], - "simMode": "swsim" - }, - { - "groupId": "com.ctre.phoenix6.sim", - "artifactId": "simTalonSRX", - "version": "23.2.2", - "isJar": false, - "skipInvalidPlatforms": true, - "validPlatforms": [ - "windowsx86-64", - "linuxx86-64", - "osxuniversal" - ], - "simMode": "swsim" - }, - { - "groupId": "com.ctre.phoenix6.sim", - "artifactId": "simTalonFX", - "version": "23.2.2", - "isJar": false, - "skipInvalidPlatforms": true, - "validPlatforms": [ - "windowsx86-64", - "linuxx86-64", - "osxuniversal" - ], - "simMode": "swsim" - }, - { - "groupId": "com.ctre.phoenix6.sim", - "artifactId": "simVictorSPX", - "version": "23.2.2", - "isJar": false, - "skipInvalidPlatforms": true, - "validPlatforms": [ - "windowsx86-64", - "linuxx86-64", - "osxuniversal" - ], - "simMode": "swsim" - }, - { - "groupId": "com.ctre.phoenix6.sim", - "artifactId": "simPigeonIMU", - "version": "23.2.2", - "isJar": false, - "skipInvalidPlatforms": true, - "validPlatforms": [ - "windowsx86-64", - "linuxx86-64", - "osxuniversal" - ], - "simMode": "swsim" - }, - { - "groupId": "com.ctre.phoenix6.sim", - "artifactId": "simCANCoder", - "version": "23.2.2", - "isJar": false, - "skipInvalidPlatforms": true, - "validPlatforms": [ - "windowsx86-64", - "linuxx86-64", - "osxuniversal" - ], - "simMode": "swsim" - }, - { - "groupId": "com.ctre.phoenix6.sim", - "artifactId": "simProTalonFX", - "version": "23.2.2", - "isJar": false, - "skipInvalidPlatforms": true, - "validPlatforms": [ - "windowsx86-64", - "linuxx86-64", - "osxuniversal" - ], - "simMode": "swsim" - }, - { - "groupId": "com.ctre.phoenix6.sim", - "artifactId": "simProCANcoder", - "version": "23.2.2", - "isJar": false, - "skipInvalidPlatforms": true, - "validPlatforms": [ - "windowsx86-64", - "linuxx86-64", - "osxuniversal" - ], - "simMode": "swsim" - }, - { - "groupId": "com.ctre.phoenix6.sim", - "artifactId": "simProPigeon2", - "version": "23.2.2", - "isJar": false, - "skipInvalidPlatforms": true, - "validPlatforms": [ - "windowsx86-64", - "linuxx86-64", - "osxuniversal" - ], - "simMode": "swsim" - } - ], - "cppDependencies": [ - { - "groupId": "com.ctre.phoenix", - "artifactId": "wpiapi-cpp", - "version": "5.31.0", - "libName": "CTRE_Phoenix_WPI", - "headerClassifier": "headers", - "sharedLibrary": true, - "skipInvalidPlatforms": true, - "binaryPlatforms": [ - "windowsx86-64", - "linuxx86-64", - "linuxathena" - ], - "simMode": "hwsim" - }, - { - "groupId": "com.ctre.phoenix", - "artifactId": "api-cpp", - "version": "5.31.0", - "libName": "CTRE_Phoenix", - "headerClassifier": "headers", - "sharedLibrary": true, - "skipInvalidPlatforms": true, - "binaryPlatforms": [ - "windowsx86-64", - "linuxx86-64", - "linuxathena" - ], - "simMode": "hwsim" - }, - { - "groupId": "com.ctre.phoenix", - "artifactId": "cci", - "version": "5.31.0", - "libName": "CTRE_PhoenixCCI", - "headerClassifier": "headers", - "sharedLibrary": true, - "skipInvalidPlatforms": true, - "binaryPlatforms": [ - "windowsx86-64", - "linuxx86-64", - "linuxathena" - ], - "simMode": "hwsim" - }, - { - "groupId": "com.ctre.phoenix6", - "artifactId": "tools", - "version": "23.2.2", - "libName": "CTRE_PhoenixTools", - "headerClassifier": "headers", - "sharedLibrary": true, - "skipInvalidPlatforms": true, - "binaryPlatforms": [ - "windowsx86-64", - "linuxx86-64", - "linuxathena" - ], - "simMode": "hwsim" - }, - { - "groupId": "com.ctre.phoenix.sim", - "artifactId": "wpiapi-cpp-sim", - "version": "5.31.0", - "libName": "CTRE_Phoenix_WPISim", - "headerClassifier": "headers", - "sharedLibrary": true, - "skipInvalidPlatforms": true, - "binaryPlatforms": [ - "windowsx86-64", - "linuxx86-64", - "osxuniversal" - ], - "simMode": "swsim" - }, - { - "groupId": "com.ctre.phoenix.sim", - "artifactId": "api-cpp-sim", - "version": "5.31.0", - "libName": "CTRE_PhoenixSim", - "headerClassifier": "headers", - "sharedLibrary": true, - "skipInvalidPlatforms": true, - "binaryPlatforms": [ - "windowsx86-64", - "linuxx86-64", - "osxuniversal" - ], - "simMode": "swsim" - }, - { - "groupId": "com.ctre.phoenix.sim", - "artifactId": "cci-sim", - "version": "5.31.0", - "libName": "CTRE_PhoenixCCISim", - "headerClassifier": "headers", - "sharedLibrary": true, - "skipInvalidPlatforms": true, - "binaryPlatforms": [ - "windowsx86-64", - "linuxx86-64", - "osxuniversal" - ], - "simMode": "swsim" - }, - { - "groupId": "com.ctre.phoenix6.sim", - "artifactId": "tools-sim", - "version": "23.2.2", - "libName": "CTRE_PhoenixTools_Sim", - "headerClassifier": "headers", - "sharedLibrary": true, - "skipInvalidPlatforms": true, - "binaryPlatforms": [ - "windowsx86-64", - "linuxx86-64", - "osxuniversal" - ], - "simMode": "swsim" - }, - { - "groupId": "com.ctre.phoenix6.sim", - "artifactId": "simTalonSRX", - "version": "23.2.2", - "libName": "CTRE_SimTalonSRX", - "headerClassifier": "headers", - "sharedLibrary": true, - "skipInvalidPlatforms": true, - "binaryPlatforms": [ - "windowsx86-64", - "linuxx86-64", - "osxuniversal" - ], - "simMode": "swsim" - }, - { - "groupId": "com.ctre.phoenix6.sim", - "artifactId": "simTalonFX", - "version": "23.2.2", - "libName": "CTRE_SimTalonFX", - "headerClassifier": "headers", - "sharedLibrary": true, - "skipInvalidPlatforms": true, - "binaryPlatforms": [ - "windowsx86-64", - "linuxx86-64", - "osxuniversal" - ], - "simMode": "swsim" - }, - { - "groupId": "com.ctre.phoenix6.sim", - "artifactId": "simVictorSPX", - "version": "23.2.2", - "libName": "CTRE_SimVictorSPX", - "headerClassifier": "headers", - "sharedLibrary": true, - "skipInvalidPlatforms": true, - "binaryPlatforms": [ - "windowsx86-64", - "linuxx86-64", - "osxuniversal" - ], - "simMode": "swsim" - }, - { - "groupId": "com.ctre.phoenix6.sim", - "artifactId": "simPigeonIMU", - "version": "23.2.2", - "libName": "CTRE_SimPigeonIMU", - "headerClassifier": "headers", - "sharedLibrary": true, - "skipInvalidPlatforms": true, - "binaryPlatforms": [ - "windowsx86-64", - "linuxx86-64", - "osxuniversal" - ], - "simMode": "swsim" - }, - { - "groupId": "com.ctre.phoenix6.sim", - "artifactId": "simCANCoder", - "version": "23.2.2", - "libName": "CTRE_SimCANCoder", - "headerClassifier": "headers", - "sharedLibrary": true, - "skipInvalidPlatforms": true, - "binaryPlatforms": [ - "windowsx86-64", - "linuxx86-64", - "osxuniversal" - ], - "simMode": "swsim" - }, - { - "groupId": "com.ctre.phoenix6.sim", - "artifactId": "simProTalonFX", - "version": "23.2.2", - "libName": "CTRE_SimProTalonFX", - "headerClassifier": "headers", - "sharedLibrary": true, - "skipInvalidPlatforms": true, - "binaryPlatforms": [ - "windowsx86-64", - "linuxx86-64", - "osxuniversal" - ], - "simMode": "swsim" - }, - { - "groupId": "com.ctre.phoenix6.sim", - "artifactId": "simProCANcoder", - "version": "23.2.2", - "libName": "CTRE_SimProCANcoder", - "headerClassifier": "headers", - "sharedLibrary": true, - "skipInvalidPlatforms": true, - "binaryPlatforms": [ - "windowsx86-64", - "linuxx86-64", - "osxuniversal" - ], - "simMode": "swsim" - }, - { - "groupId": "com.ctre.phoenix6.sim", - "artifactId": "simProPigeon2", - "version": "23.2.2", - "libName": "CTRE_SimProPigeon2", - "headerClassifier": "headers", - "sharedLibrary": true, - "skipInvalidPlatforms": true, - "binaryPlatforms": [ - "windowsx86-64", - "linuxx86-64", - "osxuniversal" - ], - "simMode": "swsim" - } - ] -} \ No newline at end of file diff --git a/vendordeps/Phoenix6.json b/vendordeps/Phoenix6.json deleted file mode 100644 index 7020206..0000000 --- a/vendordeps/Phoenix6.json +++ /dev/null @@ -1,339 +0,0 @@ -{ - "fileName": "Phoenix6.json", - "name": "CTRE-Phoenix (v6)", - "version": "24.0.0-beta-8", - "frcYear": 2024, - "uuid": "e995de00-2c64-4df5-8831-c1441420ff19", - "mavenUrls": [ - "https://maven.ctr-electronics.com/release/" - ], - "jsonUrl": "https://maven.ctr-electronics.com/release/com/ctre/phoenix6/latest/Phoenix6-frc2024-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" - } - ], - "javaDependencies": [ - { - "groupId": "com.ctre.phoenix6", - "artifactId": "wpiapi-java", - "version": "24.0.0-beta-8" - } - ], - "jniDependencies": [ - { - "groupId": "com.ctre.phoenix6", - "artifactId": "tools", - "version": "24.0.0-beta-8", - "isJar": false, - "skipInvalidPlatforms": true, - "validPlatforms": [ - "windowsx86-64", - "linuxx86-64", - "linuxathena" - ], - "simMode": "hwsim" - }, - { - "groupId": "com.ctre.phoenix6.sim", - "artifactId": "tools-sim", - "version": "24.0.0-beta-8", - "isJar": false, - "skipInvalidPlatforms": true, - "validPlatforms": [ - "windowsx86-64", - "linuxx86-64", - "osxuniversal" - ], - "simMode": "swsim" - }, - { - "groupId": "com.ctre.phoenix6.sim", - "artifactId": "simTalonSRX", - "version": "24.0.0-beta-8", - "isJar": false, - "skipInvalidPlatforms": true, - "validPlatforms": [ - "windowsx86-64", - "linuxx86-64", - "osxuniversal" - ], - "simMode": "swsim" - }, - { - "groupId": "com.ctre.phoenix6.sim", - "artifactId": "simTalonFX", - "version": "24.0.0-beta-8", - "isJar": false, - "skipInvalidPlatforms": true, - "validPlatforms": [ - "windowsx86-64", - "linuxx86-64", - "osxuniversal" - ], - "simMode": "swsim" - }, - { - "groupId": "com.ctre.phoenix6.sim", - "artifactId": "simVictorSPX", - "version": "24.0.0-beta-8", - "isJar": false, - "skipInvalidPlatforms": true, - "validPlatforms": [ - "windowsx86-64", - "linuxx86-64", - "osxuniversal" - ], - "simMode": "swsim" - }, - { - "groupId": "com.ctre.phoenix6.sim", - "artifactId": "simPigeonIMU", - "version": "24.0.0-beta-8", - "isJar": false, - "skipInvalidPlatforms": true, - "validPlatforms": [ - "windowsx86-64", - "linuxx86-64", - "osxuniversal" - ], - "simMode": "swsim" - }, - { - "groupId": "com.ctre.phoenix6.sim", - "artifactId": "simCANCoder", - "version": "24.0.0-beta-8", - "isJar": false, - "skipInvalidPlatforms": true, - "validPlatforms": [ - "windowsx86-64", - "linuxx86-64", - "osxuniversal" - ], - "simMode": "swsim" - }, - { - "groupId": "com.ctre.phoenix6.sim", - "artifactId": "simProTalonFX", - "version": "24.0.0-beta-8", - "isJar": false, - "skipInvalidPlatforms": true, - "validPlatforms": [ - "windowsx86-64", - "linuxx86-64", - "osxuniversal" - ], - "simMode": "swsim" - }, - { - "groupId": "com.ctre.phoenix6.sim", - "artifactId": "simProCANcoder", - "version": "24.0.0-beta-8", - "isJar": false, - "skipInvalidPlatforms": true, - "validPlatforms": [ - "windowsx86-64", - "linuxx86-64", - "osxuniversal" - ], - "simMode": "swsim" - }, - { - "groupId": "com.ctre.phoenix6.sim", - "artifactId": "simProPigeon2", - "version": "24.0.0-beta-8", - "isJar": false, - "skipInvalidPlatforms": true, - "validPlatforms": [ - "windowsx86-64", - "linuxx86-64", - "osxuniversal" - ], - "simMode": "swsim" - } - ], - "cppDependencies": [ - { - "groupId": "com.ctre.phoenix6", - "artifactId": "wpiapi-cpp", - "version": "24.0.0-beta-8", - "libName": "CTRE_Phoenix6_WPI", - "headerClassifier": "headers", - "sharedLibrary": true, - "skipInvalidPlatforms": true, - "binaryPlatforms": [ - "windowsx86-64", - "linuxx86-64", - "linuxathena" - ], - "simMode": "hwsim" - }, - { - "groupId": "com.ctre.phoenix6", - "artifactId": "tools", - "version": "24.0.0-beta-8", - "libName": "CTRE_PhoenixTools", - "headerClassifier": "headers", - "sharedLibrary": true, - "skipInvalidPlatforms": true, - "binaryPlatforms": [ - "windowsx86-64", - "linuxx86-64", - "linuxathena" - ], - "simMode": "hwsim" - }, - { - "groupId": "com.ctre.phoenix6.sim", - "artifactId": "wpiapi-cpp-sim", - "version": "24.0.0-beta-8", - "libName": "CTRE_Phoenix6_WPISim", - "headerClassifier": "headers", - "sharedLibrary": true, - "skipInvalidPlatforms": true, - "binaryPlatforms": [ - "windowsx86-64", - "linuxx86-64", - "osxuniversal" - ], - "simMode": "swsim" - }, - { - "groupId": "com.ctre.phoenix6.sim", - "artifactId": "tools-sim", - "version": "24.0.0-beta-8", - "libName": "CTRE_PhoenixTools_Sim", - "headerClassifier": "headers", - "sharedLibrary": true, - "skipInvalidPlatforms": true, - "binaryPlatforms": [ - "windowsx86-64", - "linuxx86-64", - "osxuniversal" - ], - "simMode": "swsim" - }, - { - "groupId": "com.ctre.phoenix6.sim", - "artifactId": "simTalonSRX", - "version": "24.0.0-beta-8", - "libName": "CTRE_SimTalonSRX", - "headerClassifier": "headers", - "sharedLibrary": true, - "skipInvalidPlatforms": true, - "binaryPlatforms": [ - "windowsx86-64", - "linuxx86-64", - "osxuniversal" - ], - "simMode": "swsim" - }, - { - "groupId": "com.ctre.phoenix6.sim", - "artifactId": "simTalonFX", - "version": "24.0.0-beta-8", - "libName": "CTRE_SimTalonFX", - "headerClassifier": "headers", - "sharedLibrary": true, - "skipInvalidPlatforms": true, - "binaryPlatforms": [ - "windowsx86-64", - "linuxx86-64", - "osxuniversal" - ], - "simMode": "swsim" - }, - { - "groupId": "com.ctre.phoenix6.sim", - "artifactId": "simVictorSPX", - "version": "24.0.0-beta-8", - "libName": "CTRE_SimVictorSPX", - "headerClassifier": "headers", - "sharedLibrary": true, - "skipInvalidPlatforms": true, - "binaryPlatforms": [ - "windowsx86-64", - "linuxx86-64", - "osxuniversal" - ], - "simMode": "swsim" - }, - { - "groupId": "com.ctre.phoenix6.sim", - "artifactId": "simPigeonIMU", - "version": "24.0.0-beta-8", - "libName": "CTRE_SimPigeonIMU", - "headerClassifier": "headers", - "sharedLibrary": true, - "skipInvalidPlatforms": true, - "binaryPlatforms": [ - "windowsx86-64", - "linuxx86-64", - "osxuniversal" - ], - "simMode": "swsim" - }, - { - "groupId": "com.ctre.phoenix6.sim", - "artifactId": "simCANCoder", - "version": "24.0.0-beta-8", - "libName": "CTRE_SimCANCoder", - "headerClassifier": "headers", - "sharedLibrary": true, - "skipInvalidPlatforms": true, - "binaryPlatforms": [ - "windowsx86-64", - "linuxx86-64", - "osxuniversal" - ], - "simMode": "swsim" - }, - { - "groupId": "com.ctre.phoenix6.sim", - "artifactId": "simProTalonFX", - "version": "24.0.0-beta-8", - "libName": "CTRE_SimProTalonFX", - "headerClassifier": "headers", - "sharedLibrary": true, - "skipInvalidPlatforms": true, - "binaryPlatforms": [ - "windowsx86-64", - "linuxx86-64", - "osxuniversal" - ], - "simMode": "swsim" - }, - { - "groupId": "com.ctre.phoenix6.sim", - "artifactId": "simProCANcoder", - "version": "24.0.0-beta-8", - "libName": "CTRE_SimProCANcoder", - "headerClassifier": "headers", - "sharedLibrary": true, - "skipInvalidPlatforms": true, - "binaryPlatforms": [ - "windowsx86-64", - "linuxx86-64", - "osxuniversal" - ], - "simMode": "swsim" - }, - { - "groupId": "com.ctre.phoenix6.sim", - "artifactId": "simProPigeon2", - "version": "24.0.0-beta-8", - "libName": "CTRE_SimProPigeon2", - "headerClassifier": "headers", - "sharedLibrary": true, - "skipInvalidPlatforms": true, - "binaryPlatforms": [ - "windowsx86-64", - "linuxx86-64", - "osxuniversal" - ], - "simMode": "swsim" - } - ] -} \ No newline at end of file From 38156d03a838493ccc908792b2af366018055cd5 Mon Sep 17 00:00:00 2001 From: dannynotsmart <75951607+dannynotsmart@users.noreply.github.com> Date: Sun, 14 Jan 2024 22:55:05 -0500 Subject: [PATCH 05/10] vendor libraries --- .../robot/drive/gyro/PigeonIMU.java | 35 --- .../{Phoenix6And5.json => Phoenix6.json} | 199 ++++-------------- 2 files changed, 40 insertions(+), 194 deletions(-) delete mode 100644 src/main/java/org/sciborgs1155/robot/drive/gyro/PigeonIMU.java rename vendordeps/{Phoenix6And5.json => Phoenix6.json} (65%) diff --git a/src/main/java/org/sciborgs1155/robot/drive/gyro/PigeonIMU.java b/src/main/java/org/sciborgs1155/robot/drive/gyro/PigeonIMU.java deleted file mode 100644 index e2dc723..0000000 --- a/src/main/java/org/sciborgs1155/robot/drive/gyro/PigeonIMU.java +++ /dev/null @@ -1,35 +0,0 @@ -package org.sciborgs1155.robot.drive.gyro; - -import com.ctre.phoenix.sensors.WPI_PigeonIMU; - -import edu.wpi.first.math.geometry.Rotation2d; -import edu.wpi.first.math.geometry.Rotation3d; - -// PigeonIMU implementation -public class PigeonIMU implements GyroIO { - private WPI_PigeonIMU pigeon; - - public PigeonIMU(int deviceId) { - pigeon = new WPI_PigeonIMU(deviceId); - } - - public double getRate() { - return pigeon.getRate(); - } - - public double getYaw() { - return pigeon.getYaw(); - } - - public double getPitch() { - return pigeon.getPitch(); - } - - public double getRoll() { - return pigeon.getRoll(); - } - - public void reset() { - pigeon.reset(); - } -} diff --git a/vendordeps/Phoenix6And5.json b/vendordeps/Phoenix6.json similarity index 65% rename from vendordeps/Phoenix6And5.json rename to vendordeps/Phoenix6.json index c74983c..69a4079 100644 --- a/vendordeps/Phoenix6And5.json +++ b/vendordeps/Phoenix6.json @@ -1,61 +1,32 @@ { - "fileName": "Phoenix6And5.json", - "name": "CTRE-Phoenix (v6 And v5)", - "version": "23.2.2", - "frcYear": 2023, - "uuid": "3fcf3402-e646-4fa6-971e-18afe8173b1a", + "fileName": "Phoenix6.json", + "name": "CTRE-Phoenix (v6)", + "version": "24.1.0", + "frcYear": 2024, + "uuid": "e995de00-2c64-4df5-8831-c1441420ff19", "mavenUrls": [ "https://maven.ctr-electronics.com/release/" ], - "jsonUrl": "https://maven.ctr-electronics.com/release/com/ctre/phoenix6/latest/Phoenix6And5-frc2023-latest.json", - "javaDependencies": [ - { - "groupId": "com.ctre.phoenix", - "artifactId": "api-java", - "version": "5.31.0" - }, + "jsonUrl": "https://maven.ctr-electronics.com/release/com/ctre/phoenix6/latest/Phoenix6-frc2024-latest.json", + "conflictsWith": [ { - "groupId": "com.ctre.phoenix", - "artifactId": "wpiapi-java", - "version": "5.31.0" - }, + "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" + } + ], + "javaDependencies": [ { "groupId": "com.ctre.phoenix6", "artifactId": "wpiapi-java", - "version": "23.2.2" + "version": "24.1.0" } ], "jniDependencies": [ - { - "groupId": "com.ctre.phoenix", - "artifactId": "cci", - "version": "5.31.0", - "isJar": false, - "skipInvalidPlatforms": true, - "validPlatforms": [ - "windowsx86-64", - "linuxx86-64", - "linuxathena" - ], - "simMode": "hwsim" - }, - { - "groupId": "com.ctre.phoenix.sim", - "artifactId": "cci-sim", - "version": "5.31.0", - "isJar": false, - "skipInvalidPlatforms": true, - "validPlatforms": [ - "windowsx86-64", - "linuxx86-64", - "osxuniversal" - ], - "simMode": "swsim" - }, { "groupId": "com.ctre.phoenix6", "artifactId": "tools", - "version": "23.2.2", + "version": "24.1.0", "isJar": false, "skipInvalidPlatforms": true, "validPlatforms": [ @@ -68,7 +39,7 @@ { "groupId": "com.ctre.phoenix6.sim", "artifactId": "tools-sim", - "version": "23.2.2", + "version": "24.1.0", "isJar": false, "skipInvalidPlatforms": true, "validPlatforms": [ @@ -81,7 +52,7 @@ { "groupId": "com.ctre.phoenix6.sim", "artifactId": "simTalonSRX", - "version": "23.2.2", + "version": "24.1.0", "isJar": false, "skipInvalidPlatforms": true, "validPlatforms": [ @@ -94,7 +65,7 @@ { "groupId": "com.ctre.phoenix6.sim", "artifactId": "simTalonFX", - "version": "23.2.2", + "version": "24.1.0", "isJar": false, "skipInvalidPlatforms": true, "validPlatforms": [ @@ -107,7 +78,7 @@ { "groupId": "com.ctre.phoenix6.sim", "artifactId": "simVictorSPX", - "version": "23.2.2", + "version": "24.1.0", "isJar": false, "skipInvalidPlatforms": true, "validPlatforms": [ @@ -120,7 +91,7 @@ { "groupId": "com.ctre.phoenix6.sim", "artifactId": "simPigeonIMU", - "version": "23.2.2", + "version": "24.1.0", "isJar": false, "skipInvalidPlatforms": true, "validPlatforms": [ @@ -133,7 +104,7 @@ { "groupId": "com.ctre.phoenix6.sim", "artifactId": "simCANCoder", - "version": "23.2.2", + "version": "24.1.0", "isJar": false, "skipInvalidPlatforms": true, "validPlatforms": [ @@ -146,7 +117,7 @@ { "groupId": "com.ctre.phoenix6.sim", "artifactId": "simProTalonFX", - "version": "23.2.2", + "version": "24.1.0", "isJar": false, "skipInvalidPlatforms": true, "validPlatforms": [ @@ -159,7 +130,7 @@ { "groupId": "com.ctre.phoenix6.sim", "artifactId": "simProCANcoder", - "version": "23.2.2", + "version": "24.1.0", "isJar": false, "skipInvalidPlatforms": true, "validPlatforms": [ @@ -172,7 +143,7 @@ { "groupId": "com.ctre.phoenix6.sim", "artifactId": "simProPigeon2", - "version": "23.2.2", + "version": "24.1.0", "isJar": false, "skipInvalidPlatforms": true, "validPlatforms": [ @@ -185,40 +156,10 @@ ], "cppDependencies": [ { - "groupId": "com.ctre.phoenix", + "groupId": "com.ctre.phoenix6", "artifactId": "wpiapi-cpp", - "version": "5.31.0", - "libName": "CTRE_Phoenix_WPI", - "headerClassifier": "headers", - "sharedLibrary": true, - "skipInvalidPlatforms": true, - "binaryPlatforms": [ - "windowsx86-64", - "linuxx86-64", - "linuxathena" - ], - "simMode": "hwsim" - }, - { - "groupId": "com.ctre.phoenix", - "artifactId": "api-cpp", - "version": "5.31.0", - "libName": "CTRE_Phoenix", - "headerClassifier": "headers", - "sharedLibrary": true, - "skipInvalidPlatforms": true, - "binaryPlatforms": [ - "windowsx86-64", - "linuxx86-64", - "linuxathena" - ], - "simMode": "hwsim" - }, - { - "groupId": "com.ctre.phoenix", - "artifactId": "cci", - "version": "5.31.0", - "libName": "CTRE_PhoenixCCI", + "version": "24.1.0", + "libName": "CTRE_Phoenix6_WPI", "headerClassifier": "headers", "sharedLibrary": true, "skipInvalidPlatforms": true, @@ -232,7 +173,7 @@ { "groupId": "com.ctre.phoenix6", "artifactId": "tools", - "version": "23.2.2", + "version": "24.1.0", "libName": "CTRE_PhoenixTools", "headerClassifier": "headers", "sharedLibrary": true, @@ -245,40 +186,10 @@ "simMode": "hwsim" }, { - "groupId": "com.ctre.phoenix.sim", + "groupId": "com.ctre.phoenix6.sim", "artifactId": "wpiapi-cpp-sim", - "version": "5.31.0", - "libName": "CTRE_Phoenix_WPISim", - "headerClassifier": "headers", - "sharedLibrary": true, - "skipInvalidPlatforms": true, - "binaryPlatforms": [ - "windowsx86-64", - "linuxx86-64", - "osxuniversal" - ], - "simMode": "swsim" - }, - { - "groupId": "com.ctre.phoenix.sim", - "artifactId": "api-cpp-sim", - "version": "5.31.0", - "libName": "CTRE_PhoenixSim", - "headerClassifier": "headers", - "sharedLibrary": true, - "skipInvalidPlatforms": true, - "binaryPlatforms": [ - "windowsx86-64", - "linuxx86-64", - "osxuniversal" - ], - "simMode": "swsim" - }, - { - "groupId": "com.ctre.phoenix.sim", - "artifactId": "cci-sim", - "version": "5.31.0", - "libName": "CTRE_PhoenixCCISim", + "version": "24.1.0", + "libName": "CTRE_Phoenix6_WPISim", "headerClassifier": "headers", "sharedLibrary": true, "skipInvalidPlatforms": true, @@ -292,7 +203,7 @@ { "groupId": "com.ctre.phoenix6.sim", "artifactId": "tools-sim", - "version": "23.2.2", + "version": "24.1.0", "libName": "CTRE_PhoenixTools_Sim", "headerClassifier": "headers", "sharedLibrary": true, @@ -307,7 +218,7 @@ { "groupId": "com.ctre.phoenix6.sim", "artifactId": "simTalonSRX", - "version": "23.2.2", + "version": "24.1.0", "libName": "CTRE_SimTalonSRX", "headerClassifier": "headers", "sharedLibrary": true, @@ -322,7 +233,7 @@ { "groupId": "com.ctre.phoenix6.sim", "artifactId": "simTalonFX", - "version": "23.2.2", + "version": "24.1.0", "libName": "CTRE_SimTalonFX", "headerClassifier": "headers", "sharedLibrary": true, @@ -337,7 +248,7 @@ { "groupId": "com.ctre.phoenix6.sim", "artifactId": "simVictorSPX", - "version": "23.2.2", + "version": "24.1.0", "libName": "CTRE_SimVictorSPX", "headerClassifier": "headers", "sharedLibrary": true, @@ -352,7 +263,7 @@ { "groupId": "com.ctre.phoenix6.sim", "artifactId": "simPigeonIMU", - "version": "23.2.2", + "version": "24.1.0", "libName": "CTRE_SimPigeonIMU", "headerClassifier": "headers", "sharedLibrary": true, @@ -367,7 +278,7 @@ { "groupId": "com.ctre.phoenix6.sim", "artifactId": "simCANCoder", - "version": "23.2.2", + "version": "24.1.0", "libName": "CTRE_SimCANCoder", "headerClassifier": "headers", "sharedLibrary": true, @@ -382,7 +293,7 @@ { "groupId": "com.ctre.phoenix6.sim", "artifactId": "simProTalonFX", - "version": "23.2.2", + "version": "24.1.0", "libName": "CTRE_SimProTalonFX", "headerClassifier": "headers", "sharedLibrary": true, @@ -397,7 +308,7 @@ { "groupId": "com.ctre.phoenix6.sim", "artifactId": "simProCANcoder", - "version": "23.2.2", + "version": "24.1.0", "libName": "CTRE_SimProCANcoder", "headerClassifier": "headers", "sharedLibrary": true, @@ -412,7 +323,7 @@ { "groupId": "com.ctre.phoenix6.sim", "artifactId": "simProPigeon2", - "version": "23.2.2", + "version": "24.1.0", "libName": "CTRE_SimProPigeon2", "headerClassifier": "headers", "sharedLibrary": true, @@ -423,36 +334,6 @@ "osxuniversal" ], "simMode": "swsim" - }, - { - "groupId": "com.ctre.phoenix6", - "artifactId": "wpiapi-cpp", - "version": "23.2.2", - "libName": "CTRE_Phoenix6_WPI", - "headerClassifier": "headers", - "sharedLibrary": true, - "skipInvalidPlatforms": true, - "binaryPlatforms": [ - "windowsx86-64", - "linuxx86-64", - "linuxathena" - ], - "simMode": "hwsim" - }, - { - "groupId": "com.ctre.phoenix6.sim", - "artifactId": "wpiapi-cpp-sim", - "version": "23.2.2", - "libName": "CTRE_Phoenix6_WPISim", - "headerClassifier": "headers", - "sharedLibrary": true, - "skipInvalidPlatforms": true, - "binaryPlatforms": [ - "windowsx86-64", - "linuxx86-64", - "osxuniversal" - ], - "simMode": "swsim" } ] } \ No newline at end of file From 9af5b93c36fe77cb406c6297c8f42b6b9734e9a4 Mon Sep 17 00:00:00 2001 From: Danny <75951607+dannynotsmart@users.noreply.github.com> Date: Fri, 19 Jan 2024 22:19:31 -0500 Subject: [PATCH 06/10] Update src/main/java/org/sciborgs1155/robot/drive/Drive.java Co-authored-by: Asa Paparo --- src/main/java/org/sciborgs1155/robot/drive/Drive.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/org/sciborgs1155/robot/drive/Drive.java b/src/main/java/org/sciborgs1155/robot/drive/Drive.java index 5a049b1..d603c60 100644 --- a/src/main/java/org/sciborgs1155/robot/drive/Drive.java +++ b/src/main/java/org/sciborgs1155/robot/drive/Drive.java @@ -314,7 +314,7 @@ public void simulationPeriodic() { lastRotation = lastRotation.rotateBy( Rotation2d.fromRadians( - kinematics.toChassisSpeeds(getModuleStates()).omegaRadiansPerSecond + kinematics.toChassisSpeeds(getModuleStates()).omegaRadiansPerSecond // TODO replace with getChassisSpeeds() * Constants.PERIOD.in(Seconds))); } From f3ffa511bc4831aedb3c01b41e29883cef0f4db7 Mon Sep 17 00:00:00 2001 From: Danny <75951607+dannynotsmart@users.noreply.github.com> Date: Fri, 19 Jan 2024 22:19:55 -0500 Subject: [PATCH 07/10] Update src/main/java/org/sciborgs1155/robot/drive/gyro/Navx.java Co-authored-by: Asa Paparo --- src/main/java/org/sciborgs1155/robot/drive/gyro/Navx.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/org/sciborgs1155/robot/drive/gyro/Navx.java b/src/main/java/org/sciborgs1155/robot/drive/gyro/Navx.java index 7d2af43..cf4baaa 100644 --- a/src/main/java/org/sciborgs1155/robot/drive/gyro/Navx.java +++ b/src/main/java/org/sciborgs1155/robot/drive/gyro/Navx.java @@ -6,7 +6,7 @@ import edu.wpi.first.wpilibj.SPI; public class Navx implements GyroIO { - private AHRS ahrs; + private final AHRS ahrs = new AHRS(); public Navx() { ahrs = new AHRS(SPI.Port.kMXP); From c1957ad93431d9b7bc774ac93c5922f1494c43f6 Mon Sep 17 00:00:00 2001 From: dannynotsmart <75951607+dannynotsmart@users.noreply.github.com> Date: Fri, 19 Jan 2024 23:05:27 -0500 Subject: [PATCH 08/10] implemented changes --- .../org/sciborgs1155/robot/drive/Drive.java | 8 ++--- .../sciborgs1155/robot/drive/gyro/GyroIO.java | 13 +-------- .../sciborgs1155/robot/drive/gyro/Navx.java | 29 +------------------ 3 files changed, 5 insertions(+), 45 deletions(-) diff --git a/src/main/java/org/sciborgs1155/robot/drive/Drive.java b/src/main/java/org/sciborgs1155/robot/drive/Drive.java index d603c60..b2e3f8f 100644 --- a/src/main/java/org/sciborgs1155/robot/drive/Drive.java +++ b/src/main/java/org/sciborgs1155/robot/drive/Drive.java @@ -270,10 +270,7 @@ public void resetLastRotation() { /** Zeroes the heading of the robot. */ public Command zeroHeading() { - return runOnce( - Robot.isReal() - ? gyro::reset - : this::resetLastRotation); // could be a lambda, idk i dont have intellisense so + return runOnce(Robot.isReal() ? gyro::reset : () -> lastRotation = new Rotation2d()); } /** Returns the module states. */ @@ -314,7 +311,8 @@ public void simulationPeriodic() { lastRotation = lastRotation.rotateBy( Rotation2d.fromRadians( - kinematics.toChassisSpeeds(getModuleStates()).omegaRadiansPerSecond // TODO replace with getChassisSpeeds() + kinematics.toChassisSpeeds(getModuleStates()) + .omegaRadiansPerSecond // TODO replace with getChassisSpeeds() * Constants.PERIOD.in(Seconds))); } diff --git a/src/main/java/org/sciborgs1155/robot/drive/gyro/GyroIO.java b/src/main/java/org/sciborgs1155/robot/drive/gyro/GyroIO.java index f390b9e..ee80548 100644 --- a/src/main/java/org/sciborgs1155/robot/drive/gyro/GyroIO.java +++ b/src/main/java/org/sciborgs1155/robot/drive/gyro/GyroIO.java @@ -17,18 +17,7 @@ public default Rotation2d getRotation2d() { } /** Returns the heading of the robot as a Rotation3d. */ - public default Rotation3d getRotation3d() { - return new Rotation3d(getYaw(), getPitch(), getPitch()); - } - - /** Returns the yaw value */ - public double getYaw(); - - /** Returns the pitch value */ - public double getPitch(); - - /** Returns the roll value */ - public double getRoll(); + public Rotation3d getRotation3d(); /** Resets heading to 0 */ public void reset(); diff --git a/src/main/java/org/sciborgs1155/robot/drive/gyro/Navx.java b/src/main/java/org/sciborgs1155/robot/drive/gyro/Navx.java index cf4baaa..c83385d 100644 --- a/src/main/java/org/sciborgs1155/robot/drive/gyro/Navx.java +++ b/src/main/java/org/sciborgs1155/robot/drive/gyro/Navx.java @@ -1,45 +1,18 @@ package org.sciborgs1155.robot.drive.gyro; import com.kauailabs.navx.frc.AHRS; -import edu.wpi.first.math.geometry.Rotation2d; import edu.wpi.first.math.geometry.Rotation3d; -import edu.wpi.first.wpilibj.SPI; public class Navx implements GyroIO { private final AHRS ahrs = new AHRS(); - public Navx() { - ahrs = new AHRS(SPI.Port.kMXP); - } - public double getRate() { return ahrs.getRate(); } - @Override - public Rotation2d getRotation2d() { - return ahrs - .getRotation2d(); // dunno if using the built in method is faster/better, but if not, this - // can be removed - } - @Override public Rotation3d getRotation3d() { - return ahrs - .getRotation3d(); // dunno if using the built in method is faster/better, but if not, this - // can be removed - } - - public double getYaw() { - return ahrs.getYaw(); - } - - public double getPitch() { - return ahrs.getPitch(); - } - - public double getRoll() { - return ahrs.getRoll(); + return ahrs.getRotation3d(); } public void reset() { From 68019b2c68013906a48c74c8d3ad770a56c379ed Mon Sep 17 00:00:00 2001 From: dannynotsmart <75951607+dannynotsmart@users.noreply.github.com> Date: Fri, 19 Jan 2024 23:15:08 -0500 Subject: [PATCH 09/10] getchasisspeed --- src/main/java/org/sciborgs1155/robot/drive/Drive.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/sciborgs1155/robot/drive/Drive.java b/src/main/java/org/sciborgs1155/robot/drive/Drive.java index b2e3f8f..2019024 100644 --- a/src/main/java/org/sciborgs1155/robot/drive/Drive.java +++ b/src/main/java/org/sciborgs1155/robot/drive/Drive.java @@ -279,6 +279,11 @@ private SwerveModuleState[] getModuleStates() { return modules.stream().map(SwerveModule::state).toArray(SwerveModuleState[]::new); } + /** Returns the chassis speed. */ + public ChassisSpeeds getChassisSpeed() { + return kinematics.toChassisSpeeds(getModuleStates()); + } + /** Returns the module positions */ @Log.NT private SwerveModulePosition[] getModulePositions() { @@ -311,8 +316,7 @@ public void simulationPeriodic() { lastRotation = lastRotation.rotateBy( Rotation2d.fromRadians( - kinematics.toChassisSpeeds(getModuleStates()) - .omegaRadiansPerSecond // TODO replace with getChassisSpeeds() + getChassisSpeed().omegaRadiansPerSecond // TODO replace with getChassisSpeeds() * Constants.PERIOD.in(Seconds))); } @@ -369,5 +373,6 @@ public void close() throws Exception { frontRight.close(); rearLeft.close(); rearRight.close(); + gyro.close(); } } From b39940e1206c6950f426388b6de5e7330af1afe6 Mon Sep 17 00:00:00 2001 From: warren yun Date: Sat, 20 Jan 2024 14:12:37 -0500 Subject: [PATCH 10/10] yes --- simgui.json | 6 +++-- .../org/sciborgs1155/robot/drive/Drive.java | 26 ++++++++++++++----- .../org/sciborgs1155/robot/drive/GyroIO.java | 21 +++++++++++++++ 3 files changed, 45 insertions(+), 8 deletions(-) diff --git a/simgui.json b/simgui.json index 0e83e79..0e2bb2f 100644 --- a/simgui.json +++ b/simgui.json @@ -51,6 +51,9 @@ "Robot": { "drive": { "Pose2d##v_/Robot/drive/getPose": { + "Rotation2d##v_rotation": { + "open": true + }, "open": true }, "frontRight": { @@ -68,8 +71,7 @@ }, "driveFeedback": { "open": true - }, - "open": true + } }, "open": true }, diff --git a/src/main/java/org/sciborgs1155/robot/drive/Drive.java b/src/main/java/org/sciborgs1155/robot/drive/Drive.java index 460fbdc..3ff11d5 100644 --- a/src/main/java/org/sciborgs1155/robot/drive/Drive.java +++ b/src/main/java/org/sciborgs1155/robot/drive/Drive.java @@ -42,7 +42,8 @@ public class Drive extends SubsystemBase implements Logged, AutoCloseable { @IgnoreLogged private final List modules; - @Log.NT private final GyroIO gyro = new GyroIO.NavX(); + private final GyroIO gyro; + private static Rotation2d simRotation = new Rotation2d(); public final SwerveDriveKinematics kinematics = new SwerveDriveKinematics(MODULE_OFFSET); @@ -66,16 +67,24 @@ public static Drive create() { new FlexModule(FRONT_LEFT_DRIVE, FRONT_LEFT_TURNING, ANGULAR_OFFSETS.get(0)), new FlexModule(FRONT_RIGHT_DRIVE, FRONT_RIGHT_TURNING, ANGULAR_OFFSETS.get(1)), new FlexModule(REAR_LEFT_DRIVE, REAR_LEFT_TURNING, ANGULAR_OFFSETS.get(2)), - new FlexModule(REAR_RIGHT_DRIVE, REAR_RIGHT_TURNING, ANGULAR_OFFSETS.get(3))) - : new Drive(new SimModule(), new SimModule(), new SimModule(), new SimModule()); + new FlexModule(REAR_RIGHT_DRIVE, REAR_RIGHT_TURNING, ANGULAR_OFFSETS.get(3)), + new GyroIO.NavX()) + : new Drive( + new SimModule(), + new SimModule(), + new SimModule(), + new SimModule(), + new GyroIO.NoGyro()); } /** A swerve drive subsystem containing four {@link ModuleIO} modules. */ - public Drive(ModuleIO frontLeft, ModuleIO frontRight, ModuleIO rearLeft, ModuleIO rearRight) { + public Drive( + ModuleIO frontLeft, ModuleIO frontRight, ModuleIO rearLeft, ModuleIO rearRight, GyroIO gyro) { this.frontLeft = new SwerveModule(frontLeft, ANGULAR_OFFSETS.get(0), " FL"); this.frontRight = new SwerveModule(frontRight, ANGULAR_OFFSETS.get(1), "FR"); this.rearLeft = new SwerveModule(rearLeft, ANGULAR_OFFSETS.get(2), "RL"); this.rearRight = new SwerveModule(rearRight, ANGULAR_OFFSETS.get(3), " RR"); + this.gyro = gyro; modules = List.of(this.frontLeft, this.frontRight, this.rearLeft, this.rearRight); modules2d = new FieldObject2d[modules.size()]; @@ -242,7 +251,7 @@ public void updateEstimates(EstimatedRobotPose... poses) { @Override public void periodic() { - odometry.update(gyro.getRotation2d(), getModulePositions()); + odometry.update(Robot.isReal() ? gyro.getRotation2d() : simRotation, getModulePositions()); field2d.setRobotPose(getPose()); @@ -254,7 +263,12 @@ public void periodic() { } @Override - public void simulationPeriodic() {} + public void simulationPeriodic() { + simRotation = + simRotation.rotateBy( + Rotation2d.fromRadians( + getChassisSpeed().omegaRadiansPerSecond * Constants.PERIOD.in(Seconds))); + } /** Stops drivetrain */ public Command stop() { diff --git a/src/main/java/org/sciborgs1155/robot/drive/GyroIO.java b/src/main/java/org/sciborgs1155/robot/drive/GyroIO.java index fe8624b..d558b9c 100644 --- a/src/main/java/org/sciborgs1155/robot/drive/GyroIO.java +++ b/src/main/java/org/sciborgs1155/robot/drive/GyroIO.java @@ -23,6 +23,7 @@ public default Rotation2d getRotation2d() { /** Resets heading to 0 */ public void reset(); + /** GyroIO implementation for NavX */ public class NavX implements GyroIO { private final AHRS ahrs = new AHRS(); @@ -42,4 +43,24 @@ public void reset() { @Override public void close() throws Exception {} } + + /** GyroIO implementation for nonexistent gyro */ + public class NoGyro implements GyroIO { + + @Override + public void close() throws Exception {} + + @Override + public double getRate() { + return 0; + } + + @Override + public Rotation3d getRotation3d() { + return new Rotation3d(); + } + + @Override + public void reset() {} + } }