Help with WPILib Swerve Odometry and Trajectory Config using SDS Template Code

We’ve been attempting to create an odometry system using SDS’s swerve lib, but we appear to be hitting a wall regarding the SwerveModulePosition. Using template code, it appears that we are able to get Drive Velocity and Steer Angle, but nothing that would equate to a position. Is there anything we’re missing, or a way to bypass this.

We reach a secondary issue when it comes to using the Trajectory Config to build our autonomous system. The template code doesn’t provide any acceleration, so we were wondering if there was a way to calculate it using the constants that are provided, or if robot characterization is the way to go about it.

The SDS library is no longer maintained and wasn’t updated to the 2023 WPILib API. You could modify one of these instead:

You can calculate acceleration via a backward finite difference if you need to ((current velocity - last velocity) / time between velocity samples).

For the second Base Code you sent, the one by team 7461, how do you find the offset values

The same way you do for any swerve drive. Print out the encoder values when the modules are pointing forward.

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