Class DifferentialDrivetrainInput
java.lang.Object
org.chsrobotics.lib.drive.differential.DifferentialDrivetrainInput
A data class that holds differential drivetrain inputs, split into drivetrain's left and right
sides.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionDifferentialDrivetrainInput(double left, double right) Constructs a DifferentialDrivetrainInput. -
Method Summary
Modifier and TypeMethodDescriptionadd(DifferentialDrivetrainInput other) Returns a new DifferentialDrivetrainInput consisting of the sum of left and right values.clamp(double maxAbsValue) Returns a new DifferentialDrivetrainInput clamped to not exceed a maximum absolute value.booleaninthashCode()multiply(double scalar) Returns a new DifferentialDrivetrainInput with the left and right values multiplied by a scalar.toString()
-
Field Details
-
left
public final double left -
right
public final double right
-
-
Constructor Details
-
DifferentialDrivetrainInput
public DifferentialDrivetrainInput(double left, double right) Constructs a DifferentialDrivetrainInput.- Parameters:
left- : value corresponding with left side input.right- : value corresponding with right side input.
-
-
Method Details
-
multiply
Returns a new DifferentialDrivetrainInput with the left and right values multiplied by a scalar.- Parameters:
scalar- The multiplicand.- Returns:
- A scaled DifferentialDrivetrainInput.
-
add
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
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
-
equals
-
hashCode
public int hashCode()
-