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.

static optimize(desiredState: wpimath.kinematics._kinematics.SwerveModuleState, currentAngle: wpimath.geometry._geometry.Rotation2d) wpimath.kinematics._kinematics.SwerveModuleState

Minimize the change in heading the desired 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:
  • desiredState – The desired state.

  • currentAngle – The current module angle.

property speed wpimath.units.meters_per_second

Speed of the wheel of the module.

property speed_fps