Issues with swerve rotation when migrating to phoenix v6

Our team has recently began to migrate our phoenix v5 swerve code (previously worked in 2023 code) to phoenix v6. We have most aspects working, but we have struggled with our steer motor angles. Our right joystick does not properly rotate the robot. The steer motors always go to an “X” position, instead of the expected angle. The left joystick moves the robot in an x and y axis.

This appears to be an invert issue, but we have tried all the changes we can think of to correct this issue.

We’ve looked at a SwerveModule code ported to v6 by dirtbikerxz, and we have not seen any major differences in format between our version and their version.

Here is a link to our GitHub repository link

My team was running into the same issue yesterday. We couldn’t figure it out either, but I’m replying to try to keep this from getting buried under all the other threads of Chief Delphi.

lol, Likewise also struggled with our own today with the same framework. It’s a tricky bugger at times!

I’m not finding any obvious fault in your code, though if I were trying to sort it out I’d try making the condition to drop into X mode DriveCommand.java:127, be based on the xSpeedInput, ySpeedInput, and rotationInput. That way your logic isn’t dependent on the kinematics working out exactly as expected.

The only other suggestion is that maybe MAX_ANGULAR_VELOCITY_RADIANS_PER_SECOND on DriveSubsystem.java:85 shouldn’t be 12.2 but rather 2*pi since that sets a max rotation of 0.5 per second vs 6 per second. Based on the comments included on the line it looks like there’s been some confusion on that one. Been there, done that!