Exemple #1
0
  public static void logException(Exception ex) {
    try {
      ex.printStackTrace();

      FileConnection log =
          (FileConnection) Connector.open("file://" + System.currentTimeMillis() + ".txt");
      log.create();

      OutputStream logstream = log.openOutputStream();
      PrintStream logger = new PrintStream(logstream);

      logger.println(ex.getMessage());
      logger.println(ex.toString());

      logger.close();
      logstream.close();

    } catch (Exception ex2) {
      ex2.printStackTrace();
    }
  }
Exemple #2
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);
    }
  }