From 760a30a8a264319a2ed8b136f22baa7c2e2f0d66 Mon Sep 17 00:00:00 2001 From: Austen Adler Date: Sat, 31 Jan 2015 14:30:09 -0500 Subject: [PATCH] Continued development of elevator (not working) --- Commands/Calibrate.cpp | 9 ++++++++- Subsystems/Elevator.cpp | 2 ++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/Commands/Calibrate.cpp b/Commands/Calibrate.cpp index b0d1bdc..250ebab 100644 --- a/Commands/Calibrate.cpp +++ b/Commands/Calibrate.cpp @@ -1,14 +1,21 @@ #include "Calibrate.h" #include "../DentRobot.h" +// Lowers elevator until it hits the limit switch then sets the height of the elevator to the height of the limit switches Calibrate::Calibrate() : Command("Calibrate"){ } void Calibrate::Initialize(){ } void Calibrate::Execute(){ + // Lower collector until End() DentRobot::elevator->Run(-0.4f); } bool Calibrate::IsFinished(){ - return DentRobot::elevator->GetPotValue()>=0.1f; + if(DentRobot::DIO->Get()){ + // 0.99 is a placeholder for the height of the limit switches + DentRobot::elevator->SetHeight(0.99); + return true; + } + return false; } void Calibrate::End(){ DentRobot::elevator->Run(0.0f); diff --git a/Subsystems/Elevator.cpp b/Subsystems/Elevator.cpp index b2e28b7..76188c8 100644 --- a/Subsystems/Elevator.cpp +++ b/Subsystems/Elevator.cpp @@ -13,6 +13,8 @@ float Elevator::GetPotValue(){ return pot->Get(); } void Elevator::Run(double power){ + // Height supposed to be the location of the elevator + //height+=power; leftMotor->Set(power); rightMotor->Set(power); }