2015-01-31 12:16:02 -05:00
|
|
|
#include "Calibrate.h"
|
2015-02-03 15:55:11 -05:00
|
|
|
#include "../../DentRobot.h"
|
2015-01-31 14:30:09 -05:00
|
|
|
// Lowers elevator until it hits the limit switch then sets the height of the elevator to the height of the limit switches
|
2015-01-31 12:16:02 -05:00
|
|
|
Calibrate::Calibrate() : Command("Calibrate"){
|
|
|
|
}
|
|
|
|
void Calibrate::Initialize(){
|
|
|
|
}
|
|
|
|
void Calibrate::Execute(){
|
2015-01-31 14:30:09 -05:00
|
|
|
// Lower collector until End()
|
2015-01-31 12:16:02 -05:00
|
|
|
DentRobot::elevator->Run(-0.4f);
|
|
|
|
}
|
|
|
|
bool Calibrate::IsFinished(){
|
2015-02-07 13:03:00 -05:00
|
|
|
if(DentRobot::elevator->GetElevatorBottom()){
|
2015-02-01 14:48:01 -05:00
|
|
|
DentRobot::elevator->ResetEncoder();
|
|
|
|
DentRobot::elevator->SetOffset(0.99);
|
2015-01-31 14:30:09 -05:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
2015-01-31 12:16:02 -05:00
|
|
|
}
|
|
|
|
void Calibrate::End(){
|
|
|
|
DentRobot::elevator->Run(0.0f);
|
|
|
|
}
|
|
|
|
void Calibrate::Interrupted(){
|
|
|
|
End();
|
|
|
|
}
|