Skip to content
This repository was archived by the owner on Dec 6, 2025. It is now read-only.

Commit 7382df4

Browse files
Optimized Pigeon2 configurator.
Signed-off-by: thenetworkgrinch <[email protected]>
1 parent 373e91c commit 7382df4

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/main/java/swervelib/imu/Pigeon2Swerve.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,15 @@ public class Pigeon2Swerve extends SwerveIMU
2626
/**
2727
* Offset for the Pigeon 2.
2828
*/
29-
private Rotation3d offset = new Rotation3d();
29+
private Rotation3d offset = new Rotation3d();
3030
/**
3131
* Inversion for the gyro
3232
*/
33-
private boolean invertedIMU = false;
33+
private boolean invertedIMU = false;
34+
/**
35+
* Pigeon2 configurator.
36+
*/
37+
private Pigeon2Configurator cfg;
3438

3539
/**
3640
* Generate the SwerveIMU for pigeon.
@@ -41,6 +45,7 @@ public class Pigeon2Swerve extends SwerveIMU
4145
public Pigeon2Swerve(int canid, String canbus)
4246
{
4347
imu = new Pigeon2(canid, canbus);
48+
this.cfg = imu.getConfigurator();
4449
SmartDashboard.putData(imu);
4550
}
4651

@@ -60,7 +65,6 @@ public Pigeon2Swerve(int canid)
6065
@Override
6166
public void factoryDefault()
6267
{
63-
Pigeon2Configurator cfg = imu.getConfigurator();
6468
Pigeon2Configuration config = new Pigeon2Configuration();
6569

6670
// Compass utilization causes readings to jump dramatically in some cases.

0 commit comments

Comments
 (0)