We’ve been working to debug our autonomous code for a while now. We’ve had to deal with numerous issues and have finally gotten it down to this one. Our robot starts in the center of the path outline (as expected), then moves to follow the edge. This issue has occurred with in-code trajectories, Pathweaver, and Pathplanner. We use the Wpilib RamseteCommand and JSON path files. We have also attempted to use Pathplannerlib’s PPRamseteCommand.
It looks like you’re not able to turn aggressively enough to keep on the path.
You might want to log the voltages being sent to Drivetrain.tankDriveVolts(). If they’re being saturated, then the robot will have trouble turning, although that seems unlikely given your speed constraint.
Looking at Drivetrain.updateOdometry(), I see a couple of odd things. You’re doubling the velocity and the position, but I can’t tell if that’s been taken account of in the conversion factors. You’re also calling getPosition on each encoder twice, which may be returning different answers.