BroncBotz3481 / YAGSL

Yet Another General Swerve Library

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Dynamically tuning PIDF?

jaredandrews opened this issue · comments

Hello, we are currently tuning our YAGSL PIDF values and I'm wondering if there is a recommended way to do it in a more dynamic fashion.

Currently, our programmer is changing the value in the JSON, deploying, testing and then repeat.

I have been looking for ways to speed up this feedback loop if there are any recommendations?

I tried modifying the P value from code, during runtime doing something like this:

swerveDrive.getModules()[0].configuration.velocityPIDF.p = 0.5

But this does not work. I have been trying to find a setter method or something like that in the JavaDocs, but I'm not finding anything.

Am I missing something here? Is it possible to modify these values programmatically? Thanks!

You can already do this

You have to use SwerveMotor.configurePIDF on each motor controller though.

You can fetch these with SwerveModule.getDriveMotor() or SwerveModule.getAngleMotor()

https://github.com/BroncBotz3481/YAGSL-Example/blob/dev/src%2Fmain%2Fjava%2Fswervelib%2Fmotors%2FSwerveMotor.java#L46-L51

@thenetworkgrinch thank you!!!!!!!!!