mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-21 01:01:43 +00:00
[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:
@@ -68,12 +68,12 @@ void SwerveControllerCommand<NumModules>::Execute() {
|
||||
|
||||
auto m_poseError = m_desiredPose.RelativeTo(m_pose());
|
||||
|
||||
auto targetXVel = units::meters_per_second_t(m_xController->Calculate(
|
||||
(m_pose().Translation().X().template to<double>()),
|
||||
(m_desiredPose.Translation().X().template to<double>())));
|
||||
auto targetYVel = units::meters_per_second_t(m_yController->Calculate(
|
||||
(m_pose().Translation().Y().template to<double>()),
|
||||
(m_desiredPose.Translation().Y().template to<double>())));
|
||||
auto targetXVel = units::meters_per_second_t(
|
||||
m_xController->Calculate((m_pose().X().template to<double>()),
|
||||
(m_desiredPose.X().template to<double>())));
|
||||
auto targetYVel = units::meters_per_second_t(
|
||||
m_yController->Calculate((m_pose().Y().template to<double>()),
|
||||
(m_desiredPose.Y().template 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
|
||||
|
||||
Reference in New Issue
Block a user