Coding with X Swerve

Someone please correct me if I’m missing something completely obvious but, to the best of my ability I haven’t found any libraries similar to SDS or REV Vendor libs. Does it use a swerve module class native to wpilib? Does anyone have any examples of java code utilizing WCP X Swerve.

1 Like

Hello there. I actually ran into that same problem when my team decided to try swerve for the offseason. Here is my team’s code that uses WCPS Swerve X Modules. Do note that we could never get the mag encoders to be fully functional with tracking position of the modules. 108 WCPS Swerve X Code

1 Like

Here’s our team’s code release post for last season. It includes code for the Swerve X that worked very well for us. It is based on the WPILib swerve code. We’ll be using much of this again this season. We did get the encoders to work, by the way.

Thank you and also @Jez_sanchez for providing resources on a topic that scarcely has any. I just had a question about your use of absolute encoders on the turning motor. Did you use an external encoder (MAG/CANcoder) or is there a way to utilize an absolute encoder function within the integrated sensor?

I have been told there is. In the falcons I have been told that it could contain absolute position. If you look at the ctr electronics documentation on the Talon FX Falcon 500’s it will give you the information you are looking for

And also yes. We did try to use the mag encoders to track the module’s position but came up unsuccessful. If any I HIGLY recommend getting CanCoder instead of the Mag’s. Due to the Mag’s needing to be connected to a speed controller that has a 10 pin input to actually use the functions correctly. The CanCoders were made specifically to be used with Falcon 500’s. But if you want to try getting absolute position with the Falcon 500’s you could.

We used external CANcoders for the turning motors. These are very well set up on the Swerve X modules. The only thing is to be careful of your CAN utilization by turning off or down some of the CAN signals from the turning Falcons. With all 12 devices on the CAN loop (plus whatever else you have on the CAN loop), it can get a bit tricky.

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.