DriveModifier
A utility class designed for modifying Translation objects, primarily used with robot drivetrains. It provides static functions for common modifications like swapping X and Y components or inverting individual components, as well as a class that can apply a combination of these modifications.
Static Fields (Functions)
These are Function<Translation, Translation> objects that can be used directly to modify a Translation.
SWAP_XY
A function that swaps the X and Y components of a Translation.
INVERT_X
A function that inverts (multiplies by -1) the X component of a Translation.
INVERT_Y
A function that inverts (multiplies by -1) the Y component of a Translation.
INVERT_Z
A function that inverts (multiplies by -1) the Z component of a Translation.
Methods
swapXY(Translation translation)
Static method that returns a new Translation with the X and Y components of the input translation swapped.
invertX(Translation translation)
Static method that returns a new Translation with the X component of the input translation inverted.
invertY(Translation translation)
Static method that returns a new Translation with the Y component of the input translation inverted.
invertZ(Translation translation)
Static method that returns a new Translation with the Z component of the input translation inverted.
swapXY(boolean swapXY)
Sets whether the X and Y components should be swapped when modify() is called. Returns this for method chaining.
invertX(boolean invertX)
Sets whether the X component should be inverted when modify() is called. Returns this for method chaining.
invertY(boolean invertY)
Sets whether the Y component should be inverted when modify() is called. Returns this for method chaining.
modify(Translation translation)
Applies the configured modifications (swapping X/Y, inverting X, inverting Y) to the input translation and returns the modified Translation.