SwerveModuleVelocity
- class wpimath.SwerveModuleVelocity(velocity: wpimath.units.meters_per_second = 0, angle: wpimath._wpimath.Rotation2d = Rotation2d(0.000000))
Bases:
pybind11_objectRepresents the velocity of one swerve module.
- WPIStruct = <capsule object "WPyStruct">
- cosineScale(currentAngle: wpimath._wpimath.Rotation2d) wpimath._wpimath.SwerveModuleVelocity
Scales velocity 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.
- Returns:
The scaled SwerveModuleVelocity.
- optimize(currentAngle: wpimath._wpimath.Rotation2d) wpimath._wpimath.SwerveModuleVelocity
Minimize the change in the heading this swerve module velocity 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.
- Returns:
The optimized SwerveModuleVelocity.
- property velocity_fps