@SuppressWarnings("unchecked")
 @Override
 public void onScriptFinished(Object result, Object Previous, File source) {
   Log.warning("Loading script results " + result + " previous " + Previous);
   // this is added in the script engine when the connection manager is
   // loaded
   Platform.runLater(
       () -> {
         jfx3dmanager.removeObjects();
       });
   ThreadUtil.wait(20);
   if (ArrayList.class.isInstance(Previous)) {
     ArrayList<Object> c = (ArrayList<Object>) Previous;
     for (int i = 0; i < c.size(); i++) {
       removeObject(c.get(i));
     }
   } else {
     removeObject(Previous);
   }
   if (ArrayList.class.isInstance(result)) {
     ArrayList<Object> c = (ArrayList<Object>) result;
     for (int i = 0; i < c.size(); i++) {
       Log.warning("Loading array Lists with removals " + c.get(i));
       addObject(c.get(i), source);
     }
   } else {
     addObject(result, source);
   }
 }
Beispiel #2
0
  protected void ResetDrivePosition() {
    // Log.enableDebugPrint(true);

    drive.ResetPIDChannel(0);
    ThreadUtil.wait((200));
    // Log.enableDebugPrint(false);
  }
 @Test
 public void setPidNsTest() {
   try {
     int position = getPid().GetPIDPosition(0);
     int newPos = position - 0x0fff;
     getPid().SetPIDSetPoint(0, newPos, 1.0);
     ThreadUtil.wait(3000);
     int currentPos = getPid().GetPIDPosition(0);
     System.out.println("Set to " + newPos + " got " + currentPos);
     getPid().SetPIDSetPoint(0, position, 0);
     ThreadUtil.wait(1200);
     assertTrue((newPos < currentPos + 100) && (newPos > currentPos - 100));
   } catch (Exception e) {
     e.printStackTrace();
     fail();
   }
 }
Beispiel #4
0
 protected void SetDriveDistance(int ticks, double seconds) {
   Log.debug("Seting PID set point of= " + ticks + " currently at " + currentEncoderReading);
   // drive.SetPIDSetPoint(ticks, seconds);
   driveDirection.setHigh(ticks < currentEncoderReading);
   driveEnable.setHigh(false);
   ThreadUtil.wait((int) (seconds * 1000));
   driveEnable.setHigh(true);
   Log.debug("Arrived at= " + currentEncoderReading);
 }
    public void run() {
      // System.out.println("Starting timer");
      do {
        do {
          while (pause) {
            ThreadUtil.wait(10);
          }

          long start = System.currentTimeMillis();
          playStep();
          ThreadUtil.wait(getLoopTime());
          // System.out.println("Flush took "+(System.currentTimeMillis()-start));
        } while (isRun());
        setCurrentTime(0);
        setPause(true);
        callReset();
        callPause();
      } while (true);
    }
  /** @param args */
  public static void main(String[] args) {
    try {
      if (args.length != 2 || !args[0].contains("DyIO") || !args[1].contains("video")) {
        System.err.println(
            "Usage Example: java -jar CrustCrawlerServer.jar /dev/DyIO0 /dev/video0");
        System.exit(1);
      }
      SerialConnection s = new SerialConnection(args[0]);
      DyIO dyio = new DyIO(s);
      dyio.connect();

      new CrustCrawlerUnderwaterROV(new BowlerUDPServer(), dyio, args[1]);

      while (s.isConnected()) {
        ThreadUtil.wait(100);
      }
      System.exit(0);

    } catch (Exception e) {
      e.printStackTrace();
      System.exit(1);
    }
  }
 public void play() {
   mp3.play();
   getSt().setPause(false);
   callPlay();
   ThreadUtil.wait(100);
 }