17 static constexpr int NUM_WHEELS = 4;
19 Mecanum(wpi::array<std::pair<std::unique_ptr<BaseController>, frc::Translation2d>, NUM_WHEELS> wheels, std::unique_ptr<gyro::Gyro> gyro,
20 units::meter_t wheelDiameter);
30 frc::MecanumDriveWheelPositions GetWheelPositions()
const;
31 frc::MecanumDriveWheelSpeeds GetWheelSpeeds()
const;
36 void ResetOdometry(frc::Pose2d pose);
40 std::unique_ptr<BaseController> frontLeft;
41 std::unique_ptr<BaseController> frontRight;
42 std::unique_ptr<BaseController> rearLeft;
43 std::unique_ptr<BaseController> rearRight;
46 void StartOdomThread(units::hertz_t freq) { odomThread.StartPeriodic(1 / freq); }
48 virtual void UpdateOdometry();
50 std::unique_ptr<gyro::Gyro> gyro;
54 frc::MecanumDriveKinematics GenerateKinematics(
55 wpi::array<std::pair<std::unique_ptr<BaseController>, frc::Translation2d>, NUM_WHEELS> wheels);
57 decltype(1_m / 1_tr) wheelConversion;
58 frc::MecanumDriveKinematics kinematics;
59 frc::Notifier odomThread{[
this] { UpdateOdometry(); }};
60 util::Locked<frc::MecanumDrivePoseEstimator> rawEstimator{kinematics, gyro->GetRotation().ToRotation2d(), GetWheelPositions(),
64 util::Locked<frc::MecanumDrivePoseEstimator> estimator{kinematics, gyro->GetRotation().ToRotation2d(), GetWheelPositions(),