Skip to content

Commit

Permalink
Add encoders to shooter and pivot
Browse files Browse the repository at this point in the history
  • Loading branch information
jpothen8 committed Feb 1, 2024
1 parent 95bb6c6 commit f60423b
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 9 deletions.
18 changes: 15 additions & 3 deletions simgui.json
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -87,6 +89,8 @@
],
"style": "Hidden"
},
"right": 2961,
"top": 79,
"units": "meters",
"width": 16.541748046875,
"window": {
Expand All @@ -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
Expand Down Expand Up @@ -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
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -32,14 +31,24 @@ 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
const val LQR_VEL_TOL = 10.0 / 60.0
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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,19 @@ 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
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,
Expand Down

0 comments on commit f60423b

Please sign in to comment.