-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
cb425ba
commit dffa504
Showing
2 changed files
with
106 additions
and
0 deletions.
There are no files selected for viewing
32 changes: 32 additions & 0 deletions
32
src/main/java/frc/robot/subsystems/shooter/ShooterIOSparkMax.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package frc.robot.subsystems.shooter; | ||
|
||
import com.revrobotics.CANSparkLowLevel.MotorType; | ||
import com.revrobotics.CANSparkMax; | ||
import com.revrobotics.RelativeEncoder; | ||
import edu.wpi.first.math.util.Units; | ||
|
||
public class ShooterIOSparkMax implements ShooterIO { | ||
private static final double GEAR_RATIO = 1.5; | ||
|
||
private final CANSparkMax leader = new CANSparkMax(0, MotorType.kBrushless); | ||
private final CANSparkMax follower = new CANSparkMax(1, MotorType.kBrushless); | ||
private final RelativeEncoder encoder = leader.getEncoder(); | ||
|
||
public ShooterIOSparkMax() { | ||
leader.setInverted(false); | ||
follower.follow(leader, false); | ||
} | ||
|
||
@Override | ||
public void updateInputs(ShooterIOInputs inputs) { | ||
inputs.velocityRadPerSec = | ||
Units.rotationsPerMinuteToRadiansPerSecond(encoder.getVelocity() / GEAR_RATIO); | ||
inputs.appliedVolts = leader.getAppliedOutput() * leader.getBusVoltage(); | ||
} | ||
|
||
@Override | ||
public void setVoltage(double volts) { | ||
leader.setVoltage(volts); | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
{ | ||
"fileName": "REVLib.json", | ||
"name": "REVLib", | ||
"version": "2024.2.0", | ||
"frcYear": "2024", | ||
"uuid": "3f48eb8c-50fe-43a6-9cb7-44c86353c4cb", | ||
"mavenUrls": [ | ||
"https://maven.revrobotics.com/" | ||
], | ||
"jsonUrl": "https://software-metadata.revrobotics.com/REVLib-2024.json", | ||
"javaDependencies": [ | ||
{ | ||
"groupId": "com.revrobotics.frc", | ||
"artifactId": "REVLib-java", | ||
"version": "2024.2.0" | ||
} | ||
], | ||
"jniDependencies": [ | ||
{ | ||
"groupId": "com.revrobotics.frc", | ||
"artifactId": "REVLib-driver", | ||
"version": "2024.2.0", | ||
"skipInvalidPlatforms": true, | ||
"isJar": false, | ||
"validPlatforms": [ | ||
"windowsx86-64", | ||
"windowsx86", | ||
"linuxarm64", | ||
"linuxx86-64", | ||
"linuxathena", | ||
"linuxarm32", | ||
"osxuniversal" | ||
] | ||
} | ||
], | ||
"cppDependencies": [ | ||
{ | ||
"groupId": "com.revrobotics.frc", | ||
"artifactId": "REVLib-cpp", | ||
"version": "2024.2.0", | ||
"libName": "REVLib", | ||
"headerClassifier": "headers", | ||
"sharedLibrary": false, | ||
"skipInvalidPlatforms": true, | ||
"binaryPlatforms": [ | ||
"windowsx86-64", | ||
"windowsx86", | ||
"linuxarm64", | ||
"linuxx86-64", | ||
"linuxathena", | ||
"linuxarm32", | ||
"osxuniversal" | ||
] | ||
}, | ||
{ | ||
"groupId": "com.revrobotics.frc", | ||
"artifactId": "REVLib-driver", | ||
"version": "2024.2.0", | ||
"libName": "REVLibDriver", | ||
"headerClassifier": "headers", | ||
"sharedLibrary": false, | ||
"skipInvalidPlatforms": true, | ||
"binaryPlatforms": [ | ||
"windowsx86-64", | ||
"windowsx86", | ||
"linuxarm64", | ||
"linuxx86-64", | ||
"linuxathena", | ||
"linuxarm32", | ||
"osxuniversal" | ||
] | ||
} | ||
] | ||
} |