benchmarking

This commit is contained in:
Michael Mikovsky
2024-07-11 09:10:30 -06:00
parent c4fc0271bc
commit 578b749186
5 changed files with 18 additions and 65 deletions
@@ -181,11 +181,12 @@ public class RobotContainer {
// drives the robot with a two-axis input from the driver controller // drives the robot with a two-axis input from the driver controller
// ! Swerve Drive Default Command (Regular Rotation) // ! Swerve Drive Default Command (Regular Rotation)
m_robotSwerveDrive.setDefaultCommand(new RunCommand(() -> { m_robotSwerveDrive.setDefaultCommand(new RunCommand(() -> {
m_robotSwerveDrive.driveWithInput(getDeadbandedDriverController().getLeft(), m_robotSwerveDrive.driveWithInput(getDeadbandedDriverController().getRightTrigger(),
getDeadbandedDriverController().getRight(), getDeadbandedDriverController().getRight(),
true); true);
}, m_robotSwerveDrive) }, m_robotSwerveDrive)
.withName("SwerveDrive DefaultCommand")); .withName("SwerveDrive DefaultCommand"));
m_robotSwerveDrive.hellsHorses();
// ! Swerve Drive Default Command (Orientation Rotation) // ! Swerve Drive Default Command (Orientation Rotation)
// m_robotSwerveDrive.setDefaultCommand(new RunCommand(() -> { // m_robotSwerveDrive.setDefaultCommand(new RunCommand(() -> {
@@ -222,10 +223,10 @@ public class RobotContainer {
.onFalse(new InstantCommand(() -> m_robotSwerveDrive.add180())); .onFalse(new InstantCommand(() -> m_robotSwerveDrive.add180()));
// * /* D-Pad Stuff */ // * /* D-Pad Stuff */
// new Trigger(() -> getDeadbandedDriverController().getRawAxis(XboxController.TOP_BOTTOM_DPAD_AXIS) > 0.9) // new Trigger(() -> getDeadbandedDriverController().getPOV() == 0)
// .onTrue(new InstantCommand(() -> m_robotSwerveDrive.driveWithInput(new Translation2d(0, 1), // .whileTrue(new InstantCommand(() -> m_robotSwerveDrive.driveWithInput(new Translation2d(0, 1),
// new Translation2d(0, 0), // new Translation2d(0, 0),
// true))) // true), m_robotSwerveDrive))
// .onFalse(new InstantCommand(() -> m_robotSwerveDrive.driveWithInput(new Translation2d(0, 0), // .onFalse(new InstantCommand(() -> m_robotSwerveDrive.driveWithInput(new Translation2d(0, 0),
// new Translation2d(0, 0), // new Translation2d(0, 0),
// true))); // true)));
@@ -252,7 +253,7 @@ public class RobotContainer {
// true))) // true)))
// .onFalse(new InstantCommand(() -> m_robotSwerveDrive.driveWithInput(new Translation2d(0, 0), // .onFalse(new InstantCommand(() -> m_robotSwerveDrive.driveWithInput(new Translation2d(0, 0),
// new Translation2d(0, 0), // new Translation2d(0, 0),
// true))); // true)));
// ! /* Auto Recording */ // ! /* Auto Recording */
new JoystickButton(m_autoRecorderXbox, XboxController.LEFT_BUMPER_BUTTON) new JoystickButton(m_autoRecorderXbox, XboxController.LEFT_BUMPER_BUTTON)
@@ -219,7 +219,8 @@ public class SwerveDrive extends SubsystemBase {
@Override @Override
public void periodic() { public void periodic() {
// This method will be called once per scheduler run\ // 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; private int GEAR = SwerveDriveConstants.SPEEDS.length /2;
@@ -229,6 +230,10 @@ public class SwerveDrive extends SubsystemBase {
this.speedAdjust = SwerveDriveConstants.SPEEDS[GEAR]; this.speedAdjust = SwerveDriveConstants.SPEEDS[GEAR];
} }
} }
public void hellsHorses() {
speedAdjust = 20;
}
public void shiftUp() { public void shiftUp() {
if(GEAR < SwerveDriveConstants.SPEEDS.length){ if(GEAR < SwerveDriveConstants.SPEEDS.length){
@@ -68,7 +68,11 @@ public class SwerveModule extends SubsystemBase {
// SmartDashboard.putNumber("Angular Position: " + selfid, getAngle().getDegrees()); // SmartDashboard.putNumber("Angular Position: " + selfid, getAngle().getDegrees());
// SmartDashboard.putNumber("Angular Velocity: " + selfid, getAngularVel()); // SmartDashboard.putNumber("Angular Velocity: " + selfid, getAngularVel());
// SmartDashboard.putNumber("Drive Position: " + selfid, getDrivePos()); // 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 * Get the drive motor of the SwerveModule
@@ -15,7 +15,7 @@ public class DeadbandedXboxController extends XboxController {
public Translation2d getLeft() { return skewToDeadzonedCircle(super.getLeftX(), super.getLeftY()); } public Translation2d getLeft() { return skewToDeadzonedCircle(super.getLeftX(), super.getLeftY()); }
public Translation2d getRight() { return skewToDeadzonedCircle(-super.getRightX(), super.getRightY()); } 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) { public static Translation2d skewToDeadzonedCircle(double x, double y) {
Translation2d translation2d = new Translation2d(x, y); Translation2d translation2d = new Translation2d(x, y);
double magnitude = translation2d.getNorm(); double magnitude = translation2d.getNorm();
-57
View File
@@ -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"
}
]
}