Example for Phoenix Pro/v6 Swerve

My team uses Falcon 500s for swerve drive. After the Phoenix Pro/v6 update, we are having issues migrating over to the new version. We would like to use the WPILib Command-based framework. Could someone offer example code for swerve using Phoenix Pro?

1 Like
3 Likes

This is our phoenix 6 swerve base code (without the pro features).

There are things the CTRE code does that I would like to use like OdometryThread but the code is not setup with command based and although command based could be added. It’s not something we are going to tackle for now. I would like to program it with time sync but there is a few potential issues with the way I would do it now that I would need to solve first. I would like to see CTRE make a variant of their code specific to command based and Ideally a variant of 364s base code.

3 Likes

Thank you for sharing this code. We saw that there is a class called “Better” Swerve Kinematics and we were wondering what exactly the difference was from regular Swerve Kinematics. Reading the comments, it seems like Better Swerve Kinematics has more information about the state of the modules, but they do the same thing in the end. In particular, is there any difference between the setDesiredState and betterSetDesiredState methods?

I forgot that was there. I am experimenting with second order kinematics. That is an implementation I found from one of the open alliance teams I believe but I forgot which.

Edit: I think it is 95s implementation unless they modified it from someone else

1 Like

We just released 3061-lib 2023.2.0 with Phoenix 6 support based on the 2023 software components. It utilizes Pro features when licensed and falls back on non-Pro feature otherwise. It does use the WPILib command-based framework. There’s several other components as well such as AdvantageKit, PathPlanner, and PhotonVision; so, it may be more than you need.