diff --git a/src/Subsystems/Elevator.cpp b/src/Subsystems/Elevator.cpp index 20d6a5b..cf37a88 100644 --- a/src/Subsystems/Elevator.cpp +++ b/src/Subsystems/Elevator.cpp @@ -1,7 +1,17 @@ #include "Elevator.h" #include "../RobotMap.h" - -Elevator::Elevator() : Subsystem("Elevator") { +Elevator::Elevator() : PIDSubsystem("Elevator", kP_real, kI_real, 0.0){ + pot=new AnalogPotentiometer(0); + leftMotor=new Talon(1); + rightMotor=new Talon(0); + SetAbsoluteTolerance(0.004); } void Elevator::InitDefaultCommand() { } +float Elevator::GetPotValue(){ + return pot->Get(); +} +void Elevator::Run(double power){ + leftMotor->Set(power); + rightMotor->Set(power); +} diff --git a/src/Subsystems/Elevator.h b/src/Subsystems/Elevator.h index 7c379e2..2ed8c01 100644 --- a/src/Subsystems/Elevator.h +++ b/src/Subsystems/Elevator.h @@ -2,11 +2,17 @@ #define ELEVATOR_H #include "WPILib.h" -class Elevator: public Subsystem +#include "Commands/PIDSubsystem.h" +class Elevator: public PIDSubsystem { private: + AnalogPotentiometer *pot; + Talon *leftMotor, *rightMotor; + static constexpr double kP_real=4, kI_real=.0f, kP_simulation=18, kI_simulation=.2; public: Elevator(); void InitDefaultCommand(); + float GetPotValue(); + void Run(double); }; #endif