Hello everyone, I am the lead programmer on my team and we are having some trouble with using PathWeaver and WPILib’s Trajectory class for the autoNAV Challenge. We don’t have any errors in our code or anything and our robot actually somewhat drives the path we tell it to, but only somewhat and not very consistently. For example: for the barrel racing path, we always loop around the first ball as we should, but after that the robot reacts strangely, sometimes driving differently even when we have not changed the code or the path to be driven at all.
Some theories I have: Could there be a unit conversion error somewhere? (when converting from native encoder units to meters) Could gyroscope drift be causing this as the first loop of the path seems to be completed fine? Or I understand that WPILib Trajectories are time-based, could we be missing states of the trajectory somehow?
Any help would be GREATLY appreciated, as you all know the deadline for skills challenges is soon and we were really hoping to get this to work because trajectory following is something our team has never done before.
Here is the link to our code on GitHub: InfiniteRecharge/src/main/java/org/usfirst/frc/team3042/robot at master · team3042/InfiniteRecharge (github.com)
The Drivetrain Subsystem is in “subsystems -> Drivetrain.java” and our command for driving a trajectory is in “commands -> drivetrain -> Drivetrain_Trajectory.java”