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()),
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;

View File

@ -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();

View File

@ -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();

View File

@ -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;
}