When using toChassisSpeeds and providing swerve module states (which are correct and in the correct order) the XY chassis speed output is good, but the omegaRadiansPerSecound is weird. very very small (.008) and jumps a lot even while spinning at a constant speed.
Did someone encunted this? what could be the problem?
We need more information. like @bovlb said code will help. Also what kind of driving are you doing and what do you expect the omegaRadiansPerSecound to be? If you are driving straight I would expect it to be low (almost 0) .
I think my units are correct, XY speeds are good, and when viewing the provided swerve states in advantage scope they look good (Also checked order which is good)
I agree. If you have correct XY speeds but incorrect omega speeds, it should be the module translations in your kinematics. Can you share the complete code?
public static final Translation2d frontLeftLocation = new Translation2d(
-WIDTH / 2,
LENGTH / 2);
public static final Translation2d frontRightLocation = new Translation2d(
WIDTH / 2,
LENGTH / 2);
public static final Translation2d rearLeftLocation = new Translation2d(
-WIDTH / 2,
-LENGTH / 2);
public static final Translation2d rearRightLocation = new Translation2d(
WIDTH / 2,
-LENGTH / 2);
I think this is it. In WPILib’s coordinate system, the x-axis of your chassis points toward the front, and the y-axis points toward the left.
The correct module translations is:
public static final Translation2d frontLeftLocation = new Translation2d(
LENGTH / 2,
WIDTH / 2);
public static final Translation2d frontRightLocation = new Translation2d(
LENGTH / 2,
-WIDTH / 2);
public static final Translation2d rearLeftLocation = new Translation2d(
-LENGTH / 2,
WIDTH / 2);
public static final Translation2d rearRightLocation = new Translation2d(
-LENGTH / 2,
-WIDTH / 2);