public void displayFrame(Mat mat) {
   if (processSub) {
     if (autofocus.isRunning()) {
       autofocus.displayFrame(mat);
     }
     if (calibrator.isRunning()) {
       calibrator.displayFrame(mat);
     }
   }
 }
  /** Sets the navigator to move along x and y by X and Y. */
  public void setTarget(double x, double y) {
    if (!calibrator.isCalibrated()) return;
    MathUtils.set(target, x, y);
    MathUtils.set(offtarget, target);
    calibrator.getRequiredSteps(target);
    targetSet = true;
    steps.x = (steps.x > 0) ? (int) (steps.x + 0.5) : (int) (steps.x - 0.5); // round no. of steps
    steps.y = (steps.y > 0) ? (int) (steps.y + 0.5) : (int) (steps.y - 0.5);

    calibrator.adjustBacklash(steps);
  }
 /** The navigator will move to the target specified by setTarget() */
 public void start() {
   System.out.println("initiate navigation");
   if (!calibrator.isCalibrated()
       || !stage.bluetoothConnected()
       || calibrator.isRunning()
       || autofocus.isRunning()
       || isRunning()
       || !targetSet) return;
   System.out.println("prerequisites fulfilled");
   targetSet = false;
   moving = true;
   tracker.start();
 }
 private void init(StepCalibrator calib, Autofocus focus, FovTracker track) {
   stage = calib.getStageController();
   calibrator = calib;
   autofocus = focus;
   tracker = track;
   tracker.addCallback(this);
   target = new Point();
   offtarget = new Point();
   callbacks = new ArrayList<NavigationCallback>();
 }