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 "Lower.h"
#include "../../DentRobot.h" #include "../../DentRobot.h"
#include "../../OI.h"
Lower::Lower() : Command("Lower"){ Lower::Lower() : Command("Lower"){
} }
void Lower::Initialize(){ void Lower::Initialize(){
SetTimeout(2.0);
} }
void Lower::Execute(){ void Lower::Execute(){
DentRobot::elevator->Run((-DentRobot::oi->GetLeftStick()->GetRawAxis(3)+1.0)/2); DentRobot::elevator->Run((-DentRobot::oi->GetLeftStick()->GetRawAxis(3)+1.0)/2);
} }
bool Lower::IsFinished(){ 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(){ void Lower::End(){
DentRobot::elevator->Run(0.0f); DentRobot::elevator->Run(0.0f);

View File

@ -1,15 +1,20 @@
#include "Raise.h" #include "Raise.h"
#include "../../DentRobot.h" #include "../../DentRobot.h"
#include "../../OI.h" #include "../../OI.h"
Raise::Raise(){ Raise::Raise() : Command("Raise"){
} }
void Raise::Initialize(){ void Raise::Initialize(){
SetTimeout(2.0);
} }
void Raise::Execute(){ void Raise::Execute(){
DentRobot::elevator->Run(-(-DentRobot::oi->GetLeftStick()->GetRawAxis(3)+1.0)/2); DentRobot::elevator->Run(-(-DentRobot::oi->GetLeftStick()->GetRawAxis(3)+1.0)/2);
} }
bool Raise::IsFinished(){ 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(){ void Raise::End(){
DentRobot::elevator->Run(0.0f); DentRobot::elevator->Run(0.0f);

View File

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

View File

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