Need help on syncsensor example

is it guarantee that syncsensor with ScopedCudaEGLStreamFrameAcquire can get exact same instance with 0ms time lag?

hi nvidia/argus developer,

with below code, how can we guarantee that it is synchronized where the code is executed sequentially.
i don’t see any binding between camera 1&2 for master and slave or what ever it is.
btw, after captured, how to get raw image out from m_frame? and to display it by preview consumer, i found some example using NvNativeBuffer to grab the plane and then convert by opencv, but it is slow.
anyone can advise how to do fix DMA mapping without any copying or conversion and then can be used to publish via ROS.
thanks.

bool StereoDisparityConsumerThread::threadExecute()
{
    CONSUMER_PRINT("Waiting for Argus producer to connect to left stream.\n");
    m_leftStream->waitUntilConnected();

    CONSUMER_PRINT("Waiting for Argus producer to connect to right stream.\n");
    m_rightStream->waitUntilConnected();

    CONSUMER_PRINT("Streams connected, processing frames.\n");
    unsigned int histogramLeft[HISTOGRAM_BINS];
    unsigned int histogramRight[HISTOGRAM_BINS];
    while (true)
    {
        ScopedCudaEGLStreamFrameAcquire left(m_cuStreamLeft);
        ScopedCudaEGLStreamFrameAcquire right(m_cuStreamRight);
ScopedCudaEGLStreamFrameAcquire::ScopedCudaEGLStreamFrameAcquire(CUeglStreamConnection& connection)
    : m_connection(connection)
    , m_stream(NULL)
    , m_resource(0)
{
    CUresult r = cuEGLStreamConsumerAcquireFrame(&m_connection, &m_resource, &m_stream, -1);
    if (r == CUDA_SUCCESS)
    {
        cuGraphicsResourceGetMappedEglFrame(&m_frame, m_resource, 0, 0);
    }
}

No guarantee for that.
You need to check if your HW support sensor sync, and also need to check the timestamp to sync them if your HW can support it.

You can reference to below link for synchronization.

hi Shane,
thanks for reply, if HW is sync.
which api to grab both the images?

must i set both camera on trigger mode? meaning if i don’t acquire image, the camera is not running, hence it will not overwrite the buffer in the DMA. so that when i copy image from DMA, it is confirm that both image is same instance triggered by hardware.

Current no support trigger mode, only support streaming mode. The AP must check the timestamp to sync them. The above link should have more information about it.

ah i see. you are more knowledgable than others. thanks for your info.