Fix deprecation warnings in PhotonLib examples (#1699)

The following deprecation warnings have been fixed:
- `SwerveModuleState.optimize(desiredState, currentRotation);`, which is
now an instance method
- `AprilTagFields.kDefaultField.loadAprilTagLayoutField();`, which is
now `AprilTagFieldLayout.loadField(AprilTagFields.kDefaultField);`

WIP:
- [x] C++
- [x] Python
This commit is contained in:
DeltaDizzy
2025-01-11 23:30:24 -05:00
committed by GitHub
parent 159b848234
commit d487e1c466
12 changed files with 48 additions and 27 deletions

View File

@@ -48,7 +48,7 @@ public class Constants {
// The layout of the AprilTags on the field
public static final AprilTagFieldLayout kTagLayout =
AprilTagFields.kDefaultField.loadAprilTagLayoutField();
AprilTagFieldLayout.loadField(AprilTagFields.kDefaultField);
// The standard deviations of our vision estimated poses, which affect correction rate
// (Fake values. Experiment and determine estimation noise on an actual robot.)

View File

@@ -108,7 +108,7 @@ public class SwerveModule {
SwerveModuleState desiredState, boolean openLoop, boolean steerInPlace) {
Rotation2d currentRotation = getAbsoluteHeading();
// Avoid turning more than 90 degrees by inverting speed on large angle changes
desiredState = SwerveModuleState.optimize(desiredState, currentRotation);
desiredState.optimize(currentRotation);
this.desiredState = desiredState;
}