Setting frame rate to a negative value (-1) should make your application run as fast as it can…
ok, thanks. nice to know!
check that data are not accumulating in the TCP IP queue. One sign for it is delays increasing with
time. If that’s the case, modify your polling to retrieve all the data and drop all of them but the last one
(the newest!)
That’s what I was doing pretty much…on the second thought no, I was getting the first, so the oldest! That might explain some lag! But still I can see that I’m not pulling data fast enough, which led me to conclusion that function is not get called fast enough. Sometimes it’s truncated in the middle of the packet. With netcat connecting to the same port, I have no delays and data seems all fine.
if the delay seems constant, then you have to compensate for the speed of the frame. You should
anticipate the position of your frame when the image will be drawn using its current speed
Exactly ). That’s what I plan to do next. I already tested the compensation (fixed for now) and seems to work fine. it’s constant. But I still need a separate thread to pull encoder data quickly and calculate the speed based on the reading.
PS. Btw: currently my TCP protocol is very inefficient… it’s ASCII. So it’s “1239:1294-1234:1235-…”. I could pack them into binary, it will take 10 times less bits, but at the same time I doubt that this causes any lag. What do you think ?