Phoenix Swerve Generator

I am trying to use the swerve config for the first time and it’s giving me this error:

“Steer Motor (vel: 0) velocities were below threshold. If the module correctly moved, verify the selected cancoder is the correct CANcoder by blinking it.”

I know for a fact the motors ID’s are correct, and the motor is actually moving, so not sure…

The swerve generator has a test where it tries turning the steer motors and then checks that the encoders are turning as well and in the right direction. If you have made sure the motor IDs are correct I would look at make sure the cancoder ones are too. If they are then try plotting the encoder position graphs and see what happens.

1 Like

I would recommend checking your CANcoder connection, and testing a different module. As the generator says, check your CANcoder ID’s to confirm they are set properly to the right modules. Also check that your swerve has the proper requirements to be compatible with the generator, these requirements can be found here.

If that’s not the issue and If your using the 2025 beta or 2024, check the device firmware to confirm they are up to date with the version of Phoenix Tuner.

I was having this issue a couple days ago but it was simply because my version was incorrect.

You might need to try different version individually for the 2025 beta because some of the firmwares are buggy and don’t work with the generator (this might have just been a fluke on my end but I’m going to test further later today and if it persists I’ll report it to the devs.)

I am almost certain the IDs are correct of the motors, cancoders and gyroscope, I have a working swerve code that makes the robot drive around, i just wanted to try the template creator, additionally the cancoders are displaying, just not the motors, as the drive test fails too.

Make sure you have working code loaded, we tried to run the generator right after flashing the roborio and had the same result as you. Then we loaded a project(I think we just used the ctre example)and it worked correctly after that.

The code works, and it does this for all modules, not just the one I tested

additionally when I drive the motors and plot their encoders it updates to their new position

Is this Phoenix Tuner X Preview or regular Phoenix Tuner X? Phoenix Tuner X Preview assumes you are on the last version of everything. To simplify a bit:

  • 2025.1.1.0 expects firmware version 25.0.1 and API/diagnostics for phoenix beta 2
  • 2025.1.2.0 expects firmware version 25.0.2 and API/diagnostics for phoenix beta 3
  • 2025.1.4.0 expects firmware version 25.0.3 and API/diagnostics for phoenix beta 4

This is a unique problem that only exists during the beta period as we make breaking changes. During the season, everything is stable. A mismatch can result on some unusual errors that we are working on improving.

Additionally, this error can show up if you are using an existing project that might be optimizing out some signals. Deploy a blank robot project with just Phoenix loaded and a single device initialized, completely reboot your robot (rio and all devices), and retry the generator. This issue is resolved in Tuner X Preview 2025.1.3.0 but requires usage of beta software.

Feel free to shoot us an email or call us (details at the bottom of https://store.ctr-electronics.com) for a bit more personalized help.


I am using 2024, without code deployed on the robot, this is so weird

Can you take a screenshot of the list of devices that show up when your first launch Tuner?

Can you take a video of manually controlling a drive or steer motor, and plot their velocity as you drive it?

OOP i just refreshed the 30th time and now it’s working :DDDD


I changed nothing, just reloaded phoenix tuner

1 Like

One interesting thing I found and I am not real sure the best place to report it.

Using the Phoenix Tuner X Preview for the 2025 beta the X and Y locations created by the swerve generator for position of the swerve modules are flipped.

Found by noticing a significant amount of scrub when rotating in place.

Adjusted the code manually to be per the wpilib orientation and it fixes the issue.

I worked through this twice and had the same results so I do not think there was an entry error.

The Tuner X Swerve Project Generator does use the WPILib orientation for X and Y positions, as can be seen in the generated TunerConstants. What modules are you using? Did you make sure the steer motors turn counter-clockwise as seen from the top of the robot in the steer test? And what are the steer motor and CANcoder inverts set to in your generated TunerConstants?

1 Like

I am using WCP Swerve X Flipped with X2 gearing with 11 tooth drive pinions.

The steer motors turned counter clockwise from the top

tuner-swerve-project2.json (5.2 KB)

The TunerConstants generated incorrectly. I just added the front left below, but all modules were similar.

 // Front Left
    private static final int kFrontLeftDriveMotorId = 1;
    private static final int kFrontLeftSteerMotorId = 21;
    private static final int kFrontLeftEncoderId = 11;
    private static final Angle kFrontLeftEncoderOffset = Rotations.of(0.096923828125);
    private static final boolean kFrontLeftSteerMotorInverted = true;
    private static final boolean kFrontLeftCANcoderInverted = false;

    //VALUES CREATED FROM GENERATOR
    //private static final Distance kFrontLeftXPos = Inches.of(10.125);
    //private static final Distance kFrontLeftYPos = Inches.of(12.625);
    
    
   
    //Correct Modified Values
    private static final Distance kFrontLeftXPos = Inches.of(12.625);
    private static final Distance kFrontLeftYPos = Inches.of(10.125);

I do not have the original generated code because it was modified to fix the scrub and correct the generated X & Y, but code repository is here.

LHSPantherbots/2025BetaSwerveGenerator

Oh I see what you’re saying; the signs (+/-) are correct, but the magnitudes are flipped. I can reproduce that and have opened an internal tracker to fix it in the next release.

2 Likes

When I initiate the azimuth test, the turning motor operates, and the driver station is enabled. I’m confident the IDs are correct because blinking them activates the correct motors and CANCoders for each module. However, at the end of the test, the app reports an error indicating the encoder’s velocity is negative and below the threshold.

During the drive test, the app reports zero velocity, even though the drive motor is moving.

Check to make sure you have the 2025 image on your Roborio.

image
It’s up to date