Help with Swerve Autonomous Mode

Our team is currently encountering issues with getting the swerve drive to run properly in autonomous mode. We had tuned the PIDs for each turn and steer controller, using WPI_TalonSRX…and the students made each autonomous command e.g. AutoTurnLeft, AutoTurnRight, AutoDriveStraight, and AutoDriveBackward, etc.

However, when we combined all the auto commands into one command group to test in autonomous mode, the problem(s) arise. The autonomous mode seems to be ran inconsistently. For example, we ran the commands sequentially in this order, AutoDriveStraight, AutoTurnLeft, AutoDriveBackward, and then AutoTurnRight… some times it runs AutoDriveStraight and AutoDriveBackward ONLY, and skips AutoTurnLeft and AutoTurnRight. But most of the time it just skips AutoDriveBackward… I’m trying to help my students debug the code but couldn’t find anything wrong with the code (with limited knowledge of PID, we’re using the built in TalonSRX PIDs). Any feedback or pointers would be much appreciate it. Thank you.

I’d attached our implementations of the drive train (messy) and the commands we built off of it as well as the command group file (AutoExample.java):
Drive.java (16.8 KB)
AutoDriveBackward.java (84.1 KB)
AutoDriveLeft.java (84.1 KB)
AutoDriveRight.java (84.1 KB)
AutoDriveStraight.java (86.2 KB)
AutoExample.java (80.9 KB)

For reference not sure if it matters, but we are using the built-in encoder in the motors (only got 1 out of 4 encoders hooked up) TalonSRX speed controllers and we’re using analog encoders for the TalonSRX turn controllers, all in CAN Bus config.

Your commands seem to be html files, not java files.

NEOs only support the SparkMax speed controller. You can’t use Talon SRXs with them.

Thanks @Joe_Ross

Not sure what you mean by those files are htmls, they are Java files and we’d ran with them. As for the motors, discard what I previous said…that’s not the correct model, so for us using WPI_TalonSRX class is fine.

Click on AutoDriveBackward.java from your original post (or here).

Oh I see what you mean. So if you download those files are open it with VS code/Eclipse then you should be able to see them.