mirror of
https://github.com/team2059/Dent
synced 2025-01-07 22:14:14 -05:00
Added elevator code
This commit is contained in:
parent
214318b5fb
commit
3dd19f8a53
@ -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);
|
||||
}
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user