When I updated WPILib to 2023, I noticed that our swerve drive code no longer works. It seems they have changed the way the SwerveDrivePoseEstimator works. I don’t really know enough about this swerve code enough to know how to update it (it’s code from another team). If anyone can help us out, I’d really appreciate it. If anyone can provide some working code, that would also be helpful.
Yeah, WPI changed the SwerveDrivePoseEstimator. WPI posted all of the changes for 2023 here: https://docs.wpilib.org/en/stable/docs/yearly-overview/yearly-changelog.html. If you want an example for functional code with the SwerveDrivePoseEstimator, I would recommend looking at WPI’s example SwerveDrivePoseEstimator project. You can create an example project by selecting example instead of template when you create a new project.
The new SwerveDriveOdometry/SwerveDrivePoseEstimator requires you to pass an array of SwerveModulePositions instead of an array of SwerveModuleStates. See these updated examples for reference on how to update your code.