-
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
Showing
6 changed files
with
109 additions
and
40 deletions.
There are no files selected for viewing
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
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
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,29 @@ | ||
package frc.robot.subsystems.drive; | ||
|
||
import com.kauailabs.navx.frc.AHRS; | ||
import edu.wpi.first.math.util.Units; | ||
import edu.wpi.first.wpilibj.SPI; | ||
|
||
public class GyroIONavX implements GyroIO { | ||
private final AHRS gyro = new AHRS(SPI.Port.kMXP); | ||
|
||
public GyroIONavX() { | ||
reset(); | ||
} | ||
|
||
@Override | ||
public void updateInputs(GyroIOInputs inputs) { | ||
inputs.connected = gyro.isConnected(); | ||
inputs.yawPosition = gyro.getRotation2d(); | ||
inputs.yawVelocityRadPerSec = Units.degreesToRadians(gyro.getRate()); | ||
} | ||
|
||
@Override | ||
public void reset() { | ||
gyro.reset(); | ||
} | ||
|
||
public void setOffset(double offset) { | ||
gyro.setAngleAdjustment(offset); | ||
} | ||
} |
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
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
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,40 @@ | ||
{ | ||
"fileName": "NavX.json", | ||
"name": "NavX", | ||
"version": "2024.1.0", | ||
"uuid": "cb311d09-36e9-4143-a032-55bb2b94443b", | ||
"frcYear": "2024", | ||
"mavenUrls": [ | ||
"https://dev.studica.com/maven/release/2024/" | ||
], | ||
"jsonUrl": "https://dev.studica.com/releases/2024/NavX.json", | ||
"javaDependencies": [ | ||
{ | ||
"groupId": "com.kauailabs.navx.frc", | ||
"artifactId": "navx-frc-java", | ||
"version": "2024.1.0" | ||
} | ||
], | ||
"jniDependencies": [], | ||
"cppDependencies": [ | ||
{ | ||
"groupId": "com.kauailabs.navx.frc", | ||
"artifactId": "navx-frc-cpp", | ||
"version": "2024.1.0", | ||
"headerClassifier": "headers", | ||
"sourcesClassifier": "sources", | ||
"sharedLibrary": false, | ||
"libName": "navx_frc", | ||
"skipInvalidPlatforms": true, | ||
"binaryPlatforms": [ | ||
"linuxathena", | ||
"linuxraspbian", | ||
"linuxarm32", | ||
"linuxarm64", | ||
"linuxx86-64", | ||
"osxuniversal", | ||
"windowsx86-64" | ||
] | ||
} | ||
] | ||
} |