Random image flipping in CARLA/UE4
Okay, in case anybody ever has the same problem, here's what I found out:
the client was running too fast in relation to the server. I limited the client side to 30fps now and that fixed it. This issue will only occur if the tick rate of the client is so high that it has trouble keeping up while running the calculations in the background.
I still can't figure out why the image is upside down in that case, but hey...
I am working with Carla 0.9.9 in Unreal 4.24 (Windows10/RTX2080) right now in order to get some basic autonomous driving functions going. So far it seems to be working fine, but I have a weird problem and I'm quite confident that it's not caused by my code. I've googled around and this problem seems to be quite unique, but maybe one of you guys can point me in the right direction:
I am displaying a few steps of my lane detection algorithm in different windows (e.g. ROI, detected lines...), and every few seconds, depending on the current framerate, the image will randomly flip to being upside down in some of the windows (only one at a time and only for a single/few frames), except for the main window where I am controlling the car (manually for now). I've tried setting the Unreal Editor to different framerates, and there is definitely a connection between the output framerate (server side) and the amount of these "flips" happening, to the point where it's almost never happening if I run it at 15-20fps. There is also some "tearing" going on (e.g. only roughly the upper half of the image is flipped, like Vsynch is switched off) sometimes, which leads me to believe that the root cause is somewhere in the rendering part and not the python scripts. The point is: when the image is upside down, my lane detection is seeing the "lane" in the wrong place, which could lead to all sorts of trouble down the line.
To be honest I'm not that familiar with the whole Unreal Engine/DirectX(?)-rendering pipeline, so I am a little lost what might be causing this issue. I'm grateful for any ideas on how to fix this, thanks in advance!