DriveWorks SDK Reference
4.0.0 Release
For Test and Development only

src/dw/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 
5 #### Get time synchronized lidar packets from live lidar sensor
6 
7 ```{.cpp}
8 dwSAL_initialize(&sal, sdk);
9 
10 dwSensorHandle_t timeSensor = DW_NULL_HANDLE;
11 dwSensorHandle_t lidarSensor = DW_NULL_HANDLE;
12 
13 dwSensorParams lidarParams;
14 lidarParams.parameters = "ip=192.168.3.43,port=2368,device=VELO_HDL64E,scan-frequency=10.0";
15 lidarParams.protocol = "lidar.socket";
16 dwSAL_createSensor(&lidarSensor, lidarParams, sal);
17 
18 dwSensorParams timeParams;
19 timeParams.parameters = "nvpps-device=/dev/nvpps0,reference-type=NOVATEL_CAN,can-device=can0";
20 timeParams.protocol = "time.nvpps";
21 dwSAL_createSensor(&timeSensor, timeParams, sal);
22 
23 dwSensor_start(timeSensor);
24 dwSensor_start(lidarSensor);
25 
26 while(loop) {
27  dwSensorLidar_readPacket(...);
28 
29  // CODE: use the time synchronized lidar packets for other tasks
30 
31  dwSensorLidar_returnPacket(...);
32 }
33 dwSensor_stop(...);
34 
35 dwSAL_releaseSensor(&timeSensor);
36 dwSAL_releaseSensor(&lidarSensor);
37 
38 ```
39 
40 This can also be done with sensor recordings. For example, we can modify the example above with the following parameters to reference recorded data.
41 
42 ```
43 lidarParams.parameters = "file=lidar_recording.bin";
44 lidarParams.protocol = "lidar.virtual";
45 
46 timeParams.parameters = "file=time_recording.bin";
47 timeParams.protocol = "time.virtual";
48 ```
49 
50 For more details see @ref dwx_time_sensor_sample