mirror of
https://github.com/team2059/Dent
synced 2024-12-18 20:52:29 -05:00
Updated binElevator
This commit is contained in:
parent
0831c1084b
commit
e26b7e825c
@ -3,25 +3,19 @@
|
|||||||
BinElevator::BinElevator(){
|
BinElevator::BinElevator(){
|
||||||
motor=new CANTalon(BINELEVATOR_CAN);
|
motor=new CANTalon(BINELEVATOR_CAN);
|
||||||
elevatorEncoder=new Encoder(BINELEVATOR_ENCODERA,BINELEVATOR_ENCODERB,false);
|
elevatorEncoder=new Encoder(BINELEVATOR_ENCODERA,BINELEVATOR_ENCODERB,false);
|
||||||
offset=0;
|
|
||||||
height=0;
|
|
||||||
elevatorBottom=new DigitalInput(BINELEVATOR_BOTTOM_DIO);
|
elevatorBottom=new DigitalInput(BINELEVATOR_BOTTOM_DIO);
|
||||||
elevatorTop=new DigitalInput(BINELEVATOR_TOP_DIO);
|
elevatorTop=new DigitalInput(BINELEVATOR_TOP_DIO);
|
||||||
//SetAbsoluteTolerance(0.004);
|
|
||||||
}
|
}
|
||||||
void BinElevator::InitDefaultCommand(){
|
void BinElevator::InitDefaultCommand(){
|
||||||
}
|
}
|
||||||
void BinElevator::Run(double power){
|
void BinElevator::Run(double power){
|
||||||
motor->Set(power);
|
motor->Set(power);
|
||||||
}
|
}
|
||||||
void BinElevator::SetOffset(double ht){
|
|
||||||
offset=ht;
|
|
||||||
}
|
|
||||||
void BinElevator::ResetEncoder(){
|
void BinElevator::ResetEncoder(){
|
||||||
elevatorEncoder->Reset();
|
elevatorEncoder->Reset();
|
||||||
}
|
}
|
||||||
double BinElevator::GetHeight(){
|
double BinElevator::GetHeight(){
|
||||||
return elevatorEncoder->Get()+offset;
|
return elevatorEncoder->Get();
|
||||||
}
|
}
|
||||||
bool BinElevator::GetElevatorBottom(){
|
bool BinElevator::GetElevatorBottom(){
|
||||||
return elevatorBottom->Get();
|
return elevatorBottom->Get();
|
||||||
|
@ -8,13 +8,11 @@ class BinElevator{
|
|||||||
CANTalon *motor;
|
CANTalon *motor;
|
||||||
Encoder *elevatorEncoder;
|
Encoder *elevatorEncoder;
|
||||||
static constexpr double kP_real=4, kI_real=.0f, kP_simulation=18, kI_simulation=.2;
|
static constexpr double kP_real=4, kI_real=.0f, kP_simulation=18, kI_simulation=.2;
|
||||||
double offset, height;
|
|
||||||
DigitalInput *elevatorBottom, *elevatorTop;
|
DigitalInput *elevatorBottom, *elevatorTop;
|
||||||
public:
|
public:
|
||||||
BinElevator();
|
BinElevator();
|
||||||
void InitDefaultCommand();
|
void InitDefaultCommand();
|
||||||
void Run(double);
|
void Run(double);
|
||||||
void SetOffset(double);
|
|
||||||
void ResetEncoder();
|
void ResetEncoder();
|
||||||
double GetHeight();
|
double GetHeight();
|
||||||
bool GetElevatorTop();
|
bool GetElevatorTop();
|
||||||
|
Loading…
Reference in New Issue
Block a user