I have been working on modiyfing/using REV’s MaxSwerveTemplate for my team’s Swerve Drive. However, I’ve noticed even with a NavX IMU, we experience significant drift both during TeleOP and in Pathplanner paths. I think the issue might the be the default PID values. As someone who is completely new to PID tuning for FRC, could you provide a walkthrough or help get our PID tuned?
I would like to get an answer to this question as well. My team uses YAGSL, but I assume PID tuning would be similar. I would like to know what software to use to tune swerve PIDs as well.
For MAXSwerve I’ve just used the PID values from the example, haven’t had an issue with that. Seeing as it’s COTS, the PID values are pretty transferrable.
We ended up visually tuning our robot without SysID. The default FF formula (1/freeWheelSpeed) worked well. Using AScope to graph our setpoint (desiredModuleStates) and our actual values (getModuleStates) were very helpful in fine tuning our kP term. For our PID overall, we only used kP and FF for the driving motors and just kP for the turning.
In regards to pathplanner PIDs, we just used the commanded vs. actual velocity of the robot in the Telemetry tab to tune the rotation PID (just kP) and translation PID (kP, kI, and kD). Hope this helps!
Hello! We are also currently using MAXSwerve for our robot and have been experiencing significant drift. We initially tried using Advantage Kit with little success and moved to Advantage Scope, but we found very few code examples. Could you explain your setup for advantage scope? Thank you!
No problem! I would recommend using Monologue (GitHub - shueja/Monologue) to log specific data. I would focus on logging your desired module states (DriveSubsystem.java → drive() → create an array of the SwerveModuleStates before they are desaturated and log() that) and your actual module states (DriveSubsystem.java → getSwerveModuleStates (I would use @Log.NT here instead of log()). Then I would drag and drop the same module (say module 1) from both of these logs onto the leftAxis in the LineGraph tab of AScope. This won’t work for your tuning motors (those should be tuned visually, set ALL PIDFF values (both turning/translation to zero) and increase kP until the robot can change from straight wheels to turning wheels to setX() without ossiclations and be snappy)). Then you can use AScope to use the PID values for your drive motors (Just use the default FF term). Hope that makes sense!