[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

@@ -169,12 +169,10 @@ void MecanumControllerCommand::Execute() {
auto m_poseError = m_desiredPose.RelativeTo(m_pose());
auto targetXVel = meters_per_second_t(
m_xController->Calculate((m_pose().Translation().X().to<double>()),
(m_desiredPose.Translation().X().to<double>())));
auto targetYVel = meters_per_second_t(
m_yController->Calculate((m_pose().Translation().Y().to<double>()),
(m_desiredPose.Translation().Y().to<double>())));
auto targetXVel = meters_per_second_t(m_xController->Calculate(
(m_pose().X().to<double>()), (m_desiredPose.X().to<double>())));
auto targetYVel = meters_per_second_t(m_yController->Calculate(
(m_pose().Y().to<double>()), (m_desiredPose.Y().to<double>())));
// Profiled PID Controller only takes meters as setpoint and measurement
// The robot will go to the desired rotation of the final pose in the