SHARE
TWEET

FRC 2551 non-running code

a guest Jan 10th, 2017 100 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include "WPILib.h"
  2. #include "Joystick.h"
  3. #include "MyJoystick.h"
  4.  
  5. #define USB0 0
  6. #define USB1 1
  7. #define USB2 2
  8.  
  9. #define PWM0 0
  10. #define PWM1 1
  11. #define PWM2 2
  12. #define PWM3 3
  13. #define PWM4 4
  14. #define PWM5 5
  15. #define PWM6 6
  16. #define PWM7 7
  17. #define PWM8 8
  18. #define PWM9 9
  19.  
  20. #define DIO0 0
  21. #define DIO1 1
  22. #define DIO2 2
  23. #define DIO3 3
  24. #define DIO4 4
  25. #define DIO5 5
  26. #define DIO6 6
  27. #define DIO7 7
  28. #define DIO8 8
  29. #define DIO9 9
  30.  
  31. #define PCM0 0
  32. #define PCH0 0
  33. #define PCH1 1
  34.  
  35. #define ANALOG0 0
  36.  
  37. #define PULSEIN -0.03865131578
  38. #define PULSECM -0.09815789473
  39.  
  40.  
  41. class Robot: public IterativeRobot
  42. {
  43.     RobotDrive *daedalusDrive;
  44. //  Encoder driveEncoder;
  45.     Joystick *left, *right;
  46.     Spark leftDriveSpark;
  47.     Spark rightDriveSpark;
  48. //  Compressor compressor;
  49.  
  50.     bool enabled;
  51.     bool pressureStatus;
  52.     float current;
  53.  
  54.     bool swapPressed;
  55.  
  56.     enum {
  57.         forward,
  58.         reverse
  59.     } driveState = forward;
  60.  
  61.     enum {
  62.         step0,
  63.         done
  64.     } autoStep = step0;
  65.  
  66. public:
  67.     Robot() :
  68. //      driveEncoder(DIO8, DIO9),
  69.         leftDriveSpark(PWM0),
  70.         rightDriveSpark(PWM1)
  71. //      compressor(PCM0)
  72.     {
  73.         left = new Joystick(USB0);
  74.         right = new Joystick(USB1);
  75.         daedalusDrive = new RobotDrive(1,2),
  76.         daedalusDrive->SetExpiration(0.1);
  77.         daedalusDrive->SetSafetyEnabled(false);
  78.     }
  79.  
  80.     ~Robot(){}
  81.  
  82.     void RobotInit(){
  83. //      CameraServer::GetInstance()->StartAutomaticCapture("cam0");
  84. //      driveEncoder.Reset();
  85.  
  86. //      driveEncoder.SetDistancePerPulse(PULSEIN);
  87. //      enabled = compressor.Enabled();
  88. //      pressureStatus = compressor.GetPressureSwitchValue();
  89. //      current = compressor.GetCompressorCurrent();
  90.  
  91. //      compressor.SetClosedLoopControl(true);
  92.     }
  93.  
  94.  
  95.     void AutonomousInit()
  96.     {
  97.         autoStep = step0;
  98. //      driveEncoder.Reset();
  99.     }
  100.  
  101.     void AutonomousPeriodic()
  102.     {
  103.  
  104.     }
  105.  
  106.     void TeleopInit()
  107.     {
  108.  
  109.     }
  110.  
  111.     void TeleopPeriodic()
  112.     {
  113.         daedalusDrive->TankDrive(left, right);
  114.     }
  115.  
  116.     void TestPeriodic()
  117.     {
  118.  
  119.     }
  120. };
  121.  
  122. START_ROBOT_CLASS(Robot)
RAW Paste Data
Top