Class SwerveModuleVelocityWithAzimuth

java.lang.Object
org.wpilib.math.kinematics.SwerveModuleVelocity
yams.core.mechanisms.swerve.SwerveModuleVelocityWithAzimuth
All Implemented Interfaces:
Comparable<org.wpilib.math.kinematics.SwerveModuleVelocity>, org.wpilib.math.interpolation.Interpolatable<org.wpilib.math.kinematics.SwerveModuleVelocity>, org.wpilib.util.protobuf.ProtobufSerializable, org.wpilib.util.struct.StructSerializable, org.wpilib.util.WPISerializable

public class SwerveModuleVelocityWithAzimuth extends org.wpilib.math.kinematics.SwerveModuleVelocity
A SwerveModuleVelocity that also holds how fast the wheel is turning: the angular velocity of the azimuth.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    org.wpilib.units.measure.AngularVelocity
    Angular velocity of the azimuth, counterclockwise positive.

    Fields inherited from class org.wpilib.math.kinematics.SwerveModuleVelocity

    angle, proto, struct, velocity
  • Constructor Summary

    Constructors
    Constructor
    Description
    SwerveModuleVelocityWithAzimuth(double velocity, org.wpilib.math.geometry.Rotation2d angle, org.wpilib.units.measure.AngularVelocity azimuthVelocity)
    Create a module state with the azimuth's angular velocity.
    SwerveModuleVelocityWithAzimuth(org.wpilib.units.measure.LinearVelocity velocity, org.wpilib.math.geometry.Rotation2d angle, org.wpilib.units.measure.AngularVelocity azimuthVelocity)
    Create a module state with the azimuth's angular velocity.
  • Method Summary

    Modifier and Type
    Method
    Description
    static org.wpilib.math.kinematics.SwerveModuleVelocity
    optimize(org.wpilib.math.kinematics.SwerveModuleVelocity desired, SwerveModuleVelocityWithAzimuth measured, org.wpilib.math.geometry.Rotation2d lastCommanded)
    Optimize a module state like SwerveModuleVelocity.optimize(Rotation2d), keeping the orientation the wheel was last sent to unless the other is better by more than 30 degrees.
    static org.wpilib.math.kinematics.SwerveModuleVelocity
    optimize(org.wpilib.math.kinematics.SwerveModuleVelocity desired, SwerveModuleVelocityWithAzimuth measured, org.wpilib.math.geometry.Rotation2d lastCommanded, org.wpilib.units.measure.Angle hysteresis)
    Optimize a module state like SwerveModuleVelocity.optimize(Rotation2d), keeping the orientation the wheel was last sent to unless the other is better by more than hysteresis.
     

    Methods inherited from class org.wpilib.math.kinematics.SwerveModuleVelocity

    compareTo, cosineScale, equals, hashCode, interpolate, optimize

    Methods inherited from class Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Field Details

    • azimuthVelocity

      public org.wpilib.units.measure.AngularVelocity azimuthVelocity
      Angular velocity of the azimuth, counterclockwise positive.
  • Constructor Details

    • SwerveModuleVelocityWithAzimuth

      public SwerveModuleVelocityWithAzimuth(double velocity, org.wpilib.math.geometry.Rotation2d angle, org.wpilib.units.measure.AngularVelocity azimuthVelocity)
      Create a module state with the azimuth's angular velocity.
      Parameters:
      velocity - Drive velocity of the wheel, in meters per second.
      angle - Angle of the wheel.
      azimuthVelocity - Angular velocity of the azimuth, counterclockwise positive.
    • SwerveModuleVelocityWithAzimuth

      public SwerveModuleVelocityWithAzimuth(org.wpilib.units.measure.LinearVelocity velocity, org.wpilib.math.geometry.Rotation2d angle, org.wpilib.units.measure.AngularVelocity azimuthVelocity)
      Create a module state with the azimuth's angular velocity.
      Parameters:
      velocity - Drive velocity of the wheel.
      angle - Angle of the wheel.
      azimuthVelocity - Angular velocity of the azimuth, counterclockwise positive.
  • Method Details

    • optimize

      public static org.wpilib.math.kinematics.SwerveModuleVelocity optimize(org.wpilib.math.kinematics.SwerveModuleVelocity desired, SwerveModuleVelocityWithAzimuth measured, org.wpilib.math.geometry.Rotation2d lastCommanded)
      Optimize a module state like SwerveModuleVelocity.optimize(Rotation2d), keeping the orientation the wheel was last sent to unless the other is better by more than 30 degrees.
      Parameters:
      desired - Module state to optimize.
      measured - The wheel's measured state.
      lastCommanded - Angle the wheel was last sent to, or null if it has not been sent anywhere.
      Returns:
      The optimized module state.
    • optimize

      public static org.wpilib.math.kinematics.SwerveModuleVelocity optimize(org.wpilib.math.kinematics.SwerveModuleVelocity desired, SwerveModuleVelocityWithAzimuth measured, org.wpilib.math.geometry.Rotation2d lastCommanded, org.wpilib.units.measure.Angle hysteresis)
      Optimize a module state like SwerveModuleVelocity.optimize(Rotation2d), keeping the orientation the wheel was last sent to unless the other is better by more than hysteresis. A wheel still turning can be near 90 degrees from both orientations of a target that keeps moving, such as a path starting off in a new direction; choosing by its angle alone would reverse it back and forth.
      Parameters:
      desired - Module state to optimize.
      measured - The wheel's measured state.
      lastCommanded - Angle the wheel was last sent to, or null if it has not been sent anywhere.
      hysteresis - How much nearer the wheel the other orientation must be to turn it around.
      Returns:
      The optimized module state.
    • toString

      public String toString()
      Overrides:
      toString in class org.wpilib.math.kinematics.SwerveModuleVelocity