Class DifferentialDriveWheelAccelerations
java.lang.Object
org.wpilib.math.kinematics.DifferentialDriveWheelAccelerations
- All Implemented Interfaces:
Interpolatable<DifferentialDriveWheelAccelerations>, ProtobufSerializable, StructSerializable, WPISerializable
public class DifferentialDriveWheelAccelerations
extends Object
implements Interpolatable<DifferentialDriveWheelAccelerations>, ProtobufSerializable, StructSerializable
Represents the wheel accelerations for a differential drive drivetrain.
-
Field Summary
FieldsModifier and TypeFieldDescriptiondoubleAcceleration of the left side of the robot in meters per second squared.static final DifferentialDriveWheelAccelerationsProtoDifferentialDriveWheelAccelerations protobuf for serialization.doubleAcceleration of the right side of the robot in meters per second squared.static final DifferentialDriveWheelAccelerationsStructDifferentialDriveWheelAccelerations struct for serialization. -
Constructor Summary
ConstructorsConstructorDescriptionConstructs a DifferentialDriveWheelAccelerations with zeros for left and right accelerations.DifferentialDriveWheelAccelerations(double left, double right) Constructs a DifferentialDriveWheelAccelerations.Constructs a DifferentialDriveWheelAccelerations. -
Method Summary
Modifier and TypeMethodDescriptiondiv(double scalar) Divides the DifferentialDriveWheelAccelerations by a scalar and returns the new DifferentialDriveWheelAccelerations.interpolate(DifferentialDriveWheelAccelerations endValue, double t) Returns the linear interpolation of this DifferentialDriveWheelAccelerations and another.Subtracts the other DifferentialDriveWheelAccelerations from the current DifferentialDriveWheelAccelerations and returns the difference.Adds two DifferentialDriveWheelAccelerations and returns the sum.times(double scalar) Multiplies the DifferentialDriveWheelAccelerations by a scalar and returns the new DifferentialDriveWheelAccelerations.toString()Returns the inverse of the current DifferentialDriveWheelAccelerations.
-
Field Details
-
left
Acceleration of the left side of the robot in meters per second squared. -
right
Acceleration of the right side of the robot in meters per second squared. -
proto
DifferentialDriveWheelAccelerations protobuf for serialization. -
struct
DifferentialDriveWheelAccelerations struct for serialization.
-
-
Constructor Details
-
DifferentialDriveWheelAccelerations
public DifferentialDriveWheelAccelerations()Constructs a DifferentialDriveWheelAccelerations with zeros for left and right accelerations. -
DifferentialDriveWheelAccelerations
Constructs a DifferentialDriveWheelAccelerations.- Parameters:
left- The left acceleration in meters per second squared.right- The right acceleration in meters per second squared.
-
DifferentialDriveWheelAccelerations
Constructs a DifferentialDriveWheelAccelerations.- Parameters:
left- The left acceleration in meters per second squared.right- The right acceleration in meters per second squared.
-
-
Method Details
-
plus
Adds two DifferentialDriveWheelAccelerations and returns the sum.For example, DifferentialDriveWheelAccelerations{1.0, 0.5} + DifferentialDriveWheelAccelerations{2.0, 1.5} = DifferentialDriveWheelAccelerations{3.0, 2.0}
- Parameters:
other- The DifferentialDriveWheelAccelerations to add.- Returns:
- The sum of the DifferentialDriveWheelAccelerations.
-
minus
Subtracts the other DifferentialDriveWheelAccelerations from the current DifferentialDriveWheelAccelerations and returns the difference.For example, DifferentialDriveWheelAccelerations{5.0, 4.0} - DifferentialDriveWheelAccelerations{1.0, 2.0} = DifferentialDriveWheelAccelerations{4.0, 2.0}
- Parameters:
other- The DifferentialDriveWheelAccelerations to subtract.- Returns:
- The difference between the two DifferentialDriveWheelAccelerations.
-
unaryMinus
Returns the inverse of the current DifferentialDriveWheelAccelerations. This is equivalent to negating all components of the DifferentialDriveWheelAccelerations.- Returns:
- The inverse of the current DifferentialDriveWheelAccelerations.
-
times
Multiplies the DifferentialDriveWheelAccelerations by a scalar and returns the new DifferentialDriveWheelAccelerations.For example, DifferentialDriveWheelAccelerations{2.0, 2.5} * 2 = DifferentialDriveWheelAccelerations{4.0, 5.0}
- Parameters:
scalar- The scalar to multiply by.- Returns:
- The scaled DifferentialDriveWheelAccelerations.
-
div
Divides the DifferentialDriveWheelAccelerations by a scalar and returns the new DifferentialDriveWheelAccelerations.For example, DifferentialDriveWheelAccelerations{2.0, 2.5} / 2 = DifferentialDriveWheelAccelerations{1.0, 1.25}
- Parameters:
scalar- The scalar to divide by.- Returns:
- The scaled DifferentialDriveWheelAccelerations.
-
interpolate
public DifferentialDriveWheelAccelerations interpolate(DifferentialDriveWheelAccelerations endValue, double t) Returns the linear interpolation of this DifferentialDriveWheelAccelerations and another.- Specified by:
interpolatein interfaceInterpolatable<DifferentialDriveWheelAccelerations>- 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.
-
toString
-