Skip to main content

python node.GetValue() does not update

Comments

4 comments

  • TDY_Demos
    Community team
    Expert (Gold)

    Hello,

    Thank you for your comment and source code.  I can verify I see the same as you with your code.  I have also modified our default NodeMapCallback.py code by switching to auto gain, and I also do not see it changing.

    As far as our engineering team is concerned, this should work in Auto, so I will need to do some more testing to verify if the C++ example runs fine with auto to narrow down if this is a python issue or a library issue.

    You should not have to refresh the nodemap for the callback to fire, so we will investigate this further and get back to you.

    Thank you,

    Demos

    1
  • Zhengyi Jiang

    Thank you for mentioning about refreshing the nodemap. Adding cam.GetNodeMap().Poll(1000) before cam.Gain.GetValue() solves the issue. I will use this workaround while you work on a fix.

    0
  • TDY_Demos
    Community team
    Expert (Gold)

    Thank you.  It does seem like it is an issue with the library not auto-polling the nodemap, and we would need to change this at the library level to poll in the background instead of the user polling.  The SpinView GUI polls on the software side, which is why the nodes look like they are updating.

    For your code, refreshing the nodemap every time before you call GetGain I don't think is needed, as if you are polling anyways, you may as well just call Gain.GetValue() instead of looking at callbacks.

    The only way I see the nodemap refresh being helpful is if you just had a separate thread that always looped and refreshed the nodemap every 1000 ms.  Then you can be running your code and the callback will fire if Gain has changed.

    I hope this helps you do what you are looking for at the moment.  I think it will take a couple of months before we release a new Spinnaker, but I will add this feature request to the list.

    Thank you,

    Demos

    0
  • Zhengyi Jiang

    Hi Demos,

    I'm sure Poll is still needed before GetValue on my machine. Otherwise, the following terminal output would not have printed 0.0.

    Grabbed Image 0 with gain: 0.0

    When Poll was added, it printed the values correctly.

    I am away from my work PC otherwise I would have pasted the new terminal output. I can do it on Monday if it can be of any help.

    I don't remember if it fixes the callback not firing issue because in my production code I am calling GetValue every 100 ms. I'd suppose the callback method is more efficient as it saves some overhead on looking up the node map?

    Thank you and have a nice weekend,

    Anthony

    0

Please sign in to leave a comment.

Powered by Zendesk