First Ever Swerve Drive Help

We are trying to get our first ever swerve drive and we are just lost.
We have 8 falcon 500’s and at the moment no absolute encoders (They arrived today we’re installing them on Saturday). We originally could not get the wheels to spin left and right (forward and backward worked). The code below is what we created to test our swerve with constant velocities. We eliminated some of the aspects to help simplify it. At this point we think their is something wrong with the PID controller as the wheels now spin but they constantly go back in forth and do not settle. We are out of ideas.

Our kp and ki values are guesses. When we run through the instructions on how to find them (As show in 0 to Autonomous) we get 0.00015. That number prevents the wheels from ever turning left and right at all. So we put in 0.5 and saw some progress.

Does anyone have any suggestions or thoughts? We just don’t know where to go at this point.

Which encoders are you using? If you’re using CANcoders, I HIGHLY recommend using CTRE’s Phoenix Tuner X swerve code generator

1 Like

The Falcon 500s have a built-in encoder that we are using they are 2048 CPR encoders. We are hopefully adding SRX Magnetic Encoders on Saturday.
I will look into this. (hopefully it works with what we have: Falcons, SRX, and NavX)

Is it srx magnetic encoders or the cancoders? Unsure if tuner x has an option for the SRX.

1 Like

In order to use the Swerve generator they would need both CANCoders and a Pigeon 2.

You could/should probably use YAGSL if this is your setup

3 Likes

I will try.

Double check if this is what you meant. These are still going to be ~relative encoders~ apparently I’m wrong, ignore me didn’t know they were absolute compatible, not absolute so you will need to make sure to reset them to their home positions manually

We bought These. They say the give absolute position measurement.

1 Like

Good catch, hope that’s true, maybe because of the magnetic shaft it can still remain absolute relative to that in one rotation. Typically your absolute encoders form a larger ring and have set hard points so the shaft of the motor or axles can’t slip from a known position even at power loss. Meaning X degree of rotation from home is always the same value no matter what. As long as you have that you will be fine. Using relative only is asking for trouble and burnt out people in the drive team.

We will install and test one to be sure.

1 Like