From 578b749186ee38afea4e142fd6b0bcd58a5cff00 Mon Sep 17 00:00:00 2001 From: Michael Mikovsky <77305074+Astatin3@users.noreply.github.com> Date: Thu, 11 Jul 2024 09:10:30 -0600 Subject: [PATCH] benchmarking --- .../java/frc4388/robot/RobotContainer.java | 11 ++-- .../frc4388/robot/subsystems/SwerveDrive.java | 7 ++- .../robot/subsystems/SwerveModule.java | 6 +- .../controller/DeadbandedXboxController.java | 2 +- vendordeps/photonlib.json | 57 ------------------- 5 files changed, 18 insertions(+), 65 deletions(-) delete mode 100644 vendordeps/photonlib.json diff --git a/src/main/java/frc4388/robot/RobotContainer.java b/src/main/java/frc4388/robot/RobotContainer.java index 3e517b1..c7b21a3 100644 --- a/src/main/java/frc4388/robot/RobotContainer.java +++ b/src/main/java/frc4388/robot/RobotContainer.java @@ -181,11 +181,12 @@ public class RobotContainer { // drives the robot with a two-axis input from the driver controller // ! Swerve Drive Default Command (Regular Rotation) m_robotSwerveDrive.setDefaultCommand(new RunCommand(() -> { - m_robotSwerveDrive.driveWithInput(getDeadbandedDriverController().getLeft(), + m_robotSwerveDrive.driveWithInput(getDeadbandedDriverController().getRightTrigger(), getDeadbandedDriverController().getRight(), true); }, m_robotSwerveDrive) .withName("SwerveDrive DefaultCommand")); + m_robotSwerveDrive.hellsHorses(); // ! Swerve Drive Default Command (Orientation Rotation) // m_robotSwerveDrive.setDefaultCommand(new RunCommand(() -> { @@ -222,10 +223,10 @@ public class RobotContainer { .onFalse(new InstantCommand(() -> m_robotSwerveDrive.add180())); // * /* D-Pad Stuff */ - // new Trigger(() -> getDeadbandedDriverController().getRawAxis(XboxController.TOP_BOTTOM_DPAD_AXIS) > 0.9) - // .onTrue(new InstantCommand(() -> m_robotSwerveDrive.driveWithInput(new Translation2d(0, 1), + // new Trigger(() -> getDeadbandedDriverController().getPOV() == 0) + // .whileTrue(new InstantCommand(() -> m_robotSwerveDrive.driveWithInput(new Translation2d(0, 1), // new Translation2d(0, 0), - // true))) + // true), m_robotSwerveDrive)) // .onFalse(new InstantCommand(() -> m_robotSwerveDrive.driveWithInput(new Translation2d(0, 0), // new Translation2d(0, 0), // true))); @@ -252,7 +253,7 @@ public class RobotContainer { // true))) // .onFalse(new InstantCommand(() -> m_robotSwerveDrive.driveWithInput(new Translation2d(0, 0), // new Translation2d(0, 0), - // true))); + // true))); // ! /* Auto Recording */ new JoystickButton(m_autoRecorderXbox, XboxController.LEFT_BUMPER_BUTTON) diff --git a/src/main/java/frc4388/robot/subsystems/SwerveDrive.java b/src/main/java/frc4388/robot/subsystems/SwerveDrive.java index 98feae6..bd5e344 100644 --- a/src/main/java/frc4388/robot/subsystems/SwerveDrive.java +++ b/src/main/java/frc4388/robot/subsystems/SwerveDrive.java @@ -219,7 +219,8 @@ public class SwerveDrive extends SubsystemBase { @Override public void periodic() { // This method will be called once per scheduler run\ - // SmartDashboard.putNumber("Gyro", getGyroAngle()); + SmartDashboard.putNumber("Gyro", getGyroAngle()); + // SmartDashboard.putNumber("Volocity", gyro.getPigeon().) } private int GEAR = SwerveDriveConstants.SPEEDS.length /2; @@ -229,6 +230,10 @@ public class SwerveDrive extends SubsystemBase { this.speedAdjust = SwerveDriveConstants.SPEEDS[GEAR]; } } + + public void hellsHorses() { + speedAdjust = 20; + } public void shiftUp() { if(GEAR < SwerveDriveConstants.SPEEDS.length){ diff --git a/src/main/java/frc4388/robot/subsystems/SwerveModule.java b/src/main/java/frc4388/robot/subsystems/SwerveModule.java index 1b8c36c..8893fcf 100644 --- a/src/main/java/frc4388/robot/subsystems/SwerveModule.java +++ b/src/main/java/frc4388/robot/subsystems/SwerveModule.java @@ -68,7 +68,11 @@ public class SwerveModule extends SubsystemBase { // SmartDashboard.putNumber("Angular Position: " + selfid, getAngle().getDegrees()); // SmartDashboard.putNumber("Angular Velocity: " + selfid, getAngularVel()); // SmartDashboard.putNumber("Drive Position: " + selfid, getDrivePos()); - // SmartDashboard.putNumber("Drive Velocity: " + selfid, getDriveVel()); + SmartDashboard.putNumber("Drive Velocity: " + selfid, getDriveVel()); + SmartDashboard.putNumber("Drive Powerdraw: " + selfid, driveMotor.getMotorOutputVoltage()); + System.out.println("Drive Velocity: " + selfid + ", " + getDriveVel()); + System.out.println("Drive Powerdraw: " + selfid + ", " + driveMotor.getMotorOutputVoltage()); + } /** * Get the drive motor of the SwerveModule diff --git a/src/main/java/frc4388/utility/controller/DeadbandedXboxController.java b/src/main/java/frc4388/utility/controller/DeadbandedXboxController.java index 4577a2e..bab6c8e 100644 --- a/src/main/java/frc4388/utility/controller/DeadbandedXboxController.java +++ b/src/main/java/frc4388/utility/controller/DeadbandedXboxController.java @@ -15,7 +15,7 @@ public class DeadbandedXboxController extends XboxController { public Translation2d getLeft() { return skewToDeadzonedCircle(super.getLeftX(), super.getLeftY()); } public Translation2d getRight() { return skewToDeadzonedCircle(-super.getRightX(), super.getRightY()); } - + public Translation2d getRightTrigger() {return skewToDeadzonedCircle(0, -getRightTriggerAxis() + getLeftTriggerAxis());} public static Translation2d skewToDeadzonedCircle(double x, double y) { Translation2d translation2d = new Translation2d(x, y); double magnitude = translation2d.getNorm(); diff --git a/vendordeps/photonlib.json b/vendordeps/photonlib.json deleted file mode 100644 index 7bdce28..0000000 --- a/vendordeps/photonlib.json +++ /dev/null @@ -1,57 +0,0 @@ -{ - "fileName": "photonlib.json", - "name": "photonlib", - "version": "v2024.1.4", - "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.4", - "libName": "photonlib", - "headerClassifier": "headers", - "sharedLibrary": true, - "skipInvalidPlatforms": true, - "binaryPlatforms": [ - "windowsx86-64", - "linuxathena", - "linuxx86-64", - "osxuniversal" - ] - }, - { - "groupId": "org.photonvision", - "artifactId": "photontargeting-cpp", - "version": "v2024.1.4", - "libName": "photontargeting", - "headerClassifier": "headers", - "sharedLibrary": true, - "skipInvalidPlatforms": true, - "binaryPlatforms": [ - "windowsx86-64", - "linuxathena", - "linuxx86-64", - "osxuniversal" - ] - } - ], - "javaDependencies": [ - { - "groupId": "org.photonvision", - "artifactId": "photonlib-java", - "version": "v2024.1.4" - }, - { - "groupId": "org.photonvision", - "artifactId": "photontargeting-java", - "version": "v2024.1.4" - } - ] -} \ No newline at end of file