[wpilib] Add X and Y component getters to Pose2d and Transform2d (#2563)

pose.Translation().X() and pose.Translation.Y() are common operations,
so shortening them to pose.X() and pose.Y() would be convenient.

Java uses the getX() convention so that is used instead of X() for Java.
This commit is contained in:
Tyler Veness
2020-07-02 18:09:36 -07:00
committed by GitHub
parent 5ccc98bc14
commit 2a0f79b90f
39 changed files with 228 additions and 192 deletions

View File

@@ -46,6 +46,20 @@ class Transform2d {
*/
const Translation2d& Translation() const { return m_translation; }
/**
* Returns the X component of the transformation's translation.
*
* @return The x component of the transformation's translation.
*/
units::meter_t X() const { return m_translation.X(); }
/**
* Returns the Y component of the transformation's translation.
*
* @return The y component of the transformation's translation.
*/
units::meter_t Y() const { return m_translation.Y(); }
/**
* Returns the rotational component of the transformation.
*