Class DifferentialDrivetrainInput
- java.lang.Object
-
- org.chsrobotics.lib.drive.differential.DifferentialDrivetrainInput
-
public class DifferentialDrivetrainInput extends java.lang.ObjectA data class that holds differential drivetrain inputs, split into drivetrain's left and right sides.
-
-
Constructor Summary
Constructors Constructor Description DifferentialDrivetrainInput(double left, double right)Constructs a DifferentialDrivetrainInput.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description DifferentialDrivetrainInputadd(DifferentialDrivetrainInput other)Returns a new DifferentialDrivetrainInput consisting of the sum of left and right values.DifferentialDrivetrainInputclamp(double maxAbsValue)Returns a new DifferentialDrivetrainInput clamped to not exceed a maximum absolute value.booleanequals(java.lang.Object o)inthashCode()DifferentialDrivetrainInputmultiply(double scalar)Returns a new DifferentialDrivetrainInput with the left and right values multiplied by a scalar.java.lang.StringtoString()
-
-
-
Method Detail
-
multiply
public DifferentialDrivetrainInput multiply(double scalar)
Returns a new DifferentialDrivetrainInput with the left and right values multiplied by a scalar.- Parameters:
scalar- The multiplicand.- Returns:
- A scaled DifferentialDrivetrainInput.
-
add
public DifferentialDrivetrainInput add(DifferentialDrivetrainInput other)
Returns a new DifferentialDrivetrainInput consisting of the sum of left and right values.- Parameters:
other- The DifferentialDrivetrainInput to add.- Returns:
- The sum of the two DifferentialDrivetrainInputs.
-
clamp
public DifferentialDrivetrainInput clamp(double maxAbsValue)
Returns a new DifferentialDrivetrainInput clamped to not exceed a maximum absolute value.- Parameters:
maxAbsValue- The absolute value to clamp to. If zero, this will return a DifferentialDrivetrainInput of 0,0.- Returns:
- A DifferentialDrivetrainInput with left and right sides independently clamped.
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
-