genicam / harvesters

Image Acquisition Library for GenICam-based Machine Vision System
Apache License 2.0
501 stars 86 forks source link

Get a updated GENICAM value from Feature node #404

Closed geimel closed 1 year ago

geimel commented 1 year ago

As described in the turorial, I'll get a value from my camera. The value is the actual sensor temperatur, which is read only. With temp=ia.remote_device.node_map.SensorTemp.value temp has the temperature from the time of camera connection (ia = h.create_image_acquirer(0) ) I will frequently get the actual value of the SensorTemp property node, but always the old value is read.

How the actual value from camera ca be read? I have monitored the GigE Datastream with Wireshark, by executing temp=ia.remote_device.node_map.SensorTemp.value there is no register ready from the camera.

Thanks a lot

jcormier commented 1 year ago

It sounds like the camera has a bug. The node map in GenTL is provided by the camera in the form of an XML file. In the XML file, it specifies all the parameters and whether they should be cached. Caching is usually on by default and it sounds like this camera needs to disable it for the SensorTemp.

geimel commented 1 year ago

Thank you for your quick response. What do you mean with caching, where the data is cached? On camera side there is no caching. With commercial GigEViewer Software, i.e. Matrix Vision wxPropView or AVT the temperature is read with actual value. When I click on the property in the software, in Wireshark the register read is visible. Unbenannt

When I read the parameter in python, there is nothing. Thanks a lot

jcormier commented 1 year ago

What do you mean with caching, where the data is cached?

The GenTL dll on the client side, caches reads unless told not to. Presumably, this python library as well as the commercial options are all using this same GenTL dll, but I suppose it's not guaranteed.

As an example, here is an XML written for testing with a SIM camera. Caching is disabled so a new value gets fetched each time. https://support.criticallink.com/redmine/attachments/26386/sim_camera.xml#L152

https://www.emva.org/wp-content/uploads/GenICam_Standard_v2_1_1.pdf

The element can have the values NoCache, WriteThrough, and WriteAround. WriteThrough means that a value written to the camera is written to the cache as well. WriteAround means that only read values are written to the cache. The latter behavior makes sense, for example, with an IFloat::Gain node where the user can write any value, but when reading back, will retrieve a value that has been rounded by the camera to a value the internal analog-to-digital converter is able to deliver. Note that caching is an optional feature of any implementation.

I guess according to the spec caching is optional, so maybe the commercial viewers don't implement it...

Note this is all an educated guess, you'd need to look at the XML from the camera to see if the Cachable field is setup.

I think you can get harvesters to leave the XML so you can view it by disabling ParameterKey.ENABLE_CLEANING_UP_INTERMEDIATE_FILES https://github.com/genicam/harvesters/blob/3a8ca3ad579416848029fc25c38322272abb24ef/src/harvesters/core.py#L2892

geimel commented 1 year ago

Thanks a lot, with <Cachable>NoCache</Cachable> in the XML File all is fine. I'm very happy with this solution.