DriveWorks SDK Reference
3.5.78 Release
For Test and Development only

sensors/time/docs/usecase1.md
Go to the documentation of this file.
1 # Copyright (c) 2019-2020, NVIDIA CORPORATION. All rights reserved.
2 
3 @page time_usecase1 Get Time Synchronized Data
4 @note SW Release Applicability: This tutorial is applicable to modules in both **NVIDIA DriveWorks** and **NVIDIA DRIVE Software** releases.
5 
6 #### Get time synchronized lidar packets from live lidar sensor
7 
8 ```{.cpp}
9 dwSAL_initialize(&sal, sdk);
10 
11 dwSensorHandle_t timeSensor = DW_NULL_HANDLE;
12 dwSensorHandle_t lidarSensor = DW_NULL_HANDLE;
13 
14 dwSensorParams lidarParams;
15 lidarParams.parameters = "ip=192.168.3.43,port=2368,device=VELO_HDL64E,scan-frequency=10.0";
16 lidarParams.protocol = "lidar.socket";
17 dwSAL_createSensor(&lidarSensor, lidarParams, sal);
18 
19 dwSensorParams timeParams;
20 timeParams.parameters = "nvpps-device=/dev/nvpps0,reference-type=NOVATEL_CAN,can-device=can0";
21 timeParams.protocol = "time.nvpps";
22 dwSAL_createSensor(&timeSensor, timeParams, sal);
23 
24 dwSensor_start(timeSensor);
25 dwSensor_start(lidarSensor);
26 
27 while(loop) {
28  dwSensorLidar_readPacket(...);
29 
30  // CODE: use the time synchronized lidar packets for other tasks
31 
32  dwSensorLidar_returnPacket(...);
33 }
34 dwSensor_stop(...);
35 
36 dwSAL_releaseSensor(&timeSensor);
37 dwSAL_releaseSensor(&lidarSensor);
38 
39 ```
40 
41 This can also be done with sensor recordings. For example, we can modify the example above with the following parameters to reference recorded data.
42 
43 ```
44 lidarParams.parameters = "file=lidar_recording.bin";
45 lidarParams.protocol = "lidar.virtual";
46 
47 timeParams.parameters = "file=time_recording.bin";
48 timeParams.protocol = "time.virtual";
49 ```
50 
51 For more details see @ref dwx_time_sensor_sample