- #include "WPILib.h"
- class Robot : public SimpleRobot
- {
- RobotDrive myRobot;
- Jaguar leftJaguar;
- Jaguar rightJaguar;
- Joystick leftStick;
- Joystick rightStick;
- Servo servo;
- Relay relay;
- Compressor compressor;
- Solenoid solenoidRetract1;
- Solenoid solenoidExtend1;
- Solenoid solenoidRetract2;
- Solenoid solenoidExtend2;
- public:
- Robot(void):
- myRobot(1, 2),
- leftJaguar(1),
- rightJaguar(2),
- leftStick(1),
- rightStick(2),
- servo(3),
- relay(1),
- compressor(1, 1),
- solenoidRetract1(2),
- solenoidExtend1(1),
- solenoidRetract2(4),
- solenoidExtend2(3)
- {
- compressor.Start();
- myRobot.SetExpiration(0.1);
- }
- void Autonomous(void)
- {
- myRobot.SetSafetyEnabled(true);
- AxisCamera& camera = camera.GetInstance();
- while(IsAutonomous())
- {
- }
- }
- void OperatorControl(void)
- {
- myRobot.SetSafetyEnabled(true);
- AxisCamera& camera = camera.GetInstance();
- while (IsOperatorControl())
- {
- if (leftStick.GetRawButton(4))
- {
- servo.SetAngle(280);
- }
- if (leftStick.GetRawButton(5))
- {
- servo.SetAngle(120);
- }
- if (leftStick.GetRawButton(2))
- {
- solenoidExtend1.Set(true);
- solenoidRetract1.Set(false);
- solenoidExtend2.Set(true);
- solenoidRetract2.Set(false);
- }
- if (leftStick.GetRawButton(3))
- {
- solenoidRetract1.Set(false);
- solenoidExtend1.Set(true);
- solenoidExtend1.Set(false);
- solenoidRetract1.Set(true);
- }
- if (compressor.GetPressureSwitchValue() > 119)
- {
- compressor.Stop();
- }
- else if (compressor.GetPressureSwitchValue() < 110)
- {
- compressor.Start();
- }
- myRobot.ArcadeDrive(leftStick);
- Wait(0.005);
- }
- }
- };
- START_ROBOT_CLASS(Robot);
SHARE
TWEET
Untitled
a guest
Feb 12th, 2011
53
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
RAW Paste Data
