Many people use MegaTag1 when the robot is disabled (to get a starting pose) and MegaTag2 when enabled, which can lead to the following code structure.
This can lead to issues where DriverStation.isEnabled() returns different values (if on different threads), and MegaTag2 rotation is trusted. Due to the current MegaTag2 rotation should not be trusted if used. This would allow you to change the second block of code to.
Many people use MegaTag1 when the robot is disabled (to get a starting pose) and MegaTag2 when enabled, which can lead to the following code structure.
followed by
This can lead to issues where
DriverStation.isEnabled()
returns different values (if on different threads), and MegaTag2 rotation is trusted. Due to the current MegaTag2 rotation should not be trusted if used. This would allow you to change the second block of code to.This pull request also adds a small helper function to check if a
PoseEstimate
is valid.