diff --git a/Commands/Collector/CloseCollector.cpp b/Commands/Collector/CloseCollector.cpp index 3a956f4..5dc5e07 100644 --- a/Commands/Collector/CloseCollector.cpp +++ b/Commands/Collector/CloseCollector.cpp @@ -6,12 +6,13 @@ void CloseCollector::Initialize(){ SetTimeout(0.5); } void CloseCollector::Execute(){ - DentRobot::collector->MoveArms(.1); + DentRobot::collector->MoveArms(0.1f); } bool CloseCollector::IsFinished(){ return DentRobot::collector->ArmSensor(); } void CloseCollector::End(){ + DentRobot::collector->MoveArms(0.0f); } void CloseCollector::Interrupted(){ End(); diff --git a/Commands/Collector/CollectTote.cpp b/Commands/Collector/CollectTote.cpp index c634fcb..1623d53 100644 --- a/Commands/Collector/CollectTote.cpp +++ b/Commands/Collector/CollectTote.cpp @@ -6,12 +6,13 @@ void CollectTote::Initialize(){ } void CollectTote::Execute(){ //TODO check this value to move the motors in the right direction - DentRobot::collector->MoveRollers(-1); + DentRobot::collector->MoveRollers(-1.0); } bool CollectTote::IsFinished(){ return DentRobot::collector->BoxCollected(); } void CollectTote::End(){ + DentRobot::collector->MoveRollers(0.0f); } void CollectTote::Interrupted(){ End(); diff --git a/Commands/Collector/OpenCollector.cpp b/Commands/Collector/OpenCollector.cpp index d3a6133..54928c5 100644 --- a/Commands/Collector/OpenCollector.cpp +++ b/Commands/Collector/OpenCollector.cpp @@ -6,12 +6,13 @@ void OpenCollector::Initialize(){ } void OpenCollector::Execute(){ //TODO check this value to move the motors in the right direction - DentRobot::collector->MoveArms(-.1); + DentRobot::collector->MoveArms(-0.1); } bool OpenCollector::IsFinished(){ return DentRobot::collector->ArmSensor(); } void OpenCollector::End(){ + DentRobot::collector->MoveArms(0.0f); } void OpenCollector::Interrupted(){ End(); diff --git a/Commands/Collector/ReleaseTote.cpp b/Commands/Collector/ReleaseTote.cpp index 67306ad..2f7d6ff 100644 --- a/Commands/Collector/ReleaseTote.cpp +++ b/Commands/Collector/ReleaseTote.cpp @@ -6,12 +6,13 @@ void ReleaseTote::Initialize(){ } void ReleaseTote::Execute(){ //TODO check this value to move the motors in the right direction - DentRobot::collector->MoveRollers(1); + DentRobot::collector->MoveRollers(1.0f); } bool ReleaseTote::IsFinished(){ return DentRobot::collector->BoxCollected(); } void ReleaseTote::End(){ + DentRobot::collector->MoveRollers(0.0f); } void ReleaseTote::Interrupted(){ End(); diff --git a/OI.cpp b/OI.cpp index c1e46c7..5910d71 100644 --- a/OI.cpp +++ b/OI.cpp @@ -5,6 +5,8 @@ #include "Commands/Collector/CloseCollector.h" #include "Commands/Collector/CollectTote.h" #include "Commands/Collector/ReleaseTote.h" +#include "Commands/Collector/StopCollector.h" +#include "Commands/Collector/StopArm.h" #include "Commands/Compressor/StartCompressing.h" #include "Commands/Compressor/StopCompressing.h" @@ -12,22 +14,22 @@ OI::OI() { leftStick=new Joystick(0); rightStick=new Joystick(1); //TODO name these buttons to their functions rather to their number - JoystickButton *right1=new JoystickButton(rightStick, 1); - JoystickButton *right2=new JoystickButton(rightStick, 2); - JoystickButton *right3=new JoystickButton(rightStick, 3); - JoystickButton *right4=new JoystickButton(rightStick, 4); - JoystickButton *right5=new JoystickButton(rightStick, 5); - JoystickButton *right6=new JoystickButton(rightStick, 6); - JoystickButton *right7=new JoystickButton(rightStick, 7); - JoystickButton *right8=new JoystickButton(rightStick, 8); - right1->WhenPressed(new OpenCollector()); - right2->WhenPressed(new CloseCollector()); - right3->WhenPressed(new CollectTote()); - right4->WhenPressed(new ReleaseTote()); - right5->WhenPressed(new StartCompressing()); - right6->WhenPressed(new StopCompressing()); - right7->WhenPressed(new Raise()); - right8->WhenPressed(new Lower()); + JoystickButton *left1=new JoystickButton(leftStick, 1); + JoystickButton *left2=new JoystickButton(leftStick, 2); + JoystickButton *left3=new JoystickButton(leftStick, 3); + JoystickButton *left4=new JoystickButton(leftStick, 4); + JoystickButton *left5=new JoystickButton(leftStick, 5); + JoystickButton *left6=new JoystickButton(leftStick, 6); + JoystickButton *left7=new JoystickButton(leftStick, 7); + JoystickButton *left8=new JoystickButton(leftStick, 8); + left1->WhileHeld(new OpenCollector()); + left2->WhileHeld(new CloseCollector()); + left3->WhileHeld(new CollectTote()); + left4->WhileHeld(new ReleaseTote()); + left5->WhileHeld(new StartCompressing()); + left6->WhileHeld(new StopCompressing()); + left7->WhileHeld(new Raise()); + left8->WhileHeld(new Lower()); } Joystick* OI::GetRightStick(){ return rightStick; diff --git a/Subsystems/AirCompressor.cpp b/Subsystems/AirCompressor.cpp index b813d9b..b63ff8b 100644 --- a/Subsystems/AirCompressor.cpp +++ b/Subsystems/AirCompressor.cpp @@ -7,10 +7,14 @@ AirCompressor::AirCompressor() : Subsystem("AirCompressor") { void AirCompressor::InitDefaultCommand() { } void AirCompressor::StartCompressing() { - printf("Starting compressor\n"); - compressor->Start(); + if(compressor->Enabled()){ + printf("Starting compressor\n"); + compressor->Start(); + } } void AirCompressor::StopCompressing() { - printf("Stopping compressor\n"); - compressor->Stop(); + if(compressor->Enabled()){ + printf("Stopping compressor\n"); + compressor->Stop(); + } }