Пример #1
0
  /** Operator-controlled drive for Teleop mode. */
  public void operatorControl() {
    boolean retry = true;

    while (retry) {
      try {
        retry = false;

        DriverStation.getInstance().setDigitalOut(2, false);
        DriverStation.getInstance().setDigitalOut(5, false);

        Robot.compressorPump.start();
        teleopMode.init();

        try {
          while (isOperatorControl() && isEnabled() && teleopMode.step()) {
            WorkerManager.work();
            Dashboard.render();
          }
        } catch (Exception ex) {
          logException(ex);
          retry = true;
        }

        teleopMode.disable();
        Robot.compressorPump.stop();
      } catch (Exception ex) {
        logException(ex);
        retry = true;
      }
    }
  }
Пример #2
0
  /** Constructor. */
  public Robot2012Orange() {
    /*
     * Make sure the robot is warmed up. Probably isn't necessary.
     */
    Robot.init();

    /*
     * Register workers.
     */
    WorkerManager.registerWorker(new RingLightWorker());
    WorkerManager.registerWorker(new DriveWorker());
    WorkerManager.registerWorker(new ElevatorWorker());
    WorkerManager.registerWorker(new PickupWorker());
    WorkerManager.registerWorker(new ShooterWorker());
    WorkerManager.registerWorker(new StingerWorker());
    WorkerManager.registerWorker(new RespringWorker());

    /*
     * Register dashboard sections.
     */
    Dashboard.registerSection(DemoDashboard.getInstance());
    // Dashboard.registerSection(AutonomousDashboard.getInstance());
    // Dashboard.registerSection(ElevatorDashboard.getInstance());
    Dashboard.registerSection(FiringDashboard.getInstance());
    Dashboard.registerSection(ShooterDashboard.getInstance());
    // Dashboard.registerSection(StateDashboard.getInstance());
    // Dashboard.registerSection(UserDashboard.getInstance());

    /*
     * Initialize hybrid mode.
     */
    hybridMode.registerControlMode(new ShootControlMode(), true);
    hybridMode.registerControlMode(new BridgeControlMode(), false);
    hybridMode.registerControlMode(new WaitingControlMode(), true);
    hybridMode.registerControlMode(new KinectControlMode(), true);

    hybridMode.renderSmartDashboard();

    /*
     * Initialize teleop mode.
     */
    // teleopMode.registerControlMode(new CompetitionControlMode(), true);
    teleopMode.registerControlMode(new DemoControlMode(), true);
    // teleopMode.registerControlMode(new LearningControlMode(), true);

    teleopMode.renderSmartDashboard();

    // TODO: Make the following better.
    Robot.firingProvider.setAtFender(true);

    /*
     * Ditch the built-in Watchdog.
     */
    this.getWatchdog().setEnabled(false);
  }
Пример #3
0
  /** Automated drive for autonomous mode. */
  public void autonomous() {
    try {
      DriverStation.getInstance().setDigitalOut(2, false);
      DriverStation.getInstance().setDigitalOut(5, false);

      Robot.compressorPump.start();
      hybridMode.init();

      try {
        while (isAutonomous() && isEnabled() && hybridMode.step()) {
          WorkerManager.work();
          Dashboard.render();
        }
      } catch (Exception ex) {
        ex.printStackTrace();
      }

      hybridMode.disable();
      Robot.compressorPump.stop();
    } catch (Exception ex) {
      logException(ex);
    }
  }