diff --git a/build.gradle b/build.gradle index 98b3256..20dca81 100644 --- a/build.gradle +++ b/build.gradle @@ -42,7 +42,7 @@ tasks.register('checkAkitInstall', JavaExec) { } compileJava.finalizedBy checkAkitInstall -project.compileJava.dependsOn(createVersionFile) +project.assemble.dependsOn(createVersionFile) gversion { srcDir = "src/main/java/" classPackage = "" diff --git a/src/main/java/com/frcteam3636/frc2024/Robot.kt b/src/main/java/com/frcteam3636/frc2024/Robot.kt index 4ea5dce..296238a 100644 --- a/src/main/java/com/frcteam3636/frc2024/Robot.kt +++ b/src/main/java/com/frcteam3636/frc2024/Robot.kt @@ -1,7 +1,5 @@ package com.frcteam3636.frc2024 -import BuildConstants -import com.ctre.phoenix6.SignalLogger import com.ctre.phoenix6.StatusSignal import com.frcteam3636.frc2024.subsystems.arm.Arm import com.frcteam3636.frc2024.subsystems.drivetrain.Drivetrain @@ -73,9 +71,11 @@ object Robot : LoggedRobot() { /** Start logging or pull replay logs from a file */ private fun configureAdvantageKit() { - Logger.recordMetadata("GitSHA", BuildConstants.GIT_SHA) + Logger.recordMetadata("Git SHA", BuildConstants.GIT_SHA) Logger.recordMetadata("BuildDate", BuildConstants.BUILD_DATE) Logger.recordMetadata("Model", model.name) + Logger.recordMetadata("Git Dirty", BuildConstants.DIRTY.toString()) + Logger.recordMetadata("Git Branch", BuildConstants.GIT_BRANCH) if (isReal()) { Logger.addDataReceiver(WPILOGWriter()) // Log to a USB stick @@ -211,7 +211,7 @@ object Robot : LoggedRobot() { /** A model of robot, depending on where we're deployed to. */ enum class Model { - SIMULATION, COMPETITION, + SIMULATION, COMPETITION, PROTOTYPE } /** The model of this robot. */ @@ -220,6 +220,7 @@ object Robot : LoggedRobot() { } else { when (val key = Preferences.getString("Model", "competition")) { "competition" -> Model.COMPETITION + "prototype" -> Model.PROTOTYPE else -> throw Exception("invalid model found in preferences: $key") } } diff --git a/src/main/java/com/frcteam3636/frc2024/subsystems/drivetrain/Drivetrain.kt b/src/main/java/com/frcteam3636/frc2024/subsystems/drivetrain/Drivetrain.kt index db7aa45..738bad4 100644 --- a/src/main/java/com/frcteam3636/frc2024/subsystems/drivetrain/Drivetrain.kt +++ b/src/main/java/com/frcteam3636/frc2024/subsystems/drivetrain/Drivetrain.kt @@ -49,6 +49,7 @@ object Drivetrain : Subsystem, Sendable { private val io = when (Robot.model) { Robot.Model.SIMULATION -> DrivetrainIOSim() Robot.Model.COMPETITION -> DrivetrainIOReal.fromKrakenSwerve() + Robot.Model.PROTOTYPE -> DrivetrainIOReal.fromNeoSwerve() } val inputs = DrivetrainIO.Inputs() @@ -84,10 +85,7 @@ object Drivetrain : Subsystem, Sendable { init { Pathfinding.setPathfinder( - when (Robot.model) { - Robot.Model.SIMULATION -> LocalADStarAK() - Robot.Model.COMPETITION -> RemoteADStarAK() - } + LocalADStarAK() ) AutoBuilder.configureHolonomic( @@ -358,6 +356,30 @@ object Drivetrain : Subsystem, Sendable { ), ) + internal val MODULE_CAN_IDS_PRACTICE = + PerCorner( + frontLeft = + Pair( + REVMotorControllerId.FrontLeftDrivingMotor, + REVMotorControllerId.FrontLeftTurningMotor + ), + frontRight = + Pair( + REVMotorControllerId.FrontRightDrivingMotor, + REVMotorControllerId.FrontRightTurningMotor + ), + backRight = + Pair( + REVMotorControllerId.BackRightDrivingMotor, + REVMotorControllerId.BackRightTurningMotor + ), + backLeft = + Pair( + REVMotorControllerId.BackLeftDrivingMotor, + REVMotorControllerId.BackLeftTurningMotor + ), + ) + /** A position with the modules radiating outwards from the center of the robot, preventing movement. */ val BRAKE_POSITION = MODULE_POSITIONS.map { position -> SwerveModuleState(0.0, position.translation.angle) } } diff --git a/src/main/java/com/frcteam3636/frc2024/subsystems/drivetrain/DrivetrainIO.kt b/src/main/java/com/frcteam3636/frc2024/subsystems/drivetrain/DrivetrainIO.kt index 22b381a..8757890 100644 --- a/src/main/java/com/frcteam3636/frc2024/subsystems/drivetrain/DrivetrainIO.kt +++ b/src/main/java/com/frcteam3636/frc2024/subsystems/drivetrain/DrivetrainIO.kt @@ -77,6 +77,16 @@ class DrivetrainIOReal(override val modules: PerCorner) : Driv position.rotation ) }) + + fun fromNeoSwerve() = + DrivetrainIOReal(Drivetrain.Constants.MODULE_POSITIONS.zip(Drivetrain.Constants.MODULE_CAN_IDS_PRACTICE).map { (position, ids) -> + val (driveId, turnId) = ids + MAXSwerveModule( + DrivingSparkMAX(driveId), + turnId, + position.rotation + ) + }) } } diff --git a/src/main/java/com/frcteam3636/frc2024/subsystems/intake/Intake.kt b/src/main/java/com/frcteam3636/frc2024/subsystems/intake/Intake.kt index dca7f64..b654535 100644 --- a/src/main/java/com/frcteam3636/frc2024/subsystems/intake/Intake.kt +++ b/src/main/java/com/frcteam3636/frc2024/subsystems/intake/Intake.kt @@ -9,6 +9,7 @@ object Intake: Subsystem { private var io: IntakeIO = when (Robot.model) { Robot.Model.SIMULATION -> IntakeIO.IntakeIOSim() Robot.Model.COMPETITION -> IntakeIO.IntakeIOReal() + Robot.Model.PROTOTYPE -> IntakeIO.IntakeIOSim() } var inputs = IntakeIO.IntakeInputs() diff --git a/src/main/java/com/frcteam3636/frc2024/subsystems/wrist/Wrist.kt b/src/main/java/com/frcteam3636/frc2024/subsystems/wrist/Wrist.kt index 54c6611..32594f7 100644 --- a/src/main/java/com/frcteam3636/frc2024/subsystems/wrist/Wrist.kt +++ b/src/main/java/com/frcteam3636/frc2024/subsystems/wrist/Wrist.kt @@ -11,7 +11,7 @@ object Wrist: Subsystem { var inputs = IntakeIO.IntakeInputs() override fun periodic() { - Logger.processInputs("Intake", inputs) + Logger.processInputs("Wrist", inputs) //the wrist should always be parallel to the ground io.pivotToAndStop(Arm.inputs.position * -1.0) //use position variable from arm }