I am using the YAGSL library to run my teams swerve drive. The controller is able to move the drive motors correctly when going in the cardinal directions however when I attempt to move my controller in any diagonal direction the heading motors spin uncontrollably. I am able to stop the spin by going in the opposite diagonal direction. Until I go in the opposite direction however, the motors continue to spin without any controller input. I’ve tried to change controllers, I’ve checked if field relativity makes a change, as well as heading correction. I’ve also tried to change the PID to other values and it does not make a difference. Any advice is greatly appreciated.
Do you have absolute encoders on the pod rotation? Make sure the coordinate system is correct (i.e. positive is clockwise or counter-clockwise)
It might be helpful to share your code. What swerve modules are you using?
Can you reproduce the problem with the robot on blocks? (It’s usually better to turn off field-relative mode when operating on blocks.)
Have you tried graphing the module inputs?
As @Fletch1373 says, it’s easy to get your rotation directions wrong, both for the gyro and for the encoders. Graph them on Shuffleboard and see if they increase when you turn counter-clockwise.
I figured out the issue. It was due to me setting the encoder pulse rate incorrectly when it was supposed to be 4096. I greatly appreciate your advice and I will keep it in mind if I have any further issues. Thank you!
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.