SwerveDrivePoseEstimator Outputs Null

I’m on latest WPILib 2023.4.3, but this has happened on previous releases too. Sometimes (even in sim), I experience a reading of null for x and y when getting the latest pose from the SwerveDrivePoseEstimator. I thought this was something to do with our Vision updates, but it also has occurred in sim, which makes me believe it is something else we are doing. Here is our code: GitHub - pittsfordrobotics/ChargedUp2023 at autoDrive

If it also happens without vision updates, there must be something wrong with the ModuleStates that you are supplying to the PoseEstimator. Have you tried logging the distance and angle of your ModuleStates?

If not, that would probably be my first point of action. Would love to help out if you have any further questions

It might also be the robot angle

Oh right, I falsely assumed that would be a direct sensor reading meaning it would probably always be numeric. But that’s not the case here. Could indeed also be the case that the angle is off

Yep, I can confirm the module states became null in sim, but it still happens on the real robot which is confusing. I’ll attach an log file when I get the chance to.

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.