Skip to content

Commit

Permalink
Add encoders
Browse files Browse the repository at this point in the history
  • Loading branch information
jpothen8 committed Feb 1, 2024
1 parent f60423b commit 967b5ff
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,11 @@ open class Pivot(
val motor = createSparkMax(
"Shooter Right Motor",
PivotConstants.MOTOR_ID,
NEOEncoder.creator(
PivotConstants.GEARING,
PivotConstants.UPR
encCreator = AbsoluteEncoder.creator(
PivotConstants.ENC_CHANNEL,
PivotConstants.OFFSET,
PivotConstants.UPR,
PivotConstants.ENC_INVERTED
),
inverted = PivotConstants.INVERTED,
currentLimit = PivotConstants.CURRENT_LIM,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@ open class Shooter(
) : SubsystemBase() {

open val rightVelocity: Supplier<Double> =
Supplier { rightMotor.velocity * ShooterConstants.UPR * ShooterConstants.GEARING }
Supplier { rightMotor.velocity }

open val leftVelocity: Supplier<Double> =
Supplier { leftMotor.velocity * ShooterConstants.UPR * ShooterConstants.GEARING }
Supplier { leftMotor.velocity }

init {
this.defaultCommand = updateOnly()
Expand Down Expand Up @@ -119,9 +119,12 @@ open class Shooter(
val rightMotor = createSparkMax(
"Shooter Right Motor",
ShooterConstants.RIGHT_MOTOR_ID,
NEOEncoder.creator(
encCreator = QuadEncoder.creator(
Encoder(ShooterConstants.RIGHT_CHANNEL_A, ShooterConstants.RIGHT_CHANNEL_B),
ShooterConstants.CPR,
ShooterConstants.UPR,
ShooterConstants.GEARING,
ShooterConstants.UPR
ShooterConstants.RIGHT_ENCODER_INVERTED
),
inverted = ShooterConstants.RIGHT_MOTOR_INVERTED,
currentLimit = ShooterConstants.CURRENT_LIMIT,
Expand All @@ -130,9 +133,12 @@ open class Shooter(
val leftMotor = createSparkMax(
"Shooter Right Motor",
ShooterConstants.LEFT_MOTOR_ID,
NEOEncoder.creator(
encCreator = QuadEncoder.creator(
Encoder(ShooterConstants.LEFT_CHANNEL_A, ShooterConstants.LEFT_CHANNEL_B),
ShooterConstants.CPR,
ShooterConstants.UPR,
ShooterConstants.GEARING,
ShooterConstants.UPR
ShooterConstants.LEFT_ENCODER_INVERTED
),
inverted = ShooterConstants.LEFT_MOTOR_INVERTED,
currentLimit = ShooterConstants.CURRENT_LIMIT,
Expand Down

0 comments on commit 967b5ff

Please sign in to comment.