2015-01-16 19:29:55 -05:00
|
|
|
#include "Elevator.h"
|
|
|
|
#include "../RobotMap.h"
|
2015-02-07 13:08:24 -05:00
|
|
|
Elevator::Elevator(){
|
2015-02-02 19:56:27 -05:00
|
|
|
motor=new CANTalon(ELEVATOR_CAN);
|
2015-02-01 14:48:01 -05:00
|
|
|
elevatorEncoder=new Encoder(0,1,false);
|
|
|
|
offset=0;
|
2015-01-31 12:16:02 -05:00
|
|
|
height=0;
|
2015-02-07 13:03:00 -05:00
|
|
|
elevatorBottom=new DigitalInput(ELEVATOR_BOTTOM_DIO);
|
|
|
|
elevatorTop=new DigitalInput(ELEVATOR_TOP_DIO);
|
2015-01-17 12:21:16 -05:00
|
|
|
//SetAbsoluteTolerance(0.004);
|
2015-01-16 19:29:55 -05:00
|
|
|
}
|
2015-01-17 12:21:16 -05:00
|
|
|
void Elevator::InitDefaultCommand(){
|
2015-01-16 19:29:55 -05:00
|
|
|
}
|
2015-01-16 20:46:58 -05:00
|
|
|
void Elevator::Run(double power){
|
2015-02-02 18:53:02 -05:00
|
|
|
motor->Set(power);
|
2015-01-16 20:46:58 -05:00
|
|
|
}
|
2015-02-01 14:48:01 -05:00
|
|
|
void Elevator::SetOffset(double ht){
|
|
|
|
offset=ht;
|
|
|
|
}
|
|
|
|
void Elevator::ResetEncoder(){
|
|
|
|
elevatorEncoder->Reset();
|
2015-01-31 12:16:02 -05:00
|
|
|
}
|
|
|
|
double Elevator::GetHeight(){
|
2015-02-01 14:48:01 -05:00
|
|
|
return elevatorEncoder->Get()+offset;
|
2015-01-31 12:16:02 -05:00
|
|
|
}
|
2015-02-07 13:03:00 -05:00
|
|
|
bool Elevator::GetElevatorBottom(){
|
|
|
|
return elevatorBottom->Get();
|
|
|
|
}
|
|
|
|
bool Elevator::GetElevatorTop(){
|
|
|
|
return elevatorTop->Get();
|
|
|
|
}
|
2015-02-07 13:28:08 -05:00
|
|
|
// vim: ts2:sw=2:et
|