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

Updated Elevator to run until hall effect is triggered

This commit is contained in:
Adam Long 2015-02-07 11:53:41 +00:00
parent 4c9ce0b57b
commit f682b272a6
5 changed files with 7 additions and 4 deletions

View File

@ -8,7 +8,7 @@ void Lower::Execute(){
DentRobot::elevator->Run((-DentRobot::oi->GetLeftStick()->GetRawAxis(3)+1.0)/2);
}
bool Lower::IsFinished(){
return false;
return !DentRobot::dio->Get(DentRobot::dio->ELEVATORBOTTOM);
}
void Lower::End(){
DentRobot::elevator->Run(0.0f);

View File

@ -9,7 +9,7 @@ void Raise::Execute(){
DentRobot::elevator->Run(-(-DentRobot::oi->GetLeftStick()->GetRawAxis(3)+1.0)/2);
}
bool Raise::IsFinished(){
return false;
return !DentRobot::dio->Get(DentRobot::dio->ELEVATORTOP);
}
void Raise::End(){
DentRobot::elevator->Run(0.0f);

4
OI.cpp
View File

@ -21,8 +21,8 @@ OI::OI() {
left2->WhileHeld(new CloseCollector());
left3->WhileHeld(new CollectTote());
left4->WhileHeld(new ReleaseTote());
left5->WhileHeld(new Raise());
left6->WhileHeld(new Lower());
left5->WhenPressed(new Raise());
left6->WhenPressed(new Lower());
}
Joystick* OI::GetRightStick(){
return rightStick;

View File

@ -9,9 +9,11 @@ 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:

View File

@ -10,6 +10,7 @@ Elevator::Elevator()/* : PIDSubsystem("Elevator", kP_real, kI_real, 0.0)*/{
void Elevator::InitDefaultCommand(){
}
void Elevator::Run(double power){
printf("Elevator Power: %f\n",power);
motor->Set(power);
}
void Elevator::SetOffset(double ht){