Skip to main content

Re-zero code for drivetrains

This is just a random article that's meant to help you out with zeroing your drivetrain.

If you are using the CommandSwerveDrivetrain from your CTRE Tuner Constants, you have it easy!

All you have to do is use drivetrain::seedFieldCentric for your code!

However, if you're using the AdvantageKit drivetrain setup, you have it slightly different. 

We re-zero the drivetrain by using the poseEstimator in the AKit setup.

The appropriate code for this is: poseEstimator.resetRotation(0). However, the number you pass in matters here. If you're on the Red alliance side, you would pass in 180. If you're on the Blue alliance side, you would pass in 0. 

Hopefully this clears things up for you. If not, ask in #programming in the discord server and we'll be happy to help you out!