From 08473d42e1c28e1b9aaa5f52522fddc982bdad3a Mon Sep 17 00:00:00 2001 From: Austen Adler Date: Sat, 21 Mar 2015 08:16:39 -0400 Subject: [PATCH] Merge branch 'develop' --- Commands/Collector/RollIn.cpp | 2 +- Commands/Collector/RollOut.cpp | 4 ++-- Commands/Drivetrain/Drive.cpp | 2 +- OI.cpp | 18 ++++++++++++++---- 4 files changed, 18 insertions(+), 8 deletions(-) diff --git a/Commands/Collector/RollIn.cpp b/Commands/Collector/RollIn.cpp index 816aa81..2841a87 100644 --- a/Commands/Collector/RollIn.cpp +++ b/Commands/Collector/RollIn.cpp @@ -13,7 +13,7 @@ void RollIn::Execute(){ //}else{ // DentRobot::collector->MoveRollers(cvt*1.5); //} - DentRobot::collector->MoveRollers(DentRobot::oi->GetLeftThrottle() * 1.0); + DentRobot::collector->MoveRollers(DentRobot::oi->GetLeftAxis("left", "throttle") * 1.0); } bool RollIn::IsFinished(){ return IsTimedOut(); diff --git a/Commands/Collector/RollOut.cpp b/Commands/Collector/RollOut.cpp index 09864dd..51338a5 100644 --- a/Commands/Collector/RollOut.cpp +++ b/Commands/Collector/RollOut.cpp @@ -7,8 +7,8 @@ void RollOut::Initialize(){ } void RollOut::Execute(){ // Divide by 2 twice because this speed should be half the collector speed - DentRobot::collector->MoveRollers(-DentRobot::oi->GetLeftThrottle() * 0.8); - SmartDashboard::PutNumber("DriveThrottle", -DentRobot::oi->GetLeftThrottle()); + DentRobot::collector->MoveRollers(-DentRobot::oi->GetLeftAxis("right", "trigger") * 0.8); + SmartDashboard::PutNumber("DriveThrottle", -DentRobot::oi->GetLeftAxis("right", "trigger")); } bool RollOut::IsFinished(){ return IsTimedOut(); diff --git a/Commands/Drivetrain/Drive.cpp b/Commands/Drivetrain/Drive.cpp index 1dbd74d..8adf0c0 100644 --- a/Commands/Drivetrain/Drive.cpp +++ b/Commands/Drivetrain/Drive.cpp @@ -18,7 +18,7 @@ void Drive::Execute(){ // y=0; //} //X axis, Y axis, Z axis, sensitivity, speed threshold (usually throttle) - if(DentRobot::oi->GetLeftStick()->GetRawButton(11)){ + if(DentRobot::oi->GetLeftButton("y")){ x = -x; y = -y; } diff --git a/OI.cpp b/OI.cpp index 77162eb..37a6b5a 100644 --- a/OI.cpp +++ b/OI.cpp @@ -27,24 +27,34 @@ OI::OI(){ // Left, right stick press leftLPress = new JoystickButton(leftController, 9); leftRPress = new JoystickButton(leftController, 10); + + // Commands + Raise *raise = new Raise(2.0); + Lower *lower = new Lower(2.0); + leftA->WhileHeld(raise); + leftA->CancelWhenPressed(lower); + leftB->WhenPressed(lower); + leftB->CancelWhenPressed(raise); } float OI::GetLeftAxis(std::string stick, std::string axis){ if(stick=="left"){ if(axis=="x"){ - return leftController->GetX(); + return leftController->GetRawAxis(0); }else if(axis=="y"){ - return -leftController->GetY(); + return -leftController->GetRawAxis(1); }else if(axis=="trigger"){ //TODO: Figure out what axis this is + return leftController->GetRawAxis(4); return -4; } }else if(stick=="right"){ if(axis=="x"){ - return leftController->GetTwist(); + return leftController->GetRawAxis(2); }else if(axis=="y"){ - return -leftController->GetRawAxis(4); + return -leftController->GetRawAxis(3); }else if(axis=="trigger"){ //TODO: Figure out what axis this is + return leftController->GetRawAxis(5); return -4; } }