diff --git a/.run/Build & Deploy Robot for Debugging.run.xml b/.run/Build & Deploy Robot for Debugging.run.xml index 72b01bf..0fa85ce 100644 --- a/.run/Build & Deploy Robot for Debugging.run.xml +++ b/.run/Build & Deploy Robot for Debugging.run.xml @@ -18,7 +18,7 @@ true true false - false + false @@ -40,7 +40,7 @@ true true false - false + false @@ -62,7 +62,29 @@ true true false - false + false + + + + + + + + true + true + false + false \ No newline at end of file diff --git a/.run/Build & Deploy Robot.run.xml b/.run/Build & Deploy Robot.run.xml index ede63c1..254df67 100644 --- a/.run/Build & Deploy Robot.run.xml +++ b/.run/Build & Deploy Robot.run.xml @@ -18,7 +18,7 @@ true true false - false + false @@ -40,7 +40,7 @@ true true false - false + false @@ -62,7 +62,29 @@ true true false - false + false + + + + + + + + true + true + false + false \ No newline at end of file diff --git a/.run/Build Robot.run.xml b/.run/Build Robot.run.xml index d78b6e7..6b0d2ec 100644 --- a/.run/Build Robot.run.xml +++ b/.run/Build Robot.run.xml @@ -18,7 +18,7 @@ true true false - false + false @@ -40,7 +40,7 @@ true true false - false + false @@ -62,7 +62,29 @@ true true false - false + false + + + + + + + + true + true + false + false \ No newline at end of file diff --git a/.run/Clean Build & Deploy Robot for Debugging.run.xml b/.run/Clean Build & Deploy Robot for Debugging.run.xml index 13d0e1a..4e4b2d3 100644 --- a/.run/Clean Build & Deploy Robot for Debugging.run.xml +++ b/.run/Clean Build & Deploy Robot for Debugging.run.xml @@ -19,7 +19,7 @@ true true false - false + false @@ -42,7 +42,7 @@ true true false - false + false @@ -65,7 +65,30 @@ true true false - false + false + + + + + + + + true + true + false + false \ No newline at end of file diff --git a/.run/Clean Build & Deploy Robot.run.xml b/.run/Clean Build & Deploy Robot.run.xml index 2091360..d38efbe 100644 --- a/.run/Clean Build & Deploy Robot.run.xml +++ b/.run/Clean Build & Deploy Robot.run.xml @@ -19,7 +19,7 @@ true true false - false + false @@ -42,7 +42,7 @@ true true false - false + false @@ -65,7 +65,30 @@ true true false - false + false + + + + + + + + true + true + false + false \ No newline at end of file diff --git a/.run/Clean Build Robot.run.xml b/.run/Clean Build Robot.run.xml index 65e1aab..c80b0be 100644 --- a/.run/Clean Build Robot.run.xml +++ b/.run/Clean Build Robot.run.xml @@ -19,7 +19,7 @@ true true false - false + false @@ -42,7 +42,7 @@ true true false - false + false @@ -65,7 +65,7 @@ true true false - false + false @@ -88,7 +88,7 @@ true true false - false + false @@ -111,7 +111,7 @@ true true false - false + false @@ -134,7 +134,7 @@ true true false - false + false @@ -157,7 +157,30 @@ true true false - false + false + + + + + + + + true + true + false + false \ No newline at end of file diff --git a/.run/Clean.run.xml b/.run/Clean.run.xml index d753dd6..5ffb2e5 100644 --- a/.run/Clean.run.xml +++ b/.run/Clean.run.xml @@ -18,6 +18,7 @@ true true false + false @@ -39,6 +40,7 @@ true true false + false @@ -46,7 +48,29 @@ + + + + + @@ -60,6 +84,7 @@ true true false + false \ No newline at end of file diff --git a/src/main/kotlin/frc/team449/robot2024/Robot.kt b/src/main/kotlin/frc/team449/robot2024/Robot.kt index e250581..53f365b 100644 --- a/src/main/kotlin/frc/team449/robot2024/Robot.kt +++ b/src/main/kotlin/frc/team449/robot2024/Robot.kt @@ -7,10 +7,10 @@ import frc.team449.RobotBase import frc.team449.control.holonomic.SwerveDrive import frc.team449.control.holonomic.SwerveOrthogonalCommand import frc.team449.robot2024.constants.RobotConstants -import frc.team449.robot2024.subsystems.ProtoIntake.Companion.createProtoIntake +import frc.team449.robot2024.subsystems.Intake import frc.team449.system.AHRS import frc.team449.system.light.Light -import monologue.Annotations.Log +import monologue.Annotations import monologue.Logged class Robot : RobotBase(), Logged { @@ -23,19 +23,21 @@ class Robot : RobotBase(), Logged { // Instantiate/declare PDP and other stuff here - @Log.NT + @Annotations.Log.NT override val powerDistribution: PowerDistribution = PowerDistribution( RobotConstants.PDH_CAN, PowerDistribution.ModuleType.kRev ) - @Log.NT + @Annotations.Log.NT override val drive = SwerveDrive.createSwerve(ahrs, field) - @Log.NT + @Annotations.Log.NT override val driveCommand = SwerveOrthogonalCommand(drive, driveController) val light = Light.createLight() - val protoIntake = createProtoIntake() + val intake = Intake() +// +// val infrared = DigitalInput(RobotConstants.IR_CHANNEL) } diff --git a/src/main/kotlin/frc/team449/robot2024/constants/drives/SwerveConstants.kt b/src/main/kotlin/frc/team449/robot2024/constants/drives/SwerveConstants.kt index 58d1b5e..aadae0d 100644 --- a/src/main/kotlin/frc/team449/robot2024/constants/drives/SwerveConstants.kt +++ b/src/main/kotlin/frc/team449/robot2024/constants/drives/SwerveConstants.kt @@ -22,10 +22,10 @@ object SwerveConstants { const val TURN_ENC_CHAN_BR = 6 /** Offsets for the absolute encoders in rotations */ - const val TURN_ENC_OFFSET_FL = 1.0 - 0.108883 + 0.5 - const val TURN_ENC_OFFSET_FR = 1.0 - 0.037868 - const val TURN_ENC_OFFSET_BL = 0.297095 - const val TURN_ENC_OFFSET_BR = 1.0 - 0.359929 + const val TURN_ENC_OFFSET_FL = 0.495 + const val TURN_ENC_OFFSET_FR = 0.432 + const val TURN_ENC_OFFSET_BL = 0.787267 - 0.5 + const val TURN_ENC_OFFSET_BR = 0.422 /** PID gains for turning each module */ const val TURN_KP = 0.85 diff --git a/src/main/kotlin/frc/team449/robot2024/subsystems/ControllerBindings.kt b/src/main/kotlin/frc/team449/robot2024/subsystems/ControllerBindings.kt index e718243..f5f6767 100644 --- a/src/main/kotlin/frc/team449/robot2024/subsystems/ControllerBindings.kt +++ b/src/main/kotlin/frc/team449/robot2024/subsystems/ControllerBindings.kt @@ -52,16 +52,24 @@ class ControllerBindings( robot.driveCommand ) - JoystickButton(driveController, XboxController.Button.kLeftBumper.value).onTrue( + /*JoystickButton(driveController, XboxController.Button.kLeftBumper.value).onTrue( robot.protoIntake.outtake() ).onFalse( robot.protoIntake.stop() ) JoystickButton(driveController, XboxController.Button.kRightBumper.value).onTrue( - robot.protoIntake.intake() + robot.intake.intake() ).onFalse( - robot.protoIntake.stop() + robot.intake.stop() + )*/ + + JoystickButton(driveController, XboxController.Button.kX.value).onTrue( + InstantCommand({ + robot.intake.driveMotors() + }) + ).onFalse( + InstantCommand({ robot.intake.stopMotors() }) ) // introduce "noise" to the simulated pose diff --git a/src/main/kotlin/frc/team449/robot2024/subsystems/Intake.kt b/src/main/kotlin/frc/team449/robot2024/subsystems/Intake.kt new file mode 100644 index 0000000..1be65b2 --- /dev/null +++ b/src/main/kotlin/frc/team449/robot2024/subsystems/Intake.kt @@ -0,0 +1,33 @@ +package frc.team449.robot2024.subsystems + +import edu.wpi.first.wpilibj2.command.Subsystem +import frc.team449.system.encoder.NEOEncoder +import frc.team449.system.motor.WrappedMotor +import frc.team449.system.motor.createSparkMax + +class Intake : Subsystem { + + var motor1 : WrappedMotor = createSparkMax("m1", + 7, + NEOEncoder.creator( + 1.0, + 1.0 + )) + + var motor2 : WrappedMotor = createSparkMax("m2", + 55, + NEOEncoder.creator( + 1.0, + 1.0 + )) + + fun driveMotors() { + motor1.setVoltage(6.0) + motor2.setVoltage(6.0) + } + + fun stopMotors() { + motor1.setVoltage(0.0) + motor2.setVoltage(0.0) + } +}