mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-20 00:51:42 +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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user