Device Discovery

Hello, I am looking into device discovery in the latest CVB release.

I have seen the console example applications (and they are very useful). I have built my own Windows Forms C# application to try the whole process. I can successfully detect a camera (twice: once under the Filter Driver, once under the Socket Driver) and I can open the device and assign it to a display. I can snap an image, but I can’t grab. I would appreciate some direction on where I am going wrong as it all seems to be right to me.

I have hacked together a code snippet below, I hope I have made the names consistent…

  Cvb.Driver.DeviceDiscovery.Discover(Cvb.Driver.DeviceDiscovery.Flags.FindAll, out ListOfDevices); //Discover devices - at all levels
  Cvb.Driver.DeviceDiscovery.GetATEntryInfo(ListOfDevices, i, Cvb.Driver.DeviceDiscovery.InfoCommand.AccessToken, out strToken);

  bool Success;
  //StrToken contains the discovery information
  Success = Cvb.Image.LoadImageFile(strToken, out CVBImage);
                            
  cGrab.Enabled = Cvb.Driver.IGrab2.CanGrab2(CVBImage); //check if it has a grab2 interface
  //the grab checkbox does get enabled so it seems there is grab2 support
              
  m_CVimage1.Image = CVBImage;
  m_CVdisplay1.Image = m_CVimage1.Image;
  m_CVdisplay1.Refresh();  
               
  //m_CVimage1.Grab = cGrab.Checked; //this doesn't work

  //this DOES work
  if (cGrab.Checked == true)
  {
    m_CVimage1.Snap();
    m_CVdisplay1.Refresh();
    m_CVimage1.Snap();
    m_CVdisplay1.Refresh();
    m_CVimage1.Snap();
  }
1 Like

Adding an event to refresh the axCVdisplay1 allready makes life easier :slight_smile:

private void axCVimage1_ImageSnaped(object sender, EventArgs e)
{
  axCVdisplay1.Refresh();
}

I got this code snippet from CSTwoCam2010, which is a nice clean example of getting two cameras to grab. In that example the grabbing is enabled by more or less the same code you have;

if (checkBoxGrab1.Checked == false && comboBoxDisplay1.Items.Count != 0)
{
  comboBoxDisplay1.Enabled = true;
}
else
  comboBoxDisplay1.Enabled = false;
    
axCVimage1.Grab = checkBoxGrab1.Checked;

That is also why the snap does work for you, after every snap event you manually refresh the appropriate display. So, adding the image snapped event should fix things.

Hello @CvK,
It is a good idea, and you made me check, but I do have the Refresh() in the ImageSnaped event:

    private void m_CVimage1_ImageSnaped(object sender, EventArgs e)
    {
        m_CVdisplay1.Refresh();
    }

To make sure that it wasn’t a display issue, I also added the following:

    private void m_CVimage1_ImageSnaped(object sender, EventArgs e)
    {
        m_CVdisplay1.Refresh();
        m_CVdisplay1.StatusUserText = DateTime.Now.ToShortTimeString();
    }

Nothing appears in the display’s status line, so it seems that no grab takes place.

Hmm, most peculiar. Im assuming the grab works just fine in the genicam browser and/or the cvb management console? Are there any major differences between your code and the C# example CSdisplay2010?

The only remaining thing I can think of is that you need to set the m_CVimage1.Grab = cGrab.Checked; as part of the cGrab_CheckedChanged event;

    private void cGrab_CheckedChanged(object sender, EventArgs e)
    {
      M_CVimage1.Grab = cGrab.Checked;
    }

Hi LincolnshirePoacher

I guess you found a feature. :frowning: The iGRAB2 Interface is available but I can reproduce that there is a timeout returned by G2Wait. Working on it … keep you informed.

2 Likes

Hi,

Sorry to hijack this thread, but I believe I ran into the same issue in the C++ SDK.
I can Snap ok after device discovery, but G2Wait results in a time-out (CVC_E_TIMEOUT).
Opening a camera through a .vin file works as expected, and does not produce the time-out on G2Wait.

Can you confirm that this is the same issue?

I tested this on a DALSA Genie Nano M1280 and a DALSA Linea LA-GC-04K05B.

(C++ code to reproduce the problem below.)

void Test_Camera_ok ()
{
    // Load the image
  IMG hCamera = nullptr;
  LoadImageFile ("C:\\Program Files\\STEMMER IMAGING\\Common Vision Blox\\Drivers\\GenICam.vin", hCamera);

  if (Snap (hCamera) == CVC_E_OK)
    std::cout << "Camera successfully snapped an image." << std::endl;

  G2Grab (hCamera);

  if (G2Wait (hCamera) == CVC_E_OK)
    std::cout << "Wait completed successfully." << std::endl;

  G2Freeze (hCamera, false);

  ReleaseObject (hCamera);
}


void Test_Camera_nok ()
{
  // Execute a simple discovery 
  ATLIST discoverList = nullptr;
  DODiscover ("", DO_DISCOVER_FLAG_IGNORE_VINS, 0, discoverList, 0);

  // Retrieve the JASON ACCESS TOKEN for the first device
  size_t stringSize = 0;
  DOEntryGetInfo (discoverList, 0, DO_DISCOVER_INFO_ACCESS_TOKEN, NULL, stringSize);

  std::string accessPath (stringSize, '\0');
  DOEntryGetInfo (discoverList, 0, DO_DISCOVER_INFO_ACCESS_TOKEN, &accessPath[0], stringSize);

  // Load the image
  IMG hCamera = nullptr;
  LoadImageFile (accessPath.c_str (), hCamera);

  ReleaseObject (discoverList);

  if (Snap (hCamera) == CVC_E_OK)
    std::cout << "Camera successfully snapped an image." << std::endl;

  G2Grab (hCamera);

  if (G2Wait (hCamera) == CVC_E_OK)
    std::cout << "Wait completed successfully." << std::endl;

  G2Freeze (hCamera, false);

  ReleaseObject (hCamera);
}

Hi,

we are in the phase of releasing a patch/service release 13.0.3 … this will fix this problem. As soon as it is out it will be available for download in the forum.

Regards

1 Like

Currently it’s scheduled for friday. We have one remaining issue with driver signing to be sorted out. Once we got this i’ll be online in the forum.

1 Like

Hello @michael.desmet
Yes - that matches what I found.

1 Like

:cvb: 13.00.003 has been released today and can be downloaded here:

https://forum.commonvisionblox.com/t/common-vision-blox-for-64-bit-windows/368?u=parsd

or

https://forum.commonvisionblox.com/t/common-vision-blox-for-32-bit-windows/369?u=parsd

1 Like

Hi @parsd

Thanks for the new release!
I went ahead and installed version 13.00.003 for 64 bit Windows.

Unfortunately, the G2Wait timeout issue after device discovery still occurs with both of the cameras mentioned in my post.

Any insights?

@LincolnshirePoacher Does the new release resolve the issue for you?

Hi @michael.desmet,

sadly I have to admit that the buggy version sneaked back into the release sources and the release tests did not catch it :face_with_symbols_over_mouth:. We have verified that all the other files in 13.00.003 are as intended. You can expect a 13.00.004 to be released no later than tomorrow morning with the fixes in place.

To get you up and running straight away, these are the GenICam.vin files that will be released in 13.00.004:

(to use them. simply replace the existing file in your %CVB%\Drivers directory with the one from the *.zip file matching the architecture of your :cvb: installation; everyone please note that this GenICam.vin should only be used with a :cvb: 13.00.xxx installation, nothing outside that scope)

To quote Douglas Adams’ So Long and Thanks for all the Fish: We apologize for the inconvenience… :unamused:

1 Like

The replacement file solves it for me - thanks for the responsive answer.

I can confirm that the new GenICam.vin file solves the issue for me as well.
Thanks!

Hi @LincolnshirePoacher and @michael.desmet!

Thanks for letting me know that the updated GenICam.vin worked and sorry for not living up to my promise to have the 13.00.004 available by yesterday noon. It turned out that there was another issue to be fixed in the CVCDriver.dll and CVCImg.dll on Linux. You probably did not stumble across this one because it only happened in the Unicode code path of the Device Discovery functions.

Anyway, it’s available now in the Download section. Thanks a lot for your patience! :clap:

1 Like