mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-23 01:21:42 +00:00
[wpimath] Position Delta Odometry for Mecanum (#4514)
This commit is contained in:
@@ -49,6 +49,18 @@ ChassisSpeeds MecanumDriveKinematics::ToChassisSpeeds(
|
||||
units::radians_per_second_t{chassisSpeedsVector(2)}};
|
||||
}
|
||||
|
||||
Twist2d MecanumDriveKinematics::ToTwist2d(
|
||||
const MecanumDriveWheelPositions& wheelDeltas) const {
|
||||
Vectord<4> wheelDeltasVector{
|
||||
wheelDeltas.frontLeft.value(), wheelDeltas.frontRight.value(),
|
||||
wheelDeltas.rearLeft.value(), wheelDeltas.rearRight.value()};
|
||||
|
||||
Eigen::Vector3d twistVector = m_forwardKinematics.solve(wheelDeltasVector);
|
||||
|
||||
return {units::meter_t{twistVector(0)}, // NOLINT
|
||||
units::meter_t{twistVector(1)}, units::radian_t{twistVector(2)}};
|
||||
}
|
||||
|
||||
void MecanumDriveKinematics::SetInverseKinematics(Translation2d fl,
|
||||
Translation2d fr,
|
||||
Translation2d rl,
|
||||
|
||||
Reference in New Issue
Block a user