mirror of
https://github.com/team2059/Zaphod
synced 2024-12-18 20:12:28 -05:00
Closes issue #5 with compressorEnabled
This commit is contained in:
parent
839643cc08
commit
b8b3e06347
@ -9,7 +9,7 @@ class RobotDemo : public SimpleRobot
|
|||||||
{
|
{
|
||||||
//Declarations{{{
|
//Declarations{{{
|
||||||
RobotDrive myRobot;
|
RobotDrive myRobot;
|
||||||
bool collectorExtended,shooting,compressing,allowCompressing, hasShot, waitingToFire, shooter_idle;
|
bool collectorExtended,shooting,compressing, compressorEnabled, hasShot, waitingToFire, shooter_idle;
|
||||||
float upLimit,throttle;
|
float upLimit,throttle;
|
||||||
Joystick Rstick,Lstick;
|
Joystick Rstick,Lstick;
|
||||||
Solenoid collectorSole1,collectorSole2;
|
Solenoid collectorSole1,collectorSole2;
|
||||||
@ -73,7 +73,7 @@ public:
|
|||||||
//compressor.Start();
|
//compressor.Start();
|
||||||
shooting=false;
|
shooting=false;
|
||||||
compressing=true;
|
compressing=true;
|
||||||
allowCompressing=true;
|
compressorEnabled = true;
|
||||||
hasShot=false;
|
hasShot=false;
|
||||||
waitingToFire=false;
|
waitingToFire=false;
|
||||||
shooter_idle=true;
|
shooter_idle=true;
|
||||||
@ -118,9 +118,9 @@ public:
|
|||||||
SmartDashboard::PutBoolean("Use Ultrasonic",true);
|
SmartDashboard::PutBoolean("Use Ultrasonic",true);
|
||||||
SmartDashboard::PutBoolean("Daniel Mode",false);
|
SmartDashboard::PutBoolean("Daniel Mode",false);
|
||||||
SmartDashboard::PutBoolean("CollectorState",false);
|
SmartDashboard::PutBoolean("CollectorState",false);
|
||||||
SmartDashboard::PutBoolean("Compressor Enabled",allowCompressing);
|
|
||||||
SmartDashboard::PutBoolean("Compressor Running",compressing);
|
SmartDashboard::PutBoolean("Compressor Running",compressing);
|
||||||
SmartDashboard::PutBoolean("Ignore Pot",false);
|
SmartDashboard::PutBoolean("Ignore Pot",false);
|
||||||
|
SmartDashboard::PutBoolean("Compressor Enabled",compressorEnabled);
|
||||||
}
|
}
|
||||||
//}}}
|
//}}}
|
||||||
//updateDashboard{{{
|
//updateDashboard{{{
|
||||||
@ -133,7 +133,7 @@ public:
|
|||||||
SmartDashboard::PutNumber("Ball Right",voltToDistance(BallSonicRight.GetAverageVoltage()));
|
SmartDashboard::PutNumber("Ball Right",voltToDistance(BallSonicRight.GetAverageVoltage()));
|
||||||
SmartDashboard::PutNumber("upLimit",upLimit);
|
SmartDashboard::PutNumber("upLimit",upLimit);
|
||||||
SmartDashboard::PutBoolean("Compressor Running",compressing);
|
SmartDashboard::PutBoolean("Compressor Running",compressing);
|
||||||
allowCompressing=SmartDashboard::GetBoolean("Compressor Enabled");
|
SmartDashboard::PutBoolean("Compressor Enabled",compressorEnabled);
|
||||||
if(upLimit > 167){
|
if(upLimit > 167){
|
||||||
upLimit=167;
|
upLimit=167;
|
||||||
}
|
}
|
||||||
@ -254,11 +254,11 @@ public:
|
|||||||
//}}}
|
//}}}
|
||||||
//runCompressor{{{
|
//runCompressor{{{
|
||||||
void runCompressor(int i, int refreshInterval){
|
void runCompressor(int i, int refreshInterval){
|
||||||
if(i%refreshInterval==0&&compressing&&compressor.GetPressureSwitchValue()==1){
|
if(i%refreshInterval==0&&compressing&&compressor.GetPressureSwitchValue()==1&&compressorEnabled){
|
||||||
compressing=false;
|
compressing=false;
|
||||||
compressor.Stop();
|
compressor.Stop();
|
||||||
}
|
}
|
||||||
if(i%refreshInterval==0&&!compressing&&compressor.GetPressureSwitchValue()==0&&shooter_idle){
|
if(i%refreshInterval==0&&!compressing&&compressor.GetPressureSwitchValue()==0&&shooter_idle&&compressorEnabled){
|
||||||
compressing=true;
|
compressing=true;
|
||||||
compressor.Start();
|
compressor.Start();
|
||||||
}
|
}
|
||||||
@ -316,6 +316,7 @@ public:
|
|||||||
}else{
|
}else{
|
||||||
//Important part the stops the whole shooting sequence and tells the user that the shooter is back at its original state
|
//Important part the stops the whole shooting sequence and tells the user that the shooter is back at its original state
|
||||||
shooter_idle=true;
|
shooter_idle=true;
|
||||||
|
compressorEnabled = true;
|
||||||
shooter_fired(0);
|
shooter_fired(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -632,8 +633,7 @@ public:
|
|||||||
//}}}
|
//}}}
|
||||||
//Shoot{{{
|
//Shoot{{{
|
||||||
if(Lstick.GetRawButton(1)==1){
|
if(Lstick.GetRawButton(1)==1){
|
||||||
compressing=false;
|
compressorEnabled= false;
|
||||||
compressor.Stop();
|
|
||||||
shooter_idle=false; //Cause the robot to start the shooting sequence
|
shooter_idle=false; //Cause the robot to start the shooting sequence
|
||||||
}
|
}
|
||||||
//}}}
|
//}}}
|
||||||
|
Loading…
Reference in New Issue
Block a user