Class SwerveInputTransform


  • public class SwerveInputTransform
    extends java.lang.Object
    A class to transform inputs into the proper swerve outputs.
    • Constructor Detail

      • SwerveInputTransform

        public SwerveInputTransform​(double trackwidth,
                                    double wheelbase)
        Constructs a new swerve input transform for given robot dimensions.
        Parameters:
        trackwidth - the robot's trackwidth (unit-agnostic; units must match wheelbase).
        wheelbase - the robot's wheelbase (unit-agnostic; units must match trackwidth).
    • Method Detail

      • processNorthUp

        public WheelVector.VectorSet processNorthUp​(double rotation,
                                                    double x,
                                                    double y,
                                                    double imuAngle)
        Produces swerve velocity vectors relative to the field for the given input.

        See https://www.chiefdelphi.com/t/107383

        Parameters:
        rotation - the rotation of the joystick (CW is positive)
        x - the x coordinate of the joystick (right is positive)
        y - the y coordinate of the joystick (forward is positive)
        imuAngle - the current heading of the robot
        Returns:
        a WheelVector.VectorSet of velocity vectors.
      • processOwnShipUp

        public WheelVector.VectorSet processOwnShipUp​(double rotation,
                                                      double x,
                                                      double y)
        Produces swerve velocity vectors relative to the robot for the given inputs.
        Parameters:
        rotation - the rotation of the joystick (CW is positive)
        x - the x coordinate of the joystick (right is positive)
        y - the y coordinate of the joystick (forward is positive)
        Returns:
        a WheelVector.VectorSet of velocity vectors.
      • processTranslation

        public WheelVector.VectorSet processTranslation​(double x,
                                                        double y)
        Processes x-y input from the joystick to produce translational-only movement vectors.
        Parameters:
        x - the x-coordinate of the joystick's position (right-positive).
        y - the y-coordinate of the joystick's position (forward-positive).
        Returns:
        a WheelVector.VectorSet of translational movement vectors.
      • processRotation

        public WheelVector.VectorSet processRotation​(double rate)
        Processes rotational input from the joystick to produce rotational-only movement vectors.
        Parameters:
        rate - the rate of rotation, [-1, 1].
        Returns:
        a WheelVector.VectorSet of rotational movement vectors.