73 SwerveDrive(std::array<SwerveModule, NumModules> modules,
74 std::shared_ptr<const rmb::Gyro> gyro,
75 frc::HolonomicDriveController holonomicController,
76 std::string visionTable,
77 units::meters_per_second_t maxModuleSpeed,
78 const frc::Pose2d &initialPose = frc::Pose2d());
91 SwerveDrive(std::array<SwerveModule, NumModules> modules,
92 std::shared_ptr<const rmb::Gyro> gyro,
93 frc::HolonomicDriveController holonomicController,
94 units::meters_per_second_t maxModuleSpeed,
95 const frc::Pose2d &initialPose = frc::Pose2d());
99 void driveCartesian(
double xSpeed,
double ySpeed,
double zRotation,
102 void drivePolar(
double speed,
const frc::Rotation2d &angle,
double zRotation,
105 void driveModulePowers(std::array<SwerveModulePower, NumModules> powers);
107 void driveModuleStates(std::array<frc::SwerveModuleState, NumModules> states);
109 std::array<frc::SwerveModuleState, NumModules> getModuleStates()
const;
111 std::array<frc::SwerveModulePosition, NumModules> getModulePositions()
const;
113 const std::array<rmb::SwerveModule, NumModules> &getModules()
const {
136 frc::Pose2d
getPose()
const override;
138 std::array<frc::SwerveModuleState, NumModules> getTargetModuleStates()
const;
156 void resetPose(
const frc::Pose2d &pose = frc::Pose2d())
override;
176 units::second_t time)
override;
210 frc::Trajectory trajectory,
211 std::initializer_list<frc2::Subsystem *> driveRequirements)
override;
223 std::shared_ptr<pathplanner::PathPlannerPath> path,
224 std::initializer_list<frc2::Subsystem *> driveRequirements)
override;
226 frc2::CommandPtr FollowGeneratedPPPath(
227 frc::Pose2d targetPose, pathplanner::PathConstraints constraints,
228 std::initializer_list<frc2::Subsystem *> driveRequirements);
230 void updateNTDebugInfo(
bool openLoopVelocity =
false);
235 void recomputeOpenloopInverseKinematicsMatrix();
246 nt::DoubleArrayPublisher ntPositionTopics;
247 nt::DoubleArrayPublisher ntVelocityTopics;
249 nt::DoubleArrayPublisher ntPositionErrorTopics;
250 nt::DoubleArrayPublisher ntVelocityErrorTopics;
252 nt::DoubleArrayPublisher ntTargetPositionTopics;
253 nt::DoubleArrayPublisher ntTargetVelocityTopics;
262 std::array<SwerveModule, NumModules> modules;
267 std::shared_ptr<const rmb::Gyro> gyro;
272 frc::SwerveDriveKinematics<NumModules> kinematics;
278 Eigen::Matrix<float, 2 * NumModules, 3> openLoopInverseKinematics;
283 frc::HolonomicDriveController holonomicController;
292 frc::SwerveDrivePoseEstimator<NumModules> poseEstimator;
297 mutable std::mutex visionThreadMutex;
299 units::meters_per_second_t maxModuleSpeed;
301 units::meter_t largestModuleDistance = 1.0_m;