mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-20 00:51:42 +00:00
[examples] Replace gyro rotation with poseEstimator rotation (#5900)
This commit is contained in:
@@ -50,7 +50,8 @@ void Drivetrain::Drive(units::meters_per_second_t xSpeed,
|
||||
units::second_t period) {
|
||||
auto wheelSpeeds = m_kinematics.ToWheelSpeeds(frc::ChassisSpeeds::Discretize(
|
||||
fieldRelative ? frc::ChassisSpeeds::FromFieldRelativeSpeeds(
|
||||
xSpeed, ySpeed, rot, m_gyro.GetRotation2d())
|
||||
xSpeed, ySpeed, rot,
|
||||
m_poseEstimator.GetEstimatedPosition().Rotation())
|
||||
: frc::ChassisSpeeds{xSpeed, ySpeed, rot},
|
||||
period));
|
||||
wheelSpeeds.Desaturate(kMaxSpeed);
|
||||
|
||||
@@ -15,7 +15,8 @@ void Drivetrain::Drive(units::meters_per_second_t xSpeed,
|
||||
auto states =
|
||||
m_kinematics.ToSwerveModuleStates(frc::ChassisSpeeds::Discretize(
|
||||
fieldRelative ? frc::ChassisSpeeds::FromFieldRelativeSpeeds(
|
||||
xSpeed, ySpeed, rot, m_gyro.GetRotation2d())
|
||||
xSpeed, ySpeed, rot,
|
||||
m_poseEstimator.GetEstimatedPosition().Rotation())
|
||||
: frc::ChassisSpeeds{xSpeed, ySpeed, rot},
|
||||
period));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user