16 static constexpr int NUM_WHEELS = 4;
18 Mecanum(wpi::array<std::pair<std::unique_ptr<BaseController>, frc::Translation2d>, NUM_WHEELS> wheels, std::unique_ptr<gyro::Gyro> gyro,
19 units::meter_t wheelDiameter);
29 frc::MecanumDriveWheelPositions GetWheelPositions()
const;
30 frc::MecanumDriveWheelSpeeds GetWheelSpeeds()
const;
35 void ResetOdometry(frc::Pose2d pose);
37 void StartOdomThread(units::hertz_t freq) { odomThread.StartPeriodic(1 / freq); }
41 std::unique_ptr<BaseController> frontLeft;
42 std::unique_ptr<BaseController> frontRight;
43 std::unique_ptr<BaseController> rearLeft;
44 std::unique_ptr<BaseController> rearRight;
47 virtual void UpdateOdometry();
49 std::unique_ptr<gyro::Gyro> gyro;
53 frc::MecanumDriveKinematics GenerateKinematics(
54 wpi::array<std::pair<std::unique_ptr<BaseController>, frc::Translation2d>, NUM_WHEELS> wheels);
56 decltype(1_m / 1_tr) wheelConversion;
57 frc::MecanumDriveKinematics kinematics;
58 frc::Notifier odomThread{[
this] { UpdateOdometry(); }};
63 util::Locked<frc::MecanumDrivePoseEstimator> estimator{kinematics, gyro->GetRotation().ToRotation2d(), GetWheelPositions(),