Page 1 of 1

Synchronization between external and internal VisionSensor

Posted: 26 Mar 2018, 10:59
by SkySurfer1

I have 2 BlobDetectionCameras in the same place. Camera1 acquires the images and does the blob detection as groundtruth. Via extApi I modify the image of camera1 and pass it to camera2 which is configured to use external input.
So far this works I get the detected blobs from both cameras.

But when I compare the values from the blob detection in sim_childscriptcall_actuation of the blob detection camera it seems that camera1 has already updated the result and camera2 still has the result form simulation step t-1.

What is the best way to synchronize those 2 outputs?

Re: Synchronization between external and internal VisionSensor

Posted: 03 Apr 2018, 06:28
by coppelia

if I understood you correctly, I would tag both vision sensors as explicit handling and handle them inside of a child script. Doing so, you can decide when to call sim.handleVisionSensor. You can then also give priorities to your scripts, to achieve the desired execution order (if they are located at an equivalent hierarchy position)

But at the same time, since you process one image externally, via the remote API, you will always be at least one simulation step behind - at least for visualization. Which is exactly your problem.

The only solution I see would be to delay the visualization of the first camera too. Or to use 3 vision sensors: the first would not have a visualization window. And you would send two images back from the remote API client: the original and the modified image.