ocular-motor-lab / OpenIris

GNU Affero General Public License v3.0
9 stars 1 forks source link

Problems with the initialization of a fireFly camera #45

Open DarioScocco opened 4 weeks ago

DarioScocco commented 4 weeks ago

Hi I am just starting to use the program. I have connected a single firefly camera. The sowtware recongnize the camera but on initilizing EyeTrackingSystemSpinnaker_SingleCam and it try to assign the device serial number

settings.CameraSerialNumber = cameraList[0].DeviceSerialNumber.ToString();

It thrown an exception on the EyeTrackerGui

eyeTracker.Settings.PropertyChangingNeedsRestart += (o, e) => { if (!eyeTracker.NotStarted) { DialogResult result = MessageBox.Show( "Changing the setting " + e.PropertyName + " requires to stop the tracking.", "Stopping tracking.", MessageBoxButtons.OK);

          eyeTracker.StopTracking();
      }
  };

As the cammera did not started beacuse of the exception, the camera can´t be stopped and it thorows another exception. The Eye trackergui is responsive but it does not allow to start the tracking again (the button is unabled).

class EyeTrackingSystemSpinnaker_SingleCam : EyeTrackingSystemBase { protected CameraEyeSpinnaker? camera = null;

protected override EyeCollection<CameraEye?>? CreateAndStartCameras()
{
    var settings = Settings as EyeTrackingSystemSettingsSpinnaker_SingleCam;

    try
    {
        var cameraList = CameraEyeSpinnaker.FindCameras(1, settings.Eye, settings.CameraSerialNumber, null);

        camera = new CameraEyeSpinnaker(
        whichEye: Settings.Eye,
        camera: cameraList[0],
        frameRate: (double)settings.FrameRate,
        gain: (int)settings.Gain,
        roi: new Rectangle { Width = 720, Height = 450 });

        settings.CameraSerialNumber = cameraList[0].DeviceSerialNumber.ToString(); ------> exception

        camera.Start();
    }
    catch (Exception ex)
    {
        if (camera != null)
        {
             camera.Stop();   ----> exception 

        }

        throw new InvalidOperationException("Error starting cameras captures or setting GPIOs. " + ex.Message, ex);
    }

Thank you in advance for any help Darío