How to use drivework to synchronize time with multiple cameras?

Please provide the following info (tick the boxes after creating this topic):
Software Version
DRIVE OS 6.0.8.1
DRIVE OS 6.0.6
DRIVE OS 6.0.5
DRIVE OS 6.0.4 (rev. 1)
DRIVE OS 6.0.4 SDK
other

Target Operating System
Linux
QNX
other

Hardware Platform
DRIVE AGX Orin Developer Kit (940-63710-0010-300)
DRIVE AGX Orin Developer Kit (940-63710-0010-200)
DRIVE AGX Orin Developer Kit (940-63710-0010-100)
DRIVE AGX Orin Developer Kit (940-63710-0010-D00)
DRIVE AGX Orin Developer Kit (940-63710-0010-C00)
DRIVE AGX Orin Developer Kit (not sure its number)
other

SDK Manager Version
1.9.3.10904
other

Host Machine Version
native Ubuntu Linux 20.04 Host installed with SDK Manager
native Ubuntu Linux 20.04 Host installed with DRIVE OS Docker Containers
native Ubuntu Linux 18.04 Host installed with DRIVE OS Docker Containers
other

How to use drivework to synchronize time with multiple cameras?

Dear @deng.shigang ,
Did you use recorder tool? Do you expect the timestamp to be exactly same for all cameras?When use recorder tool, I would expect some delay in the first frame capture of cameras. After that, it should capture frames at ~30fps. Please check adding time sensor in rig file to sync to PTP timestamp

@SivaRamaKrishnaNV We have two cameras and we want them to simultaneously capture images for stereo matching algorithms. I don’t know how to add a time sensor to the rig file.

Dear @deng.shigang,
Please check adding time sensor like below in rig file and confirm if PTP timestamp is noticed or TSC
{ "name": "time:nvpps:rec:00", "nominalSensor2Rig_FLU": { "roll-pitch-yaw": [ 0, 0, 0 ], "t": [ 0, 0, 0 ] }, "parameter": "reference-type=NONE,nvpps-device=/dev/nvpps0", "properties": null, "protocol": "time.nvpps" }

@SivaRamaKrishnaNV We have added the time sensor to the rig file, please help us check whether the addition is correct?
rig.txt (2.9 KB)
How to confirm if PTP timestamp is noticed if TSC?

@deng.shigang rig looks good to me. TSC timestamp gets reset after booting. So you can verify the time using the timestamp from https://www.epochconverter.com/ . Please use the timeStamp/1000000 value to covert to human readable date.
Could you share the recorder log output as well?

@SivaRamaKrishnaNV We didn’t use a recording tool. We wanted to write our own code to synchronize the timestamps of the two cameras. Now that we’ve configured the rig file and we’ve written the code to use drivework to get data from both cameras, how do we get the timestamps of both cameras to sync?

@deng.shigang could you share the noticed timestamps of each camera. Can you give a try with recorder tool and share the observation.

From Camera Interfaces | NVIDIA Docs, I see
SoC generates a TSC_EDGE_OUT signal on a GPIO pin that is connected to all deserializers. This common PWM signal is then forwarded to all 16 GMSL cameras to achieve frame synchronization

@SivaRamaKrishnaNV We’ll try to look at the time stamps on both cameras tomorrow. Can you tell me where that recording tool is? According to the above description, multiple cameras have automatically synchronized the timestamp, so do you still use dwSensorCamera_readFrame to read the data from each camera? Or is there another interface that can get data from multiple cameras at once?

@deng.shigang Please see DriveWorks SDK Reference: Basic Recording Tool for details on recorder tool.

You can check camera sample code for acquiring data from multiple cameras.

@SivaRamaKrishnaNV We modified the sample_camera example code to output each camera timestamp on the command line. From the results, the time stamps of the two cameras are very different, basically 0 or 1.
I want to ask about the difference between using the dwSensorCamera_readFrame and dwSensorManager_acquireNextEvent functions. I saw in some multi-sensor calibration examples that dwSensorManager_acquireNextEvent was used. Is this function used to synchronize multiple sensor timestamps?

sample_camera log:
camera0timestamp:3893211616 camera1timestamp:3893211616 deviation:0
[15-12-2023 06:55:29] GenericImage: generic image cuda
[15-12-2023 06:55:29] GenericImage: generic image cuda
[15-12-2023 06:55:29] GenericImage: generic image cuda
[15-12-2023 06:55:29] GenericImage: generic image cuda
[15-12-2023 06:55:29] GenericImage: generic image cuda
[15-12-2023 06:55:29] GenericImage: generic image cuda
camera0timestamp:3893244950 camera1timestamp:3893244949 deviation:1
[15-12-2023 06:55:29] GenericImage: generic image cuda
[15-12-2023 06:55:29] GenericImage: generic image cuda
[15-12-2023 06:55:29] GenericImage: generic image cuda
[15-12-2023 06:55:29] GenericImage: generic image cuda
[15-12-2023 06:55:29] GenericImage: generic image cuda
[15-12-2023 06:55:29] GenericImage: generic image cuda
camera0timestamp:3893278283 camera1timestamp:3893278282 deviation:1
[15-12-2023 06:55:29] GenericImage: generic image cuda
[15-12-2023 06:55:29] GenericImage: generic image cuda
[15-12-2023 06:55:29] GenericImage: generic image cuda
[15-12-2023 06:55:29] GenericImage: generic image cuda
[15-12-2023 06:55:29] GenericImage: generic image cuda
[15-12-2023 06:55:29] GenericImage: generic image cuda
camera0timestamp:3893311616 camera1timestamp:3893311616 deviation:0
[15-12-2023 06:55:29] GenericImage: generic image cuda
[15-12-2023 06:55:29] GenericImage: generic image cuda
[15-12-2023 06:55:29] GenericImage: generic image cuda
[15-12-2023 06:55:29] GenericImage: generic image cuda
[15-12-2023 06:55:29] GenericImage: generic image cuda
[15-12-2023 06:55:29] GenericImage: generic image cuda
camera0timestamp:3893344950 camera1timestamp:3893344949 deviation:1
[15-12-2023 06:55:29] GenericImage: generic image cuda
[15-12-2023 06:55:29] GenericImage: generic image cuda
[15-12-2023 06:55:29] GenericImage: generic image cuda
[15-12-2023 06:55:29] GenericImage: generic image cuda
[15-12-2023 06:55:29] GenericImage: generic image cuda
[15-12-2023 06:55:29] GenericImage: generic image cuda
camera0timestamp:3893378283 camera1timestamp:3893378282 deviation:1

@deng.shigang Note that when camera is running at 30FPS, we are sampling frame in every 33.33 msec. The timestamp difference between two cameras seems to be 1us. Few micro seconds gap can be ignored.

@SivaRamaKrishnaNV We tried to use dwSensorManager_acquireNextEvent to retrieve the data from both cameras, but we found that the while loop only executed once, can you help us see what is going on?
rig:rig.txt (2.9 KB)
code:main.txt (6.4 KB)
log:

MAX96712: Revision 5 detected
MAX96712 Link 0: PHY optimization was enabled
MAX96712 Link 1: PHY optimization was enabled
MAX96717: Revision 4 detected!
OX08D10 Driver Version: 1.1.1.0 build(May 8 2024 10:51:31)
OX08D10: Revision 0 (0x13) detected!
MAX96717: Revision 4 detected!
OX08D10 Driver Version: 1.1.1.0 build(May 8 2024 10:51:31)
OX08D10: Revision 0 (0x13) detected!
OX08D10: OX08D10SetDeviceConfig - 30FPS
SCCB_SetExpTime [0] 0.011000 01C6
SCCB_SetExpTime [2] 0.000014 0000
SCCB_SetExpTime [3] 0.011000 01C6
;[TpgEnabled] 0
;[charModeEnabled] 0
;[charModeExpNo ] 0
;[ numFrameReportBytes ] 0
;[ nnumActiveExposures ] 4
;[ frameTiming - tclk ] 102083333
;[ frameTiming - hts ] 2476
;[ frameTiming - vts ] 1374
;[ frameTiming - hsize ] 3840
;[ frameTiming - vsize ] 2160
;[ frameTiming - binning ] 0
;[ frameTiming - timeLine ] 2.425470e-05
;[ frameTiming - fps ] 30.0066
;[ mfCfg - Mirror Enable ] 0
;[ mfCfg - Flip Enable ] 0
;[ embCfg - TopEmb Enable ] 1
;[ embCfg - StatEmb Enable ] 1
;[ embCfg - BotEmb Enable ] 1
;[ embCfg - DataType Enable ] 0
;[ fsinCfg - Fsync Enable ] 1
;[ fsinCfg - Fix Counter Enable ] 1
;[ Static White Balance AutoSwitch ] 1
OX08D10: 8D10 (7,C2,3)
OX08D10 Get Sensitivity Ratio: FFFF 5475 02CD 5475
OX08D10: OX08D10SetDeviceConfig - 30FPS
SCCB_SetExpTime [0] 0.011000 01C6
SCCB_SetExpTime [2] 0.000014 0000
SCCB_SetExpTime [3] 0.011000 01C6
;[TpgEnabled] 0
;[charModeEnabled] 0
;[charModeExpNo ] 0
;[ numFrameReportBytes ] 0
;[ nnumActiveExposures ] 4
;[ frameTiming - tclk ] 102083333
;[ frameTiming - hts ] 2476
;[ frameTiming - vts ] 1374
;[ frameTiming - hsize ] 3840
;[ frameTiming - vsize ] 2160
;[ frameTiming - binning ] 0
;[ frameTiming - timeLine ] 2.425470e-05
;[ frameTiming - fps ] 30.0066
;[ mfCfg - Mirror Enable ] 0
;[ mfCfg - Flip Enable ] 0
;[ embCfg - TopEmb Enable ] 1
;[ embCfg - StatEmb Enable ] 1
;[ embCfg - BotEmb Enable ] 1
;[ embCfg - DataType Enable ] 0
;[ fsinCfg - Fsync Enable ] 1
;[ fsinCfg - Fix Counter Enable ] 1
;[ Static White Balance AutoSwitch ] 1
OX08D10: 8D10 (7,C2,3)
OX08D10 Get Sensitivity Ratio: FFFF 5283 02C6 5283
SCCB_SetExpTime [0] 0.011012 01C6
SCCB_SetExpTime [2] 0.000033 0001
SCCB_SetExpTime [0] 0.011012 01C6
SCCB_SetExpTime [2] 0.000033 0001
0lll

Dear @deng.shigang,
Does this issue still need support or can be closed?

can be closed

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.