2015-02-10 20:12:41 -05:00
|
|
|
#include "BinElevator.h"
|
|
|
|
#include "../RobotMap.h"
|
|
|
|
BinElevator::BinElevator(){
|
2015-02-11 18:34:38 -05:00
|
|
|
motor=new CANTalon(BINELEVATOR_CAN);
|
2015-02-11 19:22:59 -05:00
|
|
|
elevatorEncoder=new Encoder(BINELEVATOR_ENCODERA,BINELEVATOR_ENCODERB,false);
|
2015-02-10 20:12:41 -05:00
|
|
|
offset=0;
|
|
|
|
height=0;
|
2015-02-11 18:34:38 -05:00
|
|
|
elevatorBottom=new DigitalInput(BINELEVATOR_BOTTOM_DIO);
|
|
|
|
elevatorTop=new DigitalInput(BINELEVATOR_TOP_DIO);
|
2015-02-10 20:12:41 -05:00
|
|
|
//SetAbsoluteTolerance(0.004);
|
|
|
|
}
|
|
|
|
void BinElevator::InitDefaultCommand(){
|
|
|
|
}
|
|
|
|
void BinElevator::Run(double power){
|
|
|
|
motor->Set(power);
|
|
|
|
}
|
|
|
|
void BinElevator::SetOffset(double ht){
|
|
|
|
offset=ht;
|
|
|
|
}
|
|
|
|
void BinElevator::ResetEncoder(){
|
|
|
|
elevatorEncoder->Reset();
|
|
|
|
}
|
|
|
|
double BinElevator::GetHeight(){
|
|
|
|
return elevatorEncoder->Get()+offset;
|
|
|
|
}
|
|
|
|
bool BinElevator::GetElevatorBottom(){
|
|
|
|
return elevatorBottom->Get();
|
|
|
|
}
|
|
|
|
bool BinElevator::GetElevatorTop(){
|
|
|
|
return elevatorTop->Get();
|
|
|
|
}
|
|
|
|
// vim: ts=2:sw=2:et
|