Skip to content

Commit

Permalink
Merge branch 'main' into unit_tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jhhbrown1 committed Feb 8, 2025
2 parents c413d9c + 0e6c228 commit 4dc869d
Show file tree
Hide file tree
Showing 5 changed files with 80 additions and 48 deletions.
2 changes: 1 addition & 1 deletion src/main/java/frc/robot/Robot.java
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public void bindDriveControls() {
m_driveSubsystem.driveCommand(
() -> -m_driverController.getLeftY(),
() -> -m_driverController.getLeftX(),
() -> m_driverController.getR2Axis() - m_driverController.getL2Axis(),
() -> m_driverController.getL2Axis() - m_driverController.getR2Axis(),
m_driverController.getHID()::getSquareButton));
Transform2d robotToTarget = new Transform2d(.8, 0, Rotation2d.fromDegrees(180));
for (int i = 1; i <= 2; i++)
Expand Down
13 changes: 9 additions & 4 deletions src/main/java/frc/robot/subsystems/DriveSubsystem.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public class DriveSubsystem extends SubsystemBase implements AutoCloseable {
kFrontLeftLocation, kFrontRightLocation, kBackLeftLocation, kBackRightLocation);
private final SwerveDriveOdometry m_odometry;
private final AHRS m_gyro = new AHRS(NavXComType.kMXP_SPI);
private final SimDouble m_gyroSim = new SimDeviceSim("navX-Sensor", m_gyro.getPort()).getDouble("Yaw");
private final SimDouble m_gyroSim;
// https://docs.wpilib.org/en/latest/docs/software/advanced-controls/system-identification/index.html
private final SysIdRoutine m_sysidRoutine;

Expand Down Expand Up @@ -90,6 +90,11 @@ public DriveSubsystem() {
e.printStackTrace();
}
m_odometry = new SwerveDriveOdometry(m_kinematics, getHeading(), getModulePositions());
if (RobotBase.isSimulation()) {
m_gyroSim = new SimDeviceSim("navX-Sensor", m_gyro.getPort()).getDouble("Yaw");
} else {
m_gyroSim = null;
}
}

@Override
Expand Down Expand Up @@ -223,12 +228,12 @@ public void periodic() {
* go to the left (+Y direction).
* @param rotation Rotation speed supplier. Positive values make the
* robot rotate CCW.
* @param isFieldRelative Supplier for determining if driving should be field
* @param isRobotRelative Supplier for determining if driving should be robot
* relative.
* @return A command to drive the robot.
*/
public Command driveCommand(DoubleSupplier forwardSpeed, DoubleSupplier strafeSpeed,
DoubleSupplier rotation, BooleanSupplier isFieldRelative) {
DoubleSupplier rotation, BooleanSupplier isRobotRelative) {
return run(() -> {
// Get the forward, strafe, and rotation speed, using a deadband on the joystick
// input so slight movements don't move the robot
Expand All @@ -241,7 +246,7 @@ public Command driveCommand(DoubleSupplier forwardSpeed, DoubleSupplier strafeSp
double strSpeed = MathUtil.applyDeadband(strafeSpeed.getAsDouble(), ControllerConstants.kDeadzone);
strSpeed = Math.signum(strSpeed) * Math.pow(strSpeed, 2) * kTeleopMaxVoltage;

drive(fwdSpeed, strSpeed, rotSpeed, isFieldRelative.getAsBoolean());
drive(fwdSpeed, strSpeed, rotSpeed, !isRobotRelative.getAsBoolean());
}).withName("DefaultDriveCommand");
}

Expand Down
84 changes: 57 additions & 27 deletions vendordeps/Phoenix6-25.1.0.json → vendordeps/Phoenix6-25.2.1.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"fileName": "Phoenix6-25.1.0.json",
"fileName": "Phoenix6-25.2.1.json",
"name": "CTRE-Phoenix (v6)",
"version": "25.1.0",
"version": "25.2.1",
"frcYear": "2025",
"uuid": "e995de00-2c64-4df5-8831-c1441420ff19",
"mavenUrls": [
Expand All @@ -19,14 +19,14 @@
{
"groupId": "com.ctre.phoenix6",
"artifactId": "wpiapi-java",
"version": "25.1.0"
"version": "25.2.1"
}
],
"jniDependencies": [
{
"groupId": "com.ctre.phoenix6",
"artifactId": "api-cpp",
"version": "25.1.0",
"version": "25.2.1",
"isJar": false,
"skipInvalidPlatforms": true,
"validPlatforms": [
Expand All @@ -40,7 +40,7 @@
{
"groupId": "com.ctre.phoenix6",
"artifactId": "tools",
"version": "25.1.0",
"version": "25.2.1",
"isJar": false,
"skipInvalidPlatforms": true,
"validPlatforms": [
Expand All @@ -54,7 +54,7 @@
{
"groupId": "com.ctre.phoenix6.sim",
"artifactId": "api-cpp-sim",
"version": "25.1.0",
"version": "25.2.1",
"isJar": false,
"skipInvalidPlatforms": true,
"validPlatforms": [
Expand All @@ -68,7 +68,7 @@
{
"groupId": "com.ctre.phoenix6.sim",
"artifactId": "tools-sim",
"version": "25.1.0",
"version": "25.2.1",
"isJar": false,
"skipInvalidPlatforms": true,
"validPlatforms": [
Expand All @@ -82,7 +82,7 @@
{
"groupId": "com.ctre.phoenix6.sim",
"artifactId": "simTalonSRX",
"version": "25.1.0",
"version": "25.2.1",
"isJar": false,
"skipInvalidPlatforms": true,
"validPlatforms": [
Expand All @@ -96,7 +96,7 @@
{
"groupId": "com.ctre.phoenix6.sim",
"artifactId": "simVictorSPX",
"version": "25.1.0",
"version": "25.2.1",
"isJar": false,
"skipInvalidPlatforms": true,
"validPlatforms": [
Expand All @@ -110,7 +110,7 @@
{
"groupId": "com.ctre.phoenix6.sim",
"artifactId": "simPigeonIMU",
"version": "25.1.0",
"version": "25.2.1",
"isJar": false,
"skipInvalidPlatforms": true,
"validPlatforms": [
Expand All @@ -124,7 +124,7 @@
{
"groupId": "com.ctre.phoenix6.sim",
"artifactId": "simCANCoder",
"version": "25.1.0",
"version": "25.2.1",
"isJar": false,
"skipInvalidPlatforms": true,
"validPlatforms": [
Expand All @@ -138,7 +138,21 @@
{
"groupId": "com.ctre.phoenix6.sim",
"artifactId": "simProTalonFX",
"version": "25.1.0",
"version": "25.2.1",
"isJar": false,
"skipInvalidPlatforms": true,
"validPlatforms": [
"windowsx86-64",
"linuxx86-64",
"linuxarm64",
"osxuniversal"
],
"simMode": "swsim"
},
{
"groupId": "com.ctre.phoenix6.sim",
"artifactId": "simProTalonFXS",
"version": "25.2.1",
"isJar": false,
"skipInvalidPlatforms": true,
"validPlatforms": [
Expand All @@ -152,7 +166,7 @@
{
"groupId": "com.ctre.phoenix6.sim",
"artifactId": "simProCANcoder",
"version": "25.1.0",
"version": "25.2.1",
"isJar": false,
"skipInvalidPlatforms": true,
"validPlatforms": [
Expand All @@ -166,7 +180,7 @@
{
"groupId": "com.ctre.phoenix6.sim",
"artifactId": "simProPigeon2",
"version": "25.1.0",
"version": "25.2.1",
"isJar": false,
"skipInvalidPlatforms": true,
"validPlatforms": [
Expand All @@ -180,7 +194,7 @@
{
"groupId": "com.ctre.phoenix6.sim",
"artifactId": "simProCANrange",
"version": "25.1.0",
"version": "25.2.1",
"isJar": false,
"skipInvalidPlatforms": true,
"validPlatforms": [
Expand All @@ -196,7 +210,7 @@
{
"groupId": "com.ctre.phoenix6",
"artifactId": "wpiapi-cpp",
"version": "25.1.0",
"version": "25.2.1",
"libName": "CTRE_Phoenix6_WPI",
"headerClassifier": "headers",
"sharedLibrary": true,
Expand All @@ -212,7 +226,7 @@
{
"groupId": "com.ctre.phoenix6",
"artifactId": "tools",
"version": "25.1.0",
"version": "25.2.1",
"libName": "CTRE_PhoenixTools",
"headerClassifier": "headers",
"sharedLibrary": true,
Expand All @@ -228,7 +242,7 @@
{
"groupId": "com.ctre.phoenix6.sim",
"artifactId": "wpiapi-cpp-sim",
"version": "25.1.0",
"version": "25.2.1",
"libName": "CTRE_Phoenix6_WPISim",
"headerClassifier": "headers",
"sharedLibrary": true,
Expand All @@ -244,7 +258,7 @@
{
"groupId": "com.ctre.phoenix6.sim",
"artifactId": "tools-sim",
"version": "25.1.0",
"version": "25.2.1",
"libName": "CTRE_PhoenixTools_Sim",
"headerClassifier": "headers",
"sharedLibrary": true,
Expand All @@ -260,7 +274,7 @@
{
"groupId": "com.ctre.phoenix6.sim",
"artifactId": "simTalonSRX",
"version": "25.1.0",
"version": "25.2.1",
"libName": "CTRE_SimTalonSRX",
"headerClassifier": "headers",
"sharedLibrary": true,
Expand All @@ -276,7 +290,7 @@
{
"groupId": "com.ctre.phoenix6.sim",
"artifactId": "simVictorSPX",
"version": "25.1.0",
"version": "25.2.1",
"libName": "CTRE_SimVictorSPX",
"headerClassifier": "headers",
"sharedLibrary": true,
Expand All @@ -292,7 +306,7 @@
{
"groupId": "com.ctre.phoenix6.sim",
"artifactId": "simPigeonIMU",
"version": "25.1.0",
"version": "25.2.1",
"libName": "CTRE_SimPigeonIMU",
"headerClassifier": "headers",
"sharedLibrary": true,
Expand All @@ -308,7 +322,7 @@
{
"groupId": "com.ctre.phoenix6.sim",
"artifactId": "simCANCoder",
"version": "25.1.0",
"version": "25.2.1",
"libName": "CTRE_SimCANCoder",
"headerClassifier": "headers",
"sharedLibrary": true,
Expand All @@ -324,7 +338,7 @@
{
"groupId": "com.ctre.phoenix6.sim",
"artifactId": "simProTalonFX",
"version": "25.1.0",
"version": "25.2.1",
"libName": "CTRE_SimProTalonFX",
"headerClassifier": "headers",
"sharedLibrary": true,
Expand All @@ -337,10 +351,26 @@
],
"simMode": "swsim"
},
{
"groupId": "com.ctre.phoenix6.sim",
"artifactId": "simProTalonFXS",
"version": "25.2.1",
"libName": "CTRE_SimProTalonFXS",
"headerClassifier": "headers",
"sharedLibrary": true,
"skipInvalidPlatforms": true,
"binaryPlatforms": [
"windowsx86-64",
"linuxx86-64",
"linuxarm64",
"osxuniversal"
],
"simMode": "swsim"
},
{
"groupId": "com.ctre.phoenix6.sim",
"artifactId": "simProCANcoder",
"version": "25.1.0",
"version": "25.2.1",
"libName": "CTRE_SimProCANcoder",
"headerClassifier": "headers",
"sharedLibrary": true,
Expand All @@ -356,7 +386,7 @@
{
"groupId": "com.ctre.phoenix6.sim",
"artifactId": "simProPigeon2",
"version": "25.1.0",
"version": "25.2.1",
"libName": "CTRE_SimProPigeon2",
"headerClassifier": "headers",
"sharedLibrary": true,
Expand All @@ -372,7 +402,7 @@
{
"groupId": "com.ctre.phoenix6.sim",
"artifactId": "simProCANrange",
"version": "25.1.0",
"version": "25.2.1",
"libName": "CTRE_SimProCANrange",
"headerClassifier": "headers",
"sharedLibrary": true,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"fileName": "REVLib-2025.0.0.json",
"fileName": "REVLib-2025.0.2.json",
"name": "REVLib",
"version": "2025.0.0",
"version": "2025.0.2",
"frcYear": "2025",
"uuid": "3f48eb8c-50fe-43a6-9cb7-44c86353c4cb",
"mavenUrls": [
Expand All @@ -12,19 +12,18 @@
{
"groupId": "com.revrobotics.frc",
"artifactId": "REVLib-java",
"version": "2025.0.0"
"version": "2025.0.2"
}
],
"jniDependencies": [
{
"groupId": "com.revrobotics.frc",
"artifactId": "REVLib-driver",
"version": "2025.0.0",
"version": "2025.0.2",
"skipInvalidPlatforms": true,
"isJar": false,
"validPlatforms": [
"windowsx86-64",
"windowsx86",
"linuxarm64",
"linuxx86-64",
"linuxathena",
Expand All @@ -37,14 +36,13 @@
{
"groupId": "com.revrobotics.frc",
"artifactId": "REVLib-cpp",
"version": "2025.0.0",
"version": "2025.0.2",
"libName": "REVLib",
"headerClassifier": "headers",
"sharedLibrary": false,
"skipInvalidPlatforms": true,
"binaryPlatforms": [
"windowsx86-64",
"windowsx86",
"linuxarm64",
"linuxx86-64",
"linuxathena",
Expand All @@ -55,14 +53,13 @@
{
"groupId": "com.revrobotics.frc",
"artifactId": "REVLib-driver",
"version": "2025.0.0",
"version": "2025.0.2",
"libName": "REVLibDriver",
"headerClassifier": "headers",
"sharedLibrary": false,
"skipInvalidPlatforms": true,
"binaryPlatforms": [
"windowsx86-64",
"windowsx86",
"linuxarm64",
"linuxx86-64",
"linuxathena",
Expand Down
Loading

0 comments on commit 4dc869d

Please sign in to comment.