Discovering, loading and configuring a camera

"How do I load a camera and configure it with a config file in ‘InsertProgrammingLanguage’ ".

This question or simply how to load a config file is one of our FAQs in customer support.
What seems to be answered with one sentence or line of code needs a little bit more background and sometimes a little push into the right direction - Which is the reason for this post.
(I will not post links here, as everything mentioned can be found in the ‘InsertProgrammingLanguage’ subforums :wink: )

Generally there are (should be used) two ways of getting a correctly configured camera:

  1. Open the :cvb:ManagementConsole or GenICam browser, find the camera you want to acquire images from (ignoring subnet might be necessary), set up the desired IP-Adress within you NIC`s subnet and either load a config file to the camera or configure it via the GenICam grid (Nodemap) provided by the mentioned tools.

  2. Do no configuration at all, use the Discover interface, find the camera you want and configure the camera via GenApi (NodeMap).

When would I use which way?

1: You want to test a new camera or you set up a system that will never ever need to have a camera changed or only preconfigured devices will be attached replacing the old ones.

2: You want to be able to change cameras, and it should work plug and play.

Why is it not a good idea to load a config file in code?

Well, it seems like the GenApi is a bit picky when it comes to saving or loading nodes to or from a config file.
Some nodes depend on others to be set to a certain value to become read- or writeable.
Unfortunately it is not given, that these nodes will be set in the correct way, leaving you with a badly configured or not usable camera.
So use 1. if you only have few simple parameters to set or 2. if you need to create a more advanced config (TriggerMode etc.).

I discovered and opened the camera, what to do now to configure it correctly?

Best practice would be a little helper class to store the values you want to set for one given cameratype (be warned: Different firmwares might come with different namings on the nodes).

Via NodeMap:

  • Load the factory setting
  • Switch the UserSet to one other than factory
  • Configure the camera by setting the desired values to the desired nodes
  • Set the configured UserSet as the one that is loaded on startup
  • Perform a UserSetSave()

What you have now:
You can now check if the SerialNumber of a discovered camera is known, if so, load the camera and be happy, if not, load the camera, configure the camera, be happy.

From now on your system should not have problems with blackouts or new cameras being attached.
Replacing a (hopefully not) defect camera with a new one is simply plug and play.

I hope this helps for future questions on this topic and I also hope I myself did not get anything wrong :wink: