Swerve Drive jittering and turn position issues

We have run into a problem with our swerve where it still responds to the controller but jitters and goes way past position. I have tried messing with pturning and even adding in a little d to see if I could stop the overshoot but this doesn’t seem like a PID issue to me. What makes it even weirder is that sometimes some move as in the video, where some move or spin rapidly and others do not which makes me think it may be encoders acting up.

We are using MK4i’s with Neos and a cancoder for absolute positioning.

Code: GitHub - PortlandRoboticsTeam/FRC-2023: 2023 robot
Video: https://drive.google.com/file/d/1Q6nBC-JhOHkb4IEMTukimjSnN0oU9WGd/view?usp=share_link

From a quick look at the video, I agree it looks like your kP is way too high. From your constants file, kP is 0.5. Some estimating (pi / 2 * 0.5) says that your turning motor would run at ~80% power if the wheel was 90 degrees off. Especially with your robot on blocks, swerve module wheels are fairly easy to turn(w/ relatively low inertia) , so I think they’re overshooting and the motor is over correcting.

For the modules not doing the same thing, there are a lot of different ways that could happen. If you’ve done any more testing and noticed anything else, please share.

Aside from that, I’m not sure how getAbsoluteEncoderRad() works. I might be missing something, but I’m not sure how it would give you an angle. I know CANcoders can be configured to boot to absolute position, and you can get their angle directly with getAbsolutePosition().

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.