From b28fb4d93ece0222fa40ad8f4788d08c924fc59c Mon Sep 17 00:00:00 2001 From: Austen Adler Date: Fri, 22 Aug 2014 13:13:08 -0600 Subject: [PATCH] Trying to get this to work on robot... Not working right now --- src/HHRobot.cpp | 10 ++++------ src/HHRobot.h | 5 ----- src/Subsystems/Compressor.cpp | 7 ++++++- src/Subsystems/Shooter.cpp | 3 +-- 4 files changed, 11 insertions(+), 14 deletions(-) diff --git a/src/HHRobot.cpp b/src/HHRobot.cpp index 12c41ec..1b54013 100644 --- a/src/HHRobot.cpp +++ b/src/HHRobot.cpp @@ -5,8 +5,7 @@ HHRobot::HHRobot(): shooter(new HHShooter()), collector(new HHCollector()), compressorSystem(new HHCompressor()), - dashboard(new HHDashboard()), - sonar(new HHSonar()){ + dashboard(new HHDashboard()){ } bool HHRobot::CheckJoystickValues(){ float x=ControlSystem->rightJoystickAxisValues[1]; @@ -14,16 +13,15 @@ bool HHRobot::CheckJoystickValues(){ if((-.1 < x && x < .1) && (-.1 < y && y < .1)) { dashboard->PutBoolValue("Joysticks Valid", true); return true; - } else { + }else{ dashboard->PutBoolValue("Joysticks Valid", false); - return true; return false; } } void HHRobot::DriveRobot(float x, float y){ - if(y>1.0f) { + if(y>1.0f){ y=1.0f; - } else if(y!=0.0f&&y<-1.0f) { + }else if(y!=0.0f&&y<-1.0f){ y=-1.0f; } float leftPower=((y+x)/2+1)*127+1; diff --git a/src/HHRobot.h b/src/HHRobot.h index 27368dc..9f34261 100644 --- a/src/HHRobot.h +++ b/src/HHRobot.h @@ -8,22 +8,17 @@ class HHShooter; class HHCollector; class HHCompressor; class HHDashboard; -class HHSonar; class HHRobot; class HHRobot{ private: Jaguar *right1, *right2, *right3, *left1, *left2, *left3; - DigitalOutput *frontSonarLeftD, *frontSonarRightD, *rearSonarLeftD, *rearSonarRightD; - AnalogChannel *frontSonarLeftA, *frontSonarRightA, *rearSonarLeftA, *rearSonarRightA; JoystickController *ControlSystem; HHShooter *shooter; HHCollector *collector; HHCompressor *compressorSystem; HHDashboard *dashboard; - HHSonar *sonar; public: HHRobot(); - float frontSonarLeftV, frontSonarRightV, rearSonarLeftV, rearSonarRightV; bool CheckJoystickValues(); void DriveRobot(float,float); void UpdateDashboard(); diff --git a/src/Subsystems/Compressor.cpp b/src/Subsystems/Compressor.cpp index 90509c7..39f6584 100644 --- a/src/Subsystems/Compressor.cpp +++ b/src/Subsystems/Compressor.cpp @@ -9,15 +9,20 @@ void HHCompressor::CompressorSystemPeriodic(){ case EXTENDED: solenoid1->Set(false); solenoid2->Set(true); + e_CollectorSolenoidState = IDLE; break; case RETRACTED: solenoid1->Set(true); solenoid2->Set(false); + e_CollectorSolenoidState = IDLE; + break; + case IDLE: + e_CollectorSolenoidState = IDLE; break; default: break; } - e_CollectorSolenoidState=IDLE; + //e_CollectorSolenoidState=IDLE; } void HHCompressor::StartCompressing(){ compressor->Start(); diff --git a/src/Subsystems/Shooter.cpp b/src/Subsystems/Shooter.cpp index 9b6eb6c..263ce99 100644 --- a/src/Subsystems/Shooter.cpp +++ b/src/Subsystems/Shooter.cpp @@ -28,8 +28,7 @@ void HHShooter::Lower(float desiredAngle){ if(GetAngle() >= desiredAngle){ ShootRaw(-0.1f); e_ShooterState=LOWERING; - } - else{ + }else{ ShootRaw(0.0f); e_ShooterState=IDLE_PRESHOT; }