diff --git a/Commands/Elevator/Lower.cpp b/Commands/Elevator/Lower.cpp index e33f3b2..d853678 100644 --- a/Commands/Elevator/Lower.cpp +++ b/Commands/Elevator/Lower.cpp @@ -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); diff --git a/Commands/Elevator/Raise.cpp b/Commands/Elevator/Raise.cpp index ce1248f..8d556c5 100644 --- a/Commands/Elevator/Raise.cpp +++ b/Commands/Elevator/Raise.cpp @@ -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); diff --git a/OI.cpp b/OI.cpp index 4fc58f9..47a0a66 100644 --- a/OI.cpp +++ b/OI.cpp @@ -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; diff --git a/Subsystems/DIO.cpp b/Subsystems/DIO.cpp index 470bf3a..b845c3a 100644 --- a/Subsystems/DIO.cpp +++ b/Subsystems/DIO.cpp @@ -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: diff --git a/Subsystems/Elevator.cpp b/Subsystems/Elevator.cpp index d32943b..2df51dc 100644 --- a/Subsystems/Elevator.cpp +++ b/Subsystems/Elevator.cpp @@ -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){