Package edu.wpi.first.wpilibj.geometry
Class Transform2d
- java.lang.Object
-
- edu.wpi.first.wpilibj.geometry.Transform2d
-
public class Transform2d extends Object
Represents a transformation for a Pose2d.
-
-
Constructor Summary
Constructors Constructor Description Transform2d()Constructs the identity transform -- maps an initial pose to itself.Transform2d(Pose2d initial, Pose2d last)Constructs the transform that maps the initial pose to the final pose.Transform2d(Translation2d translation, Rotation2d rotation)Constructs a transform with the given translation and rotation components.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(Object obj)Checks equality between this Transform2d and another object.Rotation2dgetRotation()Returns the rotational component of the transformation.Translation2dgetTranslation()Returns the translation component of the transformation.inthashCode()Transform2dtimes(double scalar)Scales the transform by the scalar.StringtoString()
-
-
-
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.
-
getTranslation
public Translation2d getTranslation()
Returns the translation component of the transformation.- Returns:
- The translational component of the transform.
-
getRotation
public Rotation2d getRotation()
Returns the rotational component of the transformation.- Returns:
- Reference to the rotational component of the transform.
-
equals
public boolean equals(Object obj)
Checks equality between this Transform2d and another object.
-
-