diff --git a/simgui.json b/simgui.json index 17b750f..65b14b9 100644 --- a/simgui.json +++ b/simgui.json @@ -72,12 +72,14 @@ "length": 0.7111999988555908, "width": 0.7111999988555908 }, + "bottom": 1476, "bumpers": { "length": 0.8762999773025513, "width": 0.8762999773025513 }, - "height": 8.211000442504883, + "height": 8.210550308227539, "image": "C:\\Users\\jpoth\\Downloads\\image(1).png", + "left": 150, "odo": { "color": [ 0.7647056579589844, @@ -87,6 +89,8 @@ ], "style": "Hidden" }, + "right": 2961, + "top": 79, "units": "meters", "width": 16.541748046875, "window": { @@ -99,7 +103,11 @@ } }, "/SmartDashboard/Field": { - "height": 8.013679504394531, + "bottom": 1476, + "height": 8.210550308227539, + "left": 150, + "right": 2961, + "top": 79, "width": 16.541748046875, "window": { "visible": true @@ -138,18 +146,22 @@ ], "style": "Box/Image" }, + "bottom": 1476, "cameras": { "arrows": false, "style": "Hidden" }, "height": 8.210550308227539, "image": "C:\\Users\\jpoth\\Downloads\\image(1).png", + "left": 150, + "right": 2961, + "top": 79, "units": "meters", "visibleTargetPoses": { "selectable": false, "style": "Hidden" }, - "width": 16.541749954223633, + "width": 16.541748046875, "window": { "visible": true } diff --git a/src/main/kotlin/frc/team449/robot2024/constants/subsystem/PivotConstants.kt b/src/main/kotlin/frc/team449/robot2024/constants/subsystem/PivotConstants.kt index 84893a4..899bd02 100644 --- a/src/main/kotlin/frc/team449/robot2024/constants/subsystem/PivotConstants.kt +++ b/src/main/kotlin/frc/team449/robot2024/constants/subsystem/PivotConstants.kt @@ -8,11 +8,16 @@ object PivotConstants { const val MOTOR_ID = 46 const val INVERTED = false const val CURRENT_LIM = 40 - const val GEARING = 1.0 / 75.0 - const val UPR = 2 * PI const val FOLLOWER_ID = 47 const val FOLLOWER_INVERTED = true + /** Encoder stuff */ + const val ENC_CHANNEL = 6 + const val OFFSET = 0.0 + const val GEARING = 1.0 / 75.0 + const val UPR = 2 * PI + const val ENC_INVERTED = false + const val NUM_MOTORS = 2 const val MOMENT_OF_INERTIA = 2.0 diff --git a/src/main/kotlin/frc/team449/robot2024/constants/subsystem/ShooterConstants.kt b/src/main/kotlin/frc/team449/robot2024/constants/subsystem/ShooterConstants.kt index 7cf3b91..628ff7d 100644 --- a/src/main/kotlin/frc/team449/robot2024/constants/subsystem/ShooterConstants.kt +++ b/src/main/kotlin/frc/team449/robot2024/constants/subsystem/ShooterConstants.kt @@ -13,7 +13,6 @@ object ShooterConstants { const val LEFT_MOTOR_ID = 42 const val LEFT_MOTOR_INVERTED = false const val CURRENT_LIMIT = 40 - const val UPR = 1.0 const val SUBWOOFER_LEFT_SPEED = 100.0 const val SUBWOOFER_RIGHT_SPEED = 125.0 @@ -32,7 +31,6 @@ object ShooterConstants { /** These constants are PER SIDE of the shooter */ const val MOMENT_OF_INERTIA = 2.50 const val NUM_MOTORS = 1 - const val GEARING = 1.0 / 1.0 const val MODEL_VEL_STDDEV = 3.0 const val ENCODER_VEL_STDDEV = 0.01 @@ -40,6 +38,17 @@ object ShooterConstants { const val LQR_MAX_VOLTS = 12.0 const val MAX_VOLTAGE = 12.0 + /** Encoder stuff */ + const val LEFT_CHANNEL_A = 2 + const val LEFT_CHANNEL_B = 3 + const val RIGHT_CHANNEL_A = 4 + const val RIGHT_CHANNEL_B = 5 + const val CPR = 2048 + const val UPR = 1.0 + const val GEARING = 1.0 / 1.0 + const val LEFT_ENCODER_INVERTED = false + const val RIGHT_ENCODER_INVERTED = false + init { /** * Fill with values of optimized left/right and pivot angles diff --git a/src/main/kotlin/frc/team449/robot2024/subsystems/pivot/Pivot.kt b/src/main/kotlin/frc/team449/robot2024/subsystems/pivot/Pivot.kt index 96f0f14..25cc040 100644 --- a/src/main/kotlin/frc/team449/robot2024/subsystems/pivot/Pivot.kt +++ b/src/main/kotlin/frc/team449/robot2024/subsystems/pivot/Pivot.kt @@ -19,7 +19,7 @@ import frc.team449.robot2024.constants.RobotConstants import frc.team449.robot2024.constants.field.FieldConstants import frc.team449.robot2024.constants.subsystem.PivotConstants import frc.team449.robot2024.constants.subsystem.ShooterConstants -import frc.team449.system.encoder.NEOEncoder +import frc.team449.system.encoder.AbsoluteEncoder import frc.team449.system.motor.WrappedMotor import frc.team449.system.motor.createSparkMax import java.util.function.Supplier diff --git a/src/main/kotlin/frc/team449/robot2024/subsystems/shooter/Shooter.kt b/src/main/kotlin/frc/team449/robot2024/subsystems/shooter/Shooter.kt index 4dd24b7..907c6a0 100644 --- a/src/main/kotlin/frc/team449/robot2024/subsystems/shooter/Shooter.kt +++ b/src/main/kotlin/frc/team449/robot2024/subsystems/shooter/Shooter.kt @@ -10,6 +10,7 @@ import edu.wpi.first.math.system.plant.DCMotor import edu.wpi.first.math.system.plant.LinearSystemId import edu.wpi.first.util.sendable.SendableBuilder import edu.wpi.first.wpilibj.DriverStation +import edu.wpi.first.wpilibj.Encoder import edu.wpi.first.wpilibj2.command.Command import edu.wpi.first.wpilibj2.command.SubsystemBase import frc.team449.robot2024.Robot @@ -17,10 +18,11 @@ import frc.team449.robot2024.constants.MotorConstants import frc.team449.robot2024.constants.RobotConstants import frc.team449.robot2024.constants.field.FieldConstants import frc.team449.robot2024.constants.subsystem.ShooterConstants -import frc.team449.system.encoder.NEOEncoder +import frc.team449.system.encoder.QuadEncoder import frc.team449.system.motor.WrappedMotor import frc.team449.system.motor.createSparkMax import java.util.function.Supplier + open class Shooter( private val rightMotor: WrappedMotor, private val leftMotor: WrappedMotor,