Skip to content

Commit ebc7798

Browse files
committed
feat: use pigeon instead of navx
1 parent d71c193 commit ebc7798

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

Diff for: src/main/java/org/team1540/robot2024/Constants.java

+3
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,9 @@ public static class SwerveConfig {
4444
public static final int FRONT_RIGHT = IS_COMPETITION_ROBOT ? 4 : 0;
4545
public static final int BACK_LEFT = IS_COMPETITION_ROBOT ? 7 : 0;
4646
public static final int BACK_RIGHT = IS_COMPETITION_ROBOT ? 1 : 0;
47+
48+
// TODO: set this id
49+
public static final int PIGEON_ID = 0;
4750
}
4851
public static class Drivetrain {
4952
public static final double DRIVE_GEAR_RATIO = (50.0 / 14.0) * (17.0 / 27.0) * (45.0 / 15.0);

Diff for: src/main/java/org/team1540/robot2024/RobotContainer.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public RobotContainer() {
5050
// Real robot, instantiate hardware IO implementations
5151
drivetrain =
5252
new Drivetrain(
53-
new GyroIONavx(),
53+
new GyroIOPigeon2(),
5454
new ModuleIOTalonFX(SwerveFactory.getModuleMotors(SwerveConfig.FRONT_LEFT, SwerveFactory.SwerveCorner.FRONT_LEFT)),
5555
new ModuleIOTalonFX(SwerveFactory.getModuleMotors(SwerveConfig.FRONT_RIGHT, SwerveFactory.SwerveCorner.FRONT_RIGHT)),
5656
new ModuleIOTalonFX(SwerveFactory.getModuleMotors(SwerveConfig.BACK_LEFT, SwerveFactory.SwerveCorner.BACK_LEFT)),

Diff for: src/main/java/org/team1540/robot2024/subsystems/drive/GyroIOPigeon2.java

+3-1
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,13 @@
88
import edu.wpi.first.math.util.Units;
99
import org.team1540.robot2024.util.PhoenixTimeSyncSignalRefresher;
1010

11+
import static org.team1540.robot2024.Constants.SwerveConfig.*;
12+
1113
/**
1214
* IO implementation for Pigeon2
1315
*/
1416
public class GyroIOPigeon2 implements GyroIO {
15-
private final Pigeon2 pigeon = new Pigeon2(20);
17+
private final Pigeon2 pigeon = new Pigeon2(PIGEON_ID);
1618
private final StatusSignal<Double> yaw = pigeon.getYaw();
1719
private final StatusSignal<Double> yawVelocity = pigeon.getAngularVelocityZDevice();
1820

0 commit comments

Comments
 (0)