API C++ error reading COG_X, COG_Y
Nemanya Sedoglavich from United States  [14 posts]
4 years

I'm having issues reliably reading COG_X and COG_Y strings through API (C++). I found this by reading the two strings and converting them into integers array. Then I looked for the condition where COG_X array does not equal COG_Y array and display the strings as well as arrays. Every so many frames it would run into the array/string size mismatch.

What could be causing this problems? Are the COG_X and COG_Y getting updated while the API is grabbing the values and therefore resulting in different size arrays if a blob disappears from one frame to the next?

How should I deal with this?

Steven Gentner from United States  [1370 posts] 4 years

Yes, that is very possible that the arrays are different if you are using two getVariable calls. The updates are stopped while the getVariable is executing but is continued between the network calls. As network interactions are much slower than internal processing its very possible (esp with a fast pipeline) that variables will update between getVariable calls. So if you want to ensure atomic variable reads (i.e. read all variables at the same time) you have to use the get_variables (i.e. plural) function.

What language are you using again? In C/C++ it would be the rr.getVariables function.

Nemanya Sedoglavich from United States  [14 posts] 4 years
Thanks STeven,

That worked perfectly!


This forum thread has been closed due to inactivity (more than 4 months) or number of replies (more than 50 messages). Please start a New Post and enter a new forum thread with the appropriate title.

 New Post   Forum Index