[wpimath] Rework function signatures for Pose Estimation / Odometry (#4642)

Forcing the use of SwerveModulePostition[] and wpi::array<SwerveModulePosition, len> in place of variadic function signatures.
This commit is contained in:
Jordan McMichael
2022-11-17 13:36:33 -05:00
committed by GitHub
parent 0401597d3b
commit ce4c45df13
9 changed files with 84 additions and 104 deletions

View File

@@ -65,7 +65,7 @@ public class SwerveDriveOdometry {
public SwerveDriveOdometry(
SwerveDriveKinematics kinematics,
Rotation2d gyroAngle,
SwerveModulePosition... modulePositions) {
SwerveModulePosition[] modulePositions) {
this(kinematics, gyroAngle, modulePositions, new Pose2d());
}
@@ -82,7 +82,7 @@ public class SwerveDriveOdometry {
* @param modulePositions The wheel positions reported by each module.
*/
public void resetPosition(
Pose2d pose, Rotation2d gyroAngle, SwerveModulePosition... modulePositions) {
Pose2d pose, Rotation2d gyroAngle, SwerveModulePosition[] modulePositions) {
if (modulePositions.length != m_numModules) {
throw new IllegalArgumentException(
"Number of modules is not consistent with number of wheel locations provided in "
@@ -120,7 +120,7 @@ public class SwerveDriveOdometry {
* in the same order in which you instantiated your SwerveDriveKinematics.
* @return The new pose of the robot.
*/
public Pose2d update(Rotation2d gyroAngle, SwerveModulePosition... modulePositions) {
public Pose2d update(Rotation2d gyroAngle, SwerveModulePosition[] modulePositions) {
if (modulePositions.length != m_numModules) {
throw new IllegalArgumentException(
"Number of modules is not consistent with number of wheel locations provided in "