diff --git a/simgui-ds.json b/simgui-ds.json new file mode 100644 index 00000000..73cc713c --- /dev/null +++ b/simgui-ds.json @@ -0,0 +1,92 @@ +{ + "keyboardJoysticks": [ + { + "axisConfig": [ + { + "decKey": 65, + "incKey": 68 + }, + { + "decKey": 87, + "incKey": 83 + }, + { + "decKey": 69, + "decayRate": 0.0, + "incKey": 82, + "keyRate": 0.009999999776482582 + } + ], + "axisCount": 3, + "buttonCount": 4, + "buttonKeys": [ + 90, + 88, + 67, + 86 + ], + "povConfig": [ + { + "key0": 328, + "key135": 323, + "key180": 322, + "key225": 321, + "key270": 324, + "key315": 327, + "key45": 329, + "key90": 326 + } + ], + "povCount": 1 + }, + { + "axisConfig": [ + { + "decKey": 74, + "incKey": 76 + }, + { + "decKey": 73, + "incKey": 75 + } + ], + "axisCount": 2, + "buttonCount": 4, + "buttonKeys": [ + 77, + 44, + 46, + 47 + ], + "povCount": 0 + }, + { + "axisConfig": [ + { + "decKey": 263, + "incKey": 262 + }, + { + "decKey": 265, + "incKey": 264 + } + ], + "axisCount": 2, + "buttonCount": 6, + "buttonKeys": [ + 260, + 268, + 266, + 261, + 269, + 267 + ], + "povCount": 0 + }, + { + "axisCount": 0, + "buttonCount": 0, + "povCount": 0 + } + ] +} diff --git a/simgui.json b/simgui.json new file mode 100644 index 00000000..21c47b41 --- /dev/null +++ b/simgui.json @@ -0,0 +1,9 @@ +{ + "NTProvider": { + "types": { + "/FMSInfo": "FMSInfo", + "/Shuffleboard/Pre-match/Mode": "String Chooser", + "/SmartDashboard/AutonomousMode": "String Chooser" + } + } +} diff --git a/src/main/kotlin/com/team4099/robot2023/BuildConstants.kt b/src/main/kotlin/com/team4099/robot2023/BuildConstants.kt index a5a1a8af..ff557a29 100644 --- a/src/main/kotlin/com/team4099/robot2023/BuildConstants.kt +++ b/src/main/kotlin/com/team4099/robot2023/BuildConstants.kt @@ -6,10 +6,10 @@ package com.team4099.robot2023 const val MAVEN_GROUP = "" const val MAVEN_NAME = "Crescendo-2024" const val VERSION = "unspecified" -const val GIT_REVISION = 20 -const val GIT_SHA = "4571cd4f3189ad1982f91f7dde0d0c7d7ec30341" -const val GIT_DATE = "2024-01-12T19:01:07Z" +const val GIT_REVISION = 25 +const val GIT_SHA = "b4edbcbc86bce4f445e9dcbf3dc9d1361b02aca3" +const val GIT_DATE = "2024-01-15T19:28:22Z" const val GIT_BRANCH = "intake" -const val BUILD_DATE = "2024-01-12T19:14:59Z" -const val BUILD_UNIX_TIME = 1705104899720L +const val BUILD_DATE = "2024-01-15T19:47:46Z" +const val BUILD_UNIX_TIME = 1705366066090L const val DIRTY = 1 diff --git a/src/main/kotlin/com/team4099/robot2023/RobotContainer.kt b/src/main/kotlin/com/team4099/robot2023/RobotContainer.kt index 6bfb14cc..0fae56ae 100644 --- a/src/main/kotlin/com/team4099/robot2023/RobotContainer.kt +++ b/src/main/kotlin/com/team4099/robot2023/RobotContainer.kt @@ -10,6 +10,9 @@ import com.team4099.robot2023.subsystems.drivetrain.drive.DrivetrainIOReal import com.team4099.robot2023.subsystems.drivetrain.drive.DrivetrainIOSim import com.team4099.robot2023.subsystems.drivetrain.gyro.GyroIO import com.team4099.robot2023.subsystems.drivetrain.gyro.GyroIOPigeon2 +import com.team4099.robot2023.subsystems.intake.Intake +import com.team4099.robot2023.subsystems.intake.IntakeIONEO +import com.team4099.robot2023.subsystems.intake.IntakeIOSim import com.team4099.robot2023.subsystems.limelight.LimelightVision import com.team4099.robot2023.subsystems.limelight.LimelightVisionIO import com.team4099.robot2023.subsystems.superstructure.Request @@ -23,6 +26,7 @@ import org.team4099.lib.units.derived.degrees object RobotContainer { private val drivetrain: Drivetrain + private val intake: Intake private val vision: Vision private val limelight: LimelightVision @@ -31,6 +35,7 @@ object RobotContainer { // Real Hardware Implementations // drivetrain = Drivetrain(object: GyroIO {},object: DrivetrainIO {} drivetrain = Drivetrain(GyroIOPigeon2, DrivetrainIOReal) + intake = Intake(IntakeIONEO) vision = Vision( // object: CameraIO {} @@ -45,6 +50,7 @@ object RobotContainer { } else { // Simulation implementations drivetrain = Drivetrain(object : GyroIO {}, DrivetrainIOSim) + intake = Intake(IntakeIOSim) vision = Vision( CameraIONorthstar("northstar_1"), @@ -110,6 +116,7 @@ object RobotContainer { fun mapTeleopControls() { ControlBoard.resetGyro.whileTrue(ResetGyroYawCommand(drivetrain, toAngle = 180.degrees)) + ControlBoard.groundIntakeTest.whileTrue(intake.generateIntakeTestCommand()) // ControlBoard.autoLevel.whileActiveContinuous( // GoToAngle(drivetrain).andThen(AutoLevel(drivetrain)) // ) diff --git a/src/main/kotlin/com/team4099/robot2023/config/ControlBoard.kt b/src/main/kotlin/com/team4099/robot2023/config/ControlBoard.kt index 2a3446ac..d1383fad 100644 --- a/src/main/kotlin/com/team4099/robot2023/config/ControlBoard.kt +++ b/src/main/kotlin/com/team4099/robot2023/config/ControlBoard.kt @@ -97,4 +97,6 @@ object ControlBoard { // for testing val setArmCommand = Trigger { technician.yButton } + + val groundIntakeTest = Trigger { driver.aButton } } diff --git a/src/main/kotlin/com/team4099/robot2023/config/constants/IntakeConstants.kt b/src/main/kotlin/com/team4099/robot2023/config/constants/IntakeConstants.kt index 3846be7c..00b49039 100644 --- a/src/main/kotlin/com/team4099/robot2023/config/constants/IntakeConstants.kt +++ b/src/main/kotlin/com/team4099/robot2023/config/constants/IntakeConstants.kt @@ -4,7 +4,7 @@ import org.team4099.lib.units.base.amps import org.team4099.lib.units.derived.volts object IntakeConstants { - val ROLLER_INERTIA = 0.0014948033 // this one has been updated + val ROLLER_INERTIA = 0.002459315 // this one has been updated val VOLTAGE_COMPENSATION = 12.0.volts // TODO: Change gear ratio according to robot diff --git a/src/main/kotlin/com/team4099/robot2023/subsystems/intake/Intake.kt b/src/main/kotlin/com/team4099/robot2023/subsystems/intake/Intake.kt index fe7d059d..3614c806 100644 --- a/src/main/kotlin/com/team4099/robot2023/subsystems/intake/Intake.kt +++ b/src/main/kotlin/com/team4099/robot2023/subsystems/intake/Intake.kt @@ -4,6 +4,8 @@ import com.team4099.lib.hal.Clock import com.team4099.robot2023.config.constants.Constants import com.team4099.robot2023.config.constants.IntakeConstants import com.team4099.robot2023.subsystems.superstructure.Request +import edu.wpi.first.wpilibj2.command.Command +import edu.wpi.first.wpilibj2.command.Commands.runOnce import org.littletonrobotics.junction.Logger import org.team4099.lib.units.base.inSeconds import org.team4099.lib.units.derived.ElectricalPotential @@ -82,6 +84,11 @@ class Intake(val io: IntakeIO) { io.setRollerVoltage(appliedVoltage) } + fun generateIntakeTestCommand(): Command { + val returnCommand = runOnce({ currentRequest = Request.IntakeRequest.OpenLoop(12.volts) }) + return returnCommand + } + companion object { enum class IntakeState { UNINITIALIZED, diff --git a/src/main/kotlin/com/team4099/robot2023/subsystems/intake/IntakeIOSim.kt b/src/main/kotlin/com/team4099/robot2023/subsystems/intake/IntakeIOSim.kt index f9f202e2..801b2e84 100644 --- a/src/main/kotlin/com/team4099/robot2023/subsystems/intake/IntakeIOSim.kt +++ b/src/main/kotlin/com/team4099/robot2023/subsystems/intake/IntakeIOSim.kt @@ -14,13 +14,14 @@ import org.team4099.lib.units.derived.rotations import org.team4099.lib.units.derived.volts import org.team4099.lib.units.perMinute -class IntakeIOSim : IntakeIO { +object IntakeIOSim : IntakeIO { private val rollerSim: FlywheelSim = FlywheelSim( DCMotor.getNEO(1), IntakeConstants.ROLLER_GEAR_RATIO, IntakeConstants.ROLLER_INERTIA ) + private var appliedVoltage = 0.volts; init{} override fun updateInputs(inputs: IntakeIO.IntakeIOInputs) { @@ -28,7 +29,7 @@ class IntakeIOSim : IntakeIO { rollerSim.update(Constants.Universal.LOOP_PERIOD_TIME.inSeconds) inputs.rollerVelocity = rollerSim.getAngularVelocityRPM().rotations.perMinute - inputs.rollerAppliedVoltage = 0.volts + inputs.rollerAppliedVoltage = appliedVoltage inputs.rollerSupplyCurrent = 0.amps inputs.rollerStatorCurrent = rollerSim.currentDrawAmps.amps inputs.rollerTemp = 0.0.celsius @@ -37,6 +38,7 @@ class IntakeIOSim : IntakeIO { } override fun setRollerVoltage(voltage: ElectricalPotential) { + appliedVoltage = voltage rollerSim.setInputVoltage( clamp( voltage, @@ -46,4 +48,6 @@ class IntakeIOSim : IntakeIO { .inVolts ) } + + override fun setRollerBrakeMode(brake: Boolean) {} }