Synchronization between external and internal VisionSensor

Typically: "How do I... ", "How can I... " questions
Post Reply
SkySurfer1
Posts: 10
Joined: 14 Mar 2016, 14:34

Synchronization between external and internal VisionSensor

Post by SkySurfer1 » 26 Mar 2018, 10:59

Hi,

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?

coppelia
Site Admin
Posts: 7388
Joined: 14 Dec 2012, 00:25

Re: Synchronization between external and internal VisionSensor

Post by coppelia » 03 Apr 2018, 06:28

Hello,

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.

Cheers

Post Reply