How does the chassis speed class work?

Is it normal that when I convert a chassis speed with 0 velocity in the x direction into module states that the module state returns a 90 degree wheel position? I would imagine it returning 0 degrees. I’m just talking about robot oriented swerve. I’ve also made sure that I supply the kinematics object the right order of modules to fit my module array. The translation 2d for my front left module is 2, 2. Should it be -2, 2 instead? I’m just using these as dummy values to understand how swerve module states return angles.

It would be helpful if you could share a link to your code in GitHub, or at least a snippet showing what you have.

If I understand correctly, you’re asking about the resulting SwerveModuleState objects returned from a call to kinematics.toSwerveModuleStates(ChassisSpeeds). If your chassis speeds has zero X speed, non-zero Y speed, and zero rotation, you’re asking the robot to drive “sideways”, so the wheel position will be 90° or -90°.

You should check out the Coordinate System documentation. I have a feeling you’re expecting Y to be forward, it is not, X is forward.

1 Like

Yep you were right thank you I realized this a few hours after I made the post.

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