Hello, I am trying to use the wpilib MecanumDriveKinematics class to get the angular velocity on our robot, but I am getting unusable/inconsistent values. It works for getting vx and vy, so I don’t think it is a hardware issue.
In my drivetrain subsystem periodic method, I have this line
curChassisSpeeds = kinematics.toChassisSpeeds(getCurrentWheelSpeeds());
and then I have a method that returns
Math.toDegrees(curChassisSpeeds.omegaRadiansPerSecond);
Here are the graphs on SmartDashboard after rotating in place and driving a little bit to test vx and vy: (I’m pretty sure the time axes on each graph aren’t synced btw)
I can use the NavX gyro to get the actual angular velocity and it works, and you can compare the gyro and mecanum angular velocity graphs to see how the mecanum one is bad.
I am wondering if this is something wrong with my code or something wrong in the wpilib libaries
My drivetrain subsystem and full code is here