A part of me never thought I would make a topic on cd, but I suppose the canon event is inevitable… So let me make this thorough:
Repository: Robot2.java
Video: Imagur Link
A couple of things to note:
- We are up to date on firmware for all sparks. All wires used are new and came with the new motors/sparks which have never been used before. We are using an old Rio 1 and a PDP from CTRE. We just bought a Pigeon 2.0 and also have that plugged in to CAN, though I really don’t think that there is much of a difference.
- We only have 9 IDs on the CAN network, 0 is a Rio 1, 1-8 odd is Vortexs and even is 550 turning motors with an absolute encoder, 9 is a Pigeon 2.0, and 30 is PDP.
Okay story time
We intend on using MAXSwerve this year, but are currently having some major issues with our motors. Whenever we try to move our motors, they decide they would rather jitter back and forth. My best guess is that this is an issue with the PID, so the rest of this post will explain some testing data that has been accumulated with respect to that.
Upon making two CANSparkFlexs, having one with P = 0 and FF = 1, and the other with P = 0.04 and FF = 1, the one with P = 0 works fine but the one with P = 0.04 start jittering back and forth as seen in this video. D doesn’t affect the extreme oscillation, but reducing the velocity conversion factor (to around 0.00001) in REV hardware client makes it so that the motion is a bit more reasonable, but still not up to speed.
Now while that is strange… what’s really strange about this issue is that it persists even if the settings that were just spoken about were applied but we instead talk to the motor through Swerve.java rather than making it inside of Robot2.java (See Main.java if you are confused on its origins, it replaces Robot.java which we did to try to isolate communication with the motor). Something inside of swerve may be doing logic or changes to the settings on the Flex, but when the same settings are applied inside of MAXSwerveModule (P=0,FF=1), then the motor doesn’t move at all. The PIDFF constants (as explained above) are confirmed to be applied to the motors through REV Hardware Client. The moment we add a P of 0.04, they start jittering again.
One last quick mention is that the Spark Flex documentation/api just isn’t here yet… Which is why I am resorting to you wonderful people.
TLDR:
No matter what values are set to the PID, if it was done through MAXSwerveModule.java rather than Robot2.java, it jitters extremely.
Please let me know if you have any questions, findings and/or similar experiences. Thank you!
- 4738