genicam / harvesters

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

Node values are not updated #433

Open eli-osherovich opened 8 months ago

eli-osherovich commented 8 months ago

Describe the Issue I trying to get temperature from a camera every X seconds. However, I always get the same value (that was correct at the moment of the connection to the camera) despite the fact that the temperature changes all the time.

To Reproduce Try to read a dynamic node such as temperature and see if the values are indeed different.

Sample Code

with Harvester() as h:
  ...
  ia = h.create()
  white True:
    print(ia.remote_device.node_map.get_node("Temperature_Sensor").value)
    # it will always print the same value, even though the true value (temperature) changes.

If yes, please provide a sample code: See above.

Expected Behavior I would expect to see the value changes, however, it is kept "frozen". Namely, all the prints above will print the same temperature (correct only on the first reading).

Screenshots NA.

Configuration

Reproducibility

This phenomenon can be stably reproduced:

If applicable, please provide your observation about the reproducibility.

Actions You Have Taken

Additional context NA

jcormier commented 8 months ago

Note this is very likely a problem with the producer you are using or more likely the XML file coming from your camera. In the xml if they set this field to cacheable, then you'd get this behavior.

eli-osherovich commented 8 months ago

Thanks, @jcormier. Not familiar enough with the GIgE standard... Can I edit the xml and upload it back?

jcormier commented 8 months ago

I'm not sure, that would be camera-dependent. I think you should get ahold of whoever makes the Specim FX17.

thiesmoeller commented 8 months ago

Typical for camera implementations, that have values that change slowly like temperature to rely on poll infrastructure of genicam.

please try in your loop every second this call

ia.remote_device.node_map.poll(1000)

this will invalidate the cache on every node, that has a polling time set ( typically Temperature )

Subsequent reads will get the value from the camera directly.

The reason behind this design is to prevent constant updating in GUI Tools, that would generate a significant read rate to the camera otherwise, if the Temperature node would be a volatile uncached node.

jcormier commented 8 months ago

please try in your loop every second this call

ia.remote_device.node_map.poll(1000)

Wow, this is really good to know. The PollingTime is mentioned in the GenICam standard but it mentions it's implementation is optional and provides no info on how its supposed to be used. I assume poll is expected to get called by some timer every 1000ms, or whatever time you pass it.

eli-osherovich commented 8 months ago

Thanks, @thiesmoeller !

eli-osherovich commented 8 months ago

@thiesmoeller I might be doing something wrong, but poll does not help...

MYCL94 commented 5 months ago

@eli-osherovich Same for me, polling doesn't help. I am still searching for a good way since only restarting the app seems to help but I couldn't figure out which method-call leads to updating the nodes.

jcormier commented 5 months ago

Can you post the cameras xml? If the camera has set its caching rules wrong then polling won't help.

MYCL94 commented 5 months ago

Hi @jcormier, thanks for helping me out.

There are two cameras connected, and both deliver images. But for some reason it is not possible to change settings for TIS camera. Maybe it due to the fact that I am using the .cti file of Baumer. Ans also for both it is not possible to read the actual value out of the node.

As requested the XML-File TIS camera XML (not even able to set parameter like Gain etc.): TIS_IMX250_M.json

Baumer camera XML (Possible to apply settings like Gain etc,): Baumer_CXG_IP_PTP.json

jcormier commented 5 months ago

But for some reason it is not possible to change settings for TIS camera. Maybe it due to the fact that I am using the .cti file of Baumer. And also for both it is not possible to read the actual value out of the node.

Feels like you should create a separate issue. If writes aren't working then I don't see how that would be related to caching. Though honestly, you should be contacting the camera manufacturer first, I doubt this is an issue with Harvesters.

MYCL94 commented 5 months ago

OK, but shouldn't the Baumer camera work as expected then? I don't see both cameras having troubles, since I can change them by the provided software. Imho this is definetly an Harvesters issue. Is there any way to find an CTI-file which has maximum coverage? Shouldn't this be listed somewhere?

jcormier commented 5 months ago

shouldn't the Baumer camera work as expected then

Are you saying it doesn't work? In the two posts you've made so far, its implied if not explicitly stated the Baumer camera works. So I'm lost.

I can change them by the provided software

This is new information that would be very helpful to anyone trying to help you. What cti does the provided software use?

Is there any way to find an CTI-file which has maximum coverage? Shouldn't this be listed somewhere?

There is? https://harvesters.readthedocs.io/en/latest/INSTALL.html#installing-a-gentl-producer

You should create a new issue outlining all your testing, in order to have any chance of getting useful help. I need to get off the internet for today, I'm clearly too grumpy.

MYCL94 commented 5 months ago

Ok @jcormier, thanks for you reply. I will create an issue with listed infos and all the testing so far as you suggested. n8

eli-osherovich commented 4 months ago

Can you post the cameras xml? If the camera has set its caching rules wrong then polling won't help. @jcormier I wish :)) #438