Page 1 of 1

[Resolved] Geting no calibresult data in last pointend

PostPosted: 06 Feb 2014, 17:20
by amandris
I'm trying to perform a calibration using the Java client. Everything goes right until I call the pointend request for the last calibration point.

The server then responds with
Code: Select all
IN: {"category":"calibration","request":"pointend","statuscode":200}
but no calibresult data is present.

Is there anything I am doing wrong?


This is my code


In Calibration.java

Code: Select all
public class Calibration 

    public static void main (String[] args){
      GazeManager.getInstance().activate(ApiVersion.VERSION_1_0, ClientMode.PUSH);
      CalibrationHandler handler = new CalibrationHandler();
      GazeManager.getInstance().calibrationStart(9, handler);
    }
}


In CalibrationHandler.java

Code: Select all
public class CalibrationHandler implements ICalibrationProcessHandler
{     
   public static ArrayList<CalibrationPosition> calibrationPositions = new ArrayList<CalibrationPosition>();
   int position = 0;
   
   static{
      calibrationPositions.add( new CalibrationPosition(10, 10)); //CalibrationPosition is just a bean with x and y
      calibrationPositions.add( new CalibrationPosition(1355, 10));
      calibrationPositions.add( new CalibrationPosition(1355, 760));
      calibrationPositions.add( new CalibrationPosition(10, 760));
      calibrationPositions.add( new CalibrationPosition(10, 10));
      calibrationPositions.add( new CalibrationPosition(1355, 10));
      calibrationPositions.add( new CalibrationPosition(1355, 760));
      calibrationPositions.add( new CalibrationPosition(10, 760));
      calibrationPositions.add( new CalibrationPosition(10, 10));
   }
   
   @Override
   public void onCalibrationProcessing() {
      System.out.println("--------------Processing");
   }

   @Override
   public void onCalibrationProgress(double arg0) {
      if( arg0 < 1d){
         takeNextPosition();
      }
   }

   @Override
   public void onCalibrationResult(CalibrationResult arg0) {
      System.out.println("--------------result ");
      
   }

   
   private void takeNextPosition(){
      CalibrationThread calibrationThread = new CalibrationThread();
      calibrationThread.setX( calibrationPositions.get(position).getX());
      calibrationThread.setY( calibrationPositions.get(position).getY());
      calibrationThread.start();
      position ++;
   }
   
   @Override
   public void onCalibrationStarted() {
      position = 0;
      System.out.println("--------------started");
      takeNextPosition();
   }
}



In CalibrationThread.java

Code: Select all
public class CalibrationThread extends Thread{
  private int x;
  private int y;

   public void run() {
      try{Thread.sleep(250);}catch (Exception e){};
      GazeManager.getInstance().calibrationPointStart(x,y);
      try{Thread.sleep(500);}catch (Exception e){};
      GazeManager.getInstance().calibrationPointEnd();
   }
   
   public void setX(int x) {
      this.x = x;
   }
   public void setY(int y) {
      this.y = y;
   }
}

Re: [Calibration] Geting no calibresult data in last pointen

PostPosted: 06 Feb 2014, 17:59
by Anders
Hi

The interface ICalibrationProcessHandler handles callbacks from the EyeTribe Server related to the calibration process. When you have called GazeManager.getInstance().calibrationPointEnd() a number of times similar to the number of calibration points, then a callback to ICalibrationProcessHandler.onCalibrationResult() will be made. You should handle logic related to calibration results there.

For more inspiration, you could have a look at how the calibration process is handled in:
https://github.com/EyeTribe/tet-unity-gazecam/blob/master/Assets/Scripts/CalibCamera.cs
or
https://github.com/EyeTribe/tet-csharp-samples/blob/master/TETControls/Calibration/CalibrationRunner.cs

Whilst these samples are in C#, you should be able to 'get the idea' due to the syntax similaries and since the TET C# SDK is close to identical to the TET Java SDK.

Hope that helps :)

Re: [Calibration] Geting no calibresult data in last pointen

PostPosted: 06 Feb 2014, 20:21
by amandris
Thaks for your reply. I think I'm using the handler correctly. There is no logic in some methods yet, just a System.out.println. Thats why I know onCalibrationResult is never called.

Actually if you see the server log you can see that I perform 9 pointStart and 9 pointEnd but there is no calibresult in the response of the last pointEnd.

I'm using the last SDK version, 0.9.26-x86.

I post the server log below. I removed the tracker logs so you can see it clearly, just the calibration logs.

Code: Select all

OUT: {"values":{"push":true,"version":1},"category":"tracker","request":"set"}
OUT: {"values":["heartbeatinterval","iscalibrated","iscalibrating","trackerstate","screenindex","screenresw","screenresh","screenpsyw","screenpsyh","calibresult","framerate","version","push"],"category":"tracker","request":"get"}
IN: {"category":"tracker","request":"get","statuscode":200,"values":{"calibresult":{"calibpoints":[],"deg":0.0,"degl":0.0,"degr":0.0,"num":0,"result":false},"framerate":30,"heartbeatinterval":3000,"iscalibrated":false,"iscalibrating":false,"push":true,"screenindex":0,"screenpsyh":0.1940000057220459,"screenpsyw":0.3440000116825104,"screenresh":768,"screenresw":1366,"trackerstate":0,"version":1}}

OUT: {"values":{"pointcount":9},"category":"calibration","request":"start"}
IN: {"category":"calibration","request":"start","statuscode":200}

OUT: {"values":{"x":10,"y":10},"category":"calibration","request":"pointstart"}
IN: {"category":"calibration","request":"pointstart","statuscode":200}

OUT: {"category":"calibration","request":"pointend"}
IN: {"category":"calibration","request":"pointend","statuscode":200}

OUT: {"values":{"x":1355,"y":10},"category":"calibration","request":"pointstart"}
IN: {"category":"calibration","request":"pointstart","statuscode":200}

OUT: {"category":"calibration","request":"pointend"}
IN: {"category":"calibration","request":"pointend","statuscode":200}

OUT: {"values":{"x":1355,"y":760},"category":"calibration","request":"pointstart"}
IN: {"category":"calibration","request":"pointstart","statuscode":200}

OUT: {"category":"calibration","request":"pointend"}
IN: {"category":"calibration","request":"pointend","statuscode":200}

OUT: {"values":{"x":10,"y":760},"category":"calibration","request":"pointstart"}
IN: {"category":"calibration","request":"pointstart","statuscode":200}

OUT: {"category":"calibration","request":"pointend"}
IN: {"category":"calibration","request":"pointend","statuscode":200}

UT: {"values":{"x":10,"y":10},"category":"calibration","request":"pointstart"}
IN: {"category":"calibration","request":"pointstart","statuscode":200}

OUT: {"category":"calibration","request":"pointend"}
IN: {"category":"calibration","request":"pointend","statuscode":200}

OUT: {"values":{"x":1355,"y":10},"category":"calibration","request":"pointstart"}
IN: {"category":"calibration","request":"pointstart","statuscode":200}

OUT: {"category":"calibration","request":"pointend"}
IN: {"category":"calibration","request":"pointend","statuscode":200}

OUT: {"values":{"x":1355,"y":760},"category":"calibration","request":"pointstart"}
IN: {"category":"calibration","request":"pointstart","statuscode":200}

OUT: {"category":"calibration","request":"pointend"}
IN: {"category":"calibration","request":"pointend","statuscode":200}

OUT: {"values":{"x":10,"y":760},"category":"calibration","request":"pointstart"}
IN: {"category":"calibration","request":"pointstart","statuscode":200}

OUT: {"category":"calibration","request":"pointend"}
IN: {"category":"calibration","request":"pointend","statuscode":200}

OUT: {"values":{"x":10,"y":10},"category":"calibration","request":"pointstart"}
IN: {"category":"calibration","request":"pointstart","statuscode":200}

OUT: {"category":"calibration","request":"pointend"}
IN: {"category":"calibration","request":"pointend","statuscode":200} //Here it's supposed to be the calibresult


Re: [Calibration] Geting no calibresult data in last pointen

PostPosted: 07 Feb 2014, 13:06
by Anders
We will look into this asap. Thx.

Re: [Calibration] Geting no calibresult data in last pointen

PostPosted: 07 Feb 2014, 14:17
by Anders
We have now looked at your code and found a possible cause to the problem you are experiencing.

You are registering 9 calibration point in your calibrationStart() call and yet you are only sampling 4 points (your list of calibration points contain duplicates). The position of a calibration point must be unique and therefore your 9 points are actually treated as 4 in the EyeTribe Server. Try placing your points in the same manner as in the EyeTribeUI client that comes with the installer package.

We will do our best to make this clear in our next tutorial release. Thank you for your feedback.

Re: [Calibration] Geting no calibresult data in last pointen

PostPosted: 10 Feb 2014, 11:29
by amandris
It works!! It was my fault all the time. As you noticed I had duplicated calibration points.

Thanks for your help. Great product by the way. Proud to be from Spain as some of your team members ;)