Can you share more of your code? Preferably as a link to github or similar
You need to update the gyro’s sim object with the robot’s updated angle in simulation.
For swerve, you can do something like this to get the angle from your module’s updated position: Any Gyro Sims Recommendations? - #2 by jonahb55
For tank drives, WPILib’s DifferentialDrivetrainSim
should provide you an angle, see this as an example: https://github.com/4201VitruvianBots/RapidReact2022/blob/4333e589481cd617bc2f46a806c48e33faae32a8/src/main/java/frc/robot/subsystems/DriveTrain.java#L685C45-L685C66
1 Like