2
0
mirror of https://github.com/team2059/Dent synced 2024-12-18 20:52:29 -05:00

Added two second timeout to the elevator

This commit is contained in:
Adam Long 2015-02-07 12:23:10 +00:00
parent f682b272a6
commit 3b63c6ff1e
4 changed files with 15 additions and 5 deletions

View File

@ -1,14 +1,20 @@
#include "Lower.h"
#include "../../DentRobot.h"
#include "../../OI.h"
Lower::Lower() : Command("Lower"){
}
void Lower::Initialize(){
SetTimeout(2.0);
}
void Lower::Execute(){
DentRobot::elevator->Run((-DentRobot::oi->GetLeftStick()->GetRawAxis(3)+1.0)/2);
}
bool Lower::IsFinished(){
return !DentRobot::dio->Get(DentRobot::dio->ELEVATORBOTTOM);
if (!DentRobot::dio->Get(DentRobot::dio->ELEVATORBOTTOM) || IsTimedOut()){
return true;
}else{
return false;
}
}
void Lower::End(){
DentRobot::elevator->Run(0.0f);

View File

@ -1,15 +1,20 @@
#include "Raise.h"
#include "../../DentRobot.h"
#include "../../OI.h"
Raise::Raise(){
Raise::Raise() : Command("Raise"){
}
void Raise::Initialize(){
SetTimeout(2.0);
}
void Raise::Execute(){
DentRobot::elevator->Run(-(-DentRobot::oi->GetLeftStick()->GetRawAxis(3)+1.0)/2);
}
bool Raise::IsFinished(){
return !DentRobot::dio->Get(DentRobot::dio->ELEVATORTOP);
if (!DentRobot::dio->Get(DentRobot::dio->ELEVATORBOTTOM) || IsTimedOut()){
return true;
}else{
return false;
}
}
void Raise::End(){
DentRobot::elevator->Run(0.0f);

View File

@ -15,6 +15,7 @@ DentRobot::DentRobot(){
printf("Initialized");
}
void DentRobot::RobotInit(){
SmartDashboard::PutNumber("CodeVersion",0.001);
}
void DentRobot::DisabledPeriodic(){
Scheduler::GetInstance()->Run();

View File

@ -9,11 +9,9 @@ void DIO::InitDefaultCommand(){
bool DIO::Get(e_dioSig dioSig){
switch (dioSig){
case ELEVATORTOP:
printf("Hit top limit switch\n");
return elevatorTop->Get();
break;
case ELEVATORBOTTOM:
printf("Hit top bottom switch\n");
return elevatorBottom->Get();
break;
default: