View Full Version : freshImage() routine anomaly
boya3706
06-02-2010, 14:05
We need an asynchronous method of checking (from Java) to see that a new a new image is available from the camera. The documentation implies that the method freshImage() serves that purpose. However, it does NOT.
The documentation for the freshImage() method in the AxisCamera class says that its return value should be "true if the latest image from the camera has not been retrieved yet". The implication is that the return value will sometimes be false. However, our observation is that freshImage() always returns a value of true -- evidently because it actually waits for AxisCamera to have a new image.
Is there an asynchronous method (from Java) of checking that a new image is available from the camera?
We need an asynchronous method of checking (from Java) to see that a new a new image is available from the camera. The documentation implies that the method freshImage() serves that purpose. However, it does NOT.
The documentation for the freshImage() method in the AxisCamera class says that its return value should be "true if the latest image from the camera has not been retrieved yet". The implication is that the return value will sometimes be false. However, our observation is that freshImage() always returns a value of true -- evidently because it actually waits for AxisCamera to have a new image.
Is there an asynchronous method (from Java) of checking that a new image is available from the camera?
I'm not sure if it used to block, but it doesn't in the current version. At least the C++ part of it doesn't. Is there something in the Java code that is waiting?
Have you updated to the latest (Feb 3rd or so) Java update?
boya3706
07-02-2010, 10:29
I haven't seen a java update for FRC posted on any site.... would you mind posting a link for it?
boya3706
08-02-2010, 21:01
JHersh, thanks for the reply. We finally figured it out. freshImage() is indeed working correctly.
At first, the problem was that our processing loop was running very long compared to the camera refresh rate. In that circumstance, of course, freshImage() would always return true.
Then, we commented out all the processing code -- including getImage(). We didn't realize that it was the call to getImage() had a side-effect that impacts freshImage(). Once we put the call to getImage() back into the code, a subsequent call to freshImage() indeed returned false.
Our apologies if we confused anyone. freshImage() has NO anomoalous behavior.
vBulletin® v3.6.4, Copyright ©2000-2017, Jelsoft Enterprises Ltd.