FTCLib provides access to geometry classes taken from WPILib. Since we like copy-pasting straight from WPILib instead of linking to the original material, that's what we're gonna do.
Translation in 2 dimensions is represented by FTCLib's
Translation2dclass. This class has an x and y component, representing the point
or the vector
on a 2-dimensional coordinate system.
You can get the distance to another
Translation2dobject by using the
getDistance(Translation2d other), which returns the distance to another
Translation2dby using the Pythagorean theorem.
Rotation in 2 dimensions is represented by FTCLib’s
Rotation2dclass. This class has an angle component, which represents the robot’s rotation relative to an axis on a 2-dimensional coordinate system. Positive rotations are counterclockwise.
Pose is a combination of both translation and rotation and is represented by the
Pose2dclass. It can be used to describe the pose of your robot in the field coordinate system, or the pose of objects, such as vision targets, relative to your robot in the robot coordinate system.
Pose2dcan also represent the vector
A vector in 2 dimensions is represented by the
Vector2dclass. It holds an
value similarly to a
Translation2d. These components representing the point
or as the matrix
Translation2d, there are a few different methods and features.
FTCLib provides 2 classes,
Transform2d, which represents a transformation to a pose, and
Twist2dwhich represents a movement along an arc.
Transform2drepresents a relative transformation. It has an translation and a rotation component. Transforming a
Transform2drotates the translation component of the transform by the rotation of the pose, and then adds the rotated translation component and the rotation component to the pose. In other words,
Twist2drepresents a change in distance along an arc. For a given arc traveled,
is the distance traveled forward as measured from the robot's perspective throughout the movement (for a differential drive, this is the arc length),
is the distance traveled sideways from the robot's perspective (for a differential drive, this is 0), and
is the change in heading.
Both classes can be used to estimate robot location.
Twist2dis used in some of the FTCLib odometry classes to update the robot’s pose based on movement, while
Transform2dcan be used to estimate the robot’s global position from vision data.