10 #include <frc/controller/PIDController.h> 11 #include <frc/controller/ProfiledPIDController.h> 12 #include <frc/geometry/Rotation2d.h> 13 #include <frc/kinematics/SwerveModuleState.h> 14 #include <frc/trajectory/TrapezoidProfile.h> 15 #include <frc/SmartDashboard/SmartDashboard.h> 16 #include <frc/Timer.h> 17 #include <networktables/NetworkTableEntry.h> 20 #pragma GCC diagnostic push 21 #pragma GCC diagnostic ignored "-Wattributes" 23 #include <rev\CANSparkMax.h> 25 #pragma GCC diagnostic pop 27 #include <ctre/phoenix/motorcontrol/can/TalonFX.h> 28 #include <ctre/phoenix/motorcontrol/StatorCurrentLimitConfiguration.h> 44 using namespace units;
57 ,
int turningMotorChannel
59 , CANifier::PWMChannel pwmChannel
60 ,
bool driveEncoderReversed
62 ,
const string& name);
69 SwerveModuleState GetState();
73 void SetDesiredState(SwerveModuleState &state);
77 void ResetRelativeToAbsolute();
81 double CalcAbsoluteAngle();
86 double MinTurnRads(
double init,
double final,
bool& bOutputReverse);
89 meters_per_second_t CalcMetersPerSec();
93 double CalcTicksPer100Ms(meters_per_second_t speed);
105 CANEncoder m_turnRelativeEncoder = m_turningMotor.GetAlternateEncoder(CANEncoder::AlternateEncoderType::kQuadrature,
107 CANPIDController m_turnPIDController = m_turningMotor.GetPIDController();
PIDLoaderFalcon m_drivePIDLoader
PID param loader for the TalonFX.
Timer m_timer
Timer used to sync absolute and relative encoders on robot turn on.
string m_name
String used to identify each pod, used for SmartDashboard prints.
GetPulseWidthCallback m_pulseWidthCallback
constexpr double kTurnEncoderCPR
CANifier::PWMChannel m_pwmChannel
PIDLoaderNEO m_turnPIDLoader
PID param loader for the CANSparkMax.
CANSparkMax m_turningMotor
function< double(CANifier::PWMChannel)> GetPulseWidthCallback
double m_offset
The offset, in pulse widths, for syncing the relative encoder to the absolute encoder.
compound_unit< radians, inverse< squared< second >>> radians_per_second_squared_t
TalonFX m_driveMotor
Falon 500 that drives the pod.