Our team is trying to implement swerve drive for the first time and we are having problems with oscillation on our steer motors and the steer motors not getting to the setpoints properly. The setpoints seem to be calculating just fine however. We are using MA3 absolute analog encoders and CANTalon motor controllers for all 8 of our motors. Our encoders are coupled directly to the shafts of the steer motors.
Here is our code for reference. It is a stripped down and simplified version of team 16 BombSquad’s code from last year:
Thanks again Jefferson! So helpful! The leads to the steer motors were reversed. When we switched the leads or instead just put in a negative P value in our PID for the code, it worked. Not sure why it caused the motors to behave in the way they did. Someone more technically versed than I can probably explain it better.