SwerveModuleState

class wpimath.kinematics.SwerveModuleState(speed: wpimath.units.meters_per_second = 0, angle: wpimath.geometry._geometry.Rotation2d = Rotation2d(0.000000))

Bases: pybind11_object

Represents the state of one swerve module.

WPIStruct = <capsule object "WPyStruct">
property angle wpimath.geometry._geometry.Rotation2d

Angle of the module.

cosineScale(currentAngle: wpimath.geometry._geometry.Rotation2d) None

Scales speed by cosine of angle error. This scales down movement perpendicular to the desired direction of travel that can occur when modules change directions. This results in smoother driving.

Parameters:

currentAngle – The current module angle.

optimize(currentAngle: wpimath.geometry._geometry.Rotation2d) None

Minimize the change in the heading this swerve module state would require by potentially reversing the direction the wheel spins. If this is used with the PIDController class’s continuous input functionality, the furthest a wheel will ever rotate is 90 degrees.

Parameters:

currentAngle – The current module angle.

property speed wpimath.units.meters_per_second

Speed of the wheel of the module.

property speed_fps