Skip to content

Commit

Permalink
Added encoder inputs to vortex
Browse files Browse the repository at this point in the history
  • Loading branch information
senquixote committed Jan 27, 2024
1 parent cf73db4 commit 05c723b
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/main/java/frc/robot/subsystems/shooter/ShooterVortex.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,21 @@

import com.revrobotics.CANSparkFlex;
import com.revrobotics.CANSparkLowLevel.MotorType;
import com.revrobotics.RelativeEncoder;
import frc.robot.Constants;

public class ShooterVortex implements ShooterIO {

Check warning on line 8 in src/main/java/frc/robot/subsystems/shooter/ShooterVortex.java

View workflow job for this annotation

GitHub Actions / Linting

[testtool] reported by reviewdog 🐶 Missing a Javadoc comment. Raw Output: /github/workspace/./src/main/java/frc/robot/subsystems/shooter/ShooterVortex.java:8:1: warning: Missing a Javadoc comment. (com.puppycrawl.tools.checkstyle.checks.javadoc.MissingJavadocTypeCheck)
public final CANSparkFlex shooterTopMotor =
new CANSparkFlex(Constants.Shooter.shooterTopId, MotorType.kBrushless);
public final CANSparkFlex shooterBottomMotor =
new CANSparkFlex(Constants.Shooter.shooterBottomId, MotorType.kBrushless);
private RelativeEncoder topEncoder;
private RelativeEncoder bottomEncoder;

public ShooterVortex() {
topEncoder = shooterTopMotor.getEncoder();
bottomEncoder = shooterBottomMotor.getEncoder();
}

public void setTopMotor(double power) {
shooterTopMotor.setVoltage(power);
Expand All @@ -17,4 +25,9 @@ public void setTopMotor(double power) {
public void setBottomMotor(double power) {
shooterBottomMotor.setVoltage(power);
}

public void updateInputs(ShooterIOInputs inputs) {
inputs.topshooterVelocityRotPerSecond = topEncoder.getPosition();
inputs.bottomshooterVelocityRotPerSecond = bottomEncoder.getPosition();
}
}

0 comments on commit 05c723b

Please sign in to comment.