2
0
mirror of https://github.com/team2059/Zaphod synced 2024-12-18 20:12:28 -05:00

Trying to get this to work on robot... Not working right now

This commit is contained in:
Austen Adler 2014-08-22 13:13:08 -06:00
parent 09b056c64b
commit b28fb4d93e
4 changed files with 11 additions and 14 deletions

View File

@ -5,8 +5,7 @@ HHRobot::HHRobot():
shooter(new HHShooter()), shooter(new HHShooter()),
collector(new HHCollector()), collector(new HHCollector()),
compressorSystem(new HHCompressor()), compressorSystem(new HHCompressor()),
dashboard(new HHDashboard()), dashboard(new HHDashboard()){
sonar(new HHSonar()){
} }
bool HHRobot::CheckJoystickValues(){ bool HHRobot::CheckJoystickValues(){
float x=ControlSystem->rightJoystickAxisValues[1]; float x=ControlSystem->rightJoystickAxisValues[1];
@ -14,16 +13,15 @@ bool HHRobot::CheckJoystickValues(){
if((-.1 < x && x < .1) && (-.1 < y && y < .1)) { if((-.1 < x && x < .1) && (-.1 < y && y < .1)) {
dashboard->PutBoolValue("Joysticks Valid", true); dashboard->PutBoolValue("Joysticks Valid", true);
return true; return true;
} else { }else{
dashboard->PutBoolValue("Joysticks Valid", false); dashboard->PutBoolValue("Joysticks Valid", false);
return true;
return false; return false;
} }
} }
void HHRobot::DriveRobot(float x, float y){ void HHRobot::DriveRobot(float x, float y){
if(y>1.0f) { if(y>1.0f){
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; y=-1.0f;
} }
float leftPower=((y+x)/2+1)*127+1; float leftPower=((y+x)/2+1)*127+1;

View File

@ -8,22 +8,17 @@ class HHShooter;
class HHCollector; class HHCollector;
class HHCompressor; class HHCompressor;
class HHDashboard; class HHDashboard;
class HHSonar;
class HHRobot; class HHRobot;
class HHRobot{ class HHRobot{
private: private:
Jaguar *right1, *right2, *right3, *left1, *left2, *left3; Jaguar *right1, *right2, *right3, *left1, *left2, *left3;
DigitalOutput *frontSonarLeftD, *frontSonarRightD, *rearSonarLeftD, *rearSonarRightD;
AnalogChannel *frontSonarLeftA, *frontSonarRightA, *rearSonarLeftA, *rearSonarRightA;
JoystickController *ControlSystem; JoystickController *ControlSystem;
HHShooter *shooter; HHShooter *shooter;
HHCollector *collector; HHCollector *collector;
HHCompressor *compressorSystem; HHCompressor *compressorSystem;
HHDashboard *dashboard; HHDashboard *dashboard;
HHSonar *sonar;
public: public:
HHRobot(); HHRobot();
float frontSonarLeftV, frontSonarRightV, rearSonarLeftV, rearSonarRightV;
bool CheckJoystickValues(); bool CheckJoystickValues();
void DriveRobot(float,float); void DriveRobot(float,float);
void UpdateDashboard(); void UpdateDashboard();

View File

@ -9,15 +9,20 @@ void HHCompressor::CompressorSystemPeriodic(){
case EXTENDED: case EXTENDED:
solenoid1->Set(false); solenoid1->Set(false);
solenoid2->Set(true); solenoid2->Set(true);
e_CollectorSolenoidState = IDLE;
break; break;
case RETRACTED: case RETRACTED:
solenoid1->Set(true); solenoid1->Set(true);
solenoid2->Set(false); solenoid2->Set(false);
e_CollectorSolenoidState = IDLE;
break;
case IDLE:
e_CollectorSolenoidState = IDLE;
break; break;
default: default:
break; break;
} }
e_CollectorSolenoidState=IDLE; //e_CollectorSolenoidState=IDLE;
} }
void HHCompressor::StartCompressing(){ void HHCompressor::StartCompressing(){
compressor->Start(); compressor->Start();

View File

@ -28,8 +28,7 @@ void HHShooter::Lower(float desiredAngle){
if(GetAngle() >= desiredAngle){ if(GetAngle() >= desiredAngle){
ShootRaw(-0.1f); ShootRaw(-0.1f);
e_ShooterState=LOWERING; e_ShooterState=LOWERING;
} }else{
else{
ShootRaw(0.0f); ShootRaw(0.0f);
e_ShooterState=IDLE_PRESHOT; e_ShooterState=IDLE_PRESHOT;
} }