Class Transform2d

    • Constructor Detail

      • Transform2d

        public Transform2d​(Pose2d initial,
                           Pose2d last)
        Constructs the transform that maps the initial pose to the final pose.
        Parameters:
        initial - The initial pose for the transformation.
        last - The final pose for the transformation.
      • Transform2d

        public Transform2d​(Translation2d translation,
                           Rotation2d rotation)
        Constructs a transform with the given translation and rotation components.
        Parameters:
        translation - Translational component of the transform.
        rotation - Rotational component of the transform.
      • Transform2d

        public Transform2d()
        Constructs the identity transform -- maps an initial pose to itself.
    • Method Detail

      • times

        public Transform2d times​(double scalar)
        Scales the transform by the scalar.
        Parameters:
        scalar - The scalar.
        Returns:
        The scaled Transform2d.
      • plus

        public Transform2d plus​(Transform2d other)
        Composes two transformations.
        Parameters:
        other - The transform to compose with this one.
        Returns:
        The composition of the two transformations.
      • getTranslation

        public Translation2d getTranslation()
        Returns the translation component of the transformation.
        Returns:
        The translational component of the transform.
      • getX

        public double getX()
        Returns the X component of the transformation's translation.
        Returns:
        The x component of the transformation's translation.
      • getY

        public double getY()
        Returns the Y component of the transformation's translation.
        Returns:
        The y component of the transformation's translation.
      • getRotation

        public Rotation2d getRotation()
        Returns the rotational component of the transformation.
        Returns:
        Reference to the rotational component of the transform.
      • inverse

        public Transform2d inverse()
        Invert the transformation. This is useful for undoing a transformation.
        Returns:
        The inverted transformation.
      • equals

        public boolean equals​(Object obj)
        Checks equality between this Transform2d and another object.
        Overrides:
        equals in class Object
        Parameters:
        obj - The other object.
        Returns:
        Whether the two objects are equal or not.