pid settings

main
Zynh0722 2024-03-27 17:46:46 -07:00
parent 09310a745f
commit a91c1a4932
2 changed files with 11 additions and 3 deletions

View File

@ -4,14 +4,21 @@
#include "Constants.h"
#include "rev/CANSparkMax.h"
#include "units/base.h"
#include "cowlib/SwerveModule.h"
using namespace SwerveConstants;
using namespace units::constants;
using MotorType = rev::CANSparkMax::MotorType;
SwerveModule::SwerveModule(int driveMotorId, int steerMotorId, int encoderId)
SwerveModule::SwerveModule(int driveMotorId, int steerMotorId, int encoderId,
bool driveInverted)
: driveMotor{driveMotorId, rev::CANSparkMax::MotorType::kBrushless},
steerMotor{steerMotorId, rev::CANSparkMax::MotorType::kBrushless},
encoder{encoderId}, pid{SwervePID::p, SwervePID::i, SwervePID::d} {}
encoder{encoderId}, pid{SwervePID::p, SwervePID::i, SwervePID::d} {
this->pid.EnableContinuousInput(-180, 180);
this->driveMotor.SetInverted(driveInverted);
}

View File

@ -16,5 +16,6 @@ private:
frc::PIDController pid;
public:
SwerveModule(int driveMotorId, int steerMotorId, int encoderId);
SwerveModule(int driveMotorId, int steerMotorId, int encoderId,
bool driveInverted);
};