Class SwerveModuleAcceleration
java.lang.Object
org.wpilib.math.kinematics.SwerveModuleAcceleration
- All Implemented Interfaces:
Comparable<SwerveModuleAcceleration>, Interpolatable<SwerveModuleAcceleration>, ProtobufSerializable, StructSerializable, WPISerializable
public class SwerveModuleAcceleration
extends Object
implements Interpolatable<SwerveModuleAcceleration>, Comparable<SwerveModuleAcceleration>, ProtobufSerializable, StructSerializable
Represents the accelerations of one swerve module.
-
Field Summary
FieldsModifier and TypeFieldDescriptiondoubleAcceleration of the wheel of the module in meters per second squared.Angle of the acceleration vector.static final SwerveModuleAccelerationProtoSwerveModuleAccelerations protobuf for serialization.static final SwerveModuleAccelerationStructSwerveModuleAccelerations struct for serialization. -
Constructor Summary
ConstructorsConstructorDescriptionConstructs a SwerveModuleAccelerations with zeros for acceleration and angle.SwerveModuleAcceleration(double acceleration, Rotation2d angle) Constructs a SwerveModuleAccelerations.SwerveModuleAcceleration(LinearAcceleration acceleration, Rotation2d angle) Constructs a SwerveModuleAccelerations. -
Method Summary
Modifier and TypeMethodDescriptionintCompares two swerve module accelerations.booleaninthashCode()interpolate(SwerveModuleAcceleration endValue, double t) Returns the linear interpolation of this SwerveModuleAccelerations and another.toString()
-
Field Details
-
acceleration
Acceleration of the wheel of the module in meters per second squared. -
angle
Angle of the acceleration vector. -
proto
SwerveModuleAccelerations protobuf for serialization. -
struct
SwerveModuleAccelerations struct for serialization.
-
-
Constructor Details
-
SwerveModuleAcceleration
public SwerveModuleAcceleration()Constructs a SwerveModuleAccelerations with zeros for acceleration and angle. -
SwerveModuleAcceleration
Constructs a SwerveModuleAccelerations.- Parameters:
acceleration- The acceleration of the wheel of the module in meters per second squared.angle- The angle of the acceleration vector.
-
SwerveModuleAcceleration
Constructs a SwerveModuleAccelerations.- Parameters:
acceleration- The acceleration of the wheel of the module.angle- The angle of the acceleration vector.
-
-
Method Details
-
interpolate
Returns the linear interpolation of this SwerveModuleAccelerations and another.- Specified by:
interpolatein interfaceInterpolatable<SwerveModuleAcceleration>- Parameters:
endValue- The end value for the interpolation.t- How far between the two values to interpolate. This is clamped to [0, 1].- Returns:
- The interpolated value.
-
equals
-
hashCode
-
compareTo
Compares two swerve module accelerations. One swerve module is "greater" than the other if its acceleration magnitude is higher than the other.- Specified by:
compareToin interfaceComparable<SwerveModuleAcceleration>- Parameters:
other- The other swerve module.- Returns:
- 1 if this is greater, 0 if both are equal, -1 if other is greater.
-
toString
-