DriveWorks SDK Reference
3.5.78 Release
For Test and Development only

rig/docs/usecase1.md
Go to the documentation of this file.
1 # Copyright (c) 2019-2020 NVIDIA CORPORATION. All rights reserved.
2 
3 @page rigconfiguration_usecase1 Accessing Vehicle Properties and Sensors From a Rig File
4 
5 @note SW Release Applicability: This tutorial is applicable to modules in both **NVIDIA DriveWorks** and **NVIDIA DRIVE Software** releases.
6 
7 The following code snippets shows the general structure of a program that uses a rig configuration and enumerate / query sensor properties.<br>
8 The rig module can be initialized from a rig file:
9 
10 ```{.cpp}
11 dwContextHandle_t contextHandle = DW_NULL_HANDLE;
12 dwRigHandle_t rigHandle = DW_NULL_HANDLE;
13 dwContextParameters contextParams{};
14 
15 dwInitialize(&contextHandle, DW_VERSION, &contextParams);
16 
17 dwRig_initializeFromFile(&rigHandle, contextHandle, rigconfigFilename);
18 ```
19 
20 Afterwards we can easily access the vehicle properties:
21 
22 ```{.cpp}
23 dwGenericVehicle vehicle;
24 dwRig_getGenericVehicle(&vehicle, rigHandle);
25 ```
26 
27 As well as all sensors contained in the file:
28 
29 ```{.cpp}
30 dwRig_getSensorCount(&sensorCount, ...);
31 for(uint32_t sensorID; sensorID < sensorCount; ++sensorID)
32 {
33  dwRig_getSensorProtocol(&sensorProtocol, sensorID, rigHandle);
34  dwRig_getSensorParameter(&sensorParameter, sensorID, rigHandle);
35  dwRig_getSensorName(&sensorName, sensorID, rigHandle);
36  dwRig_getNominalSensorToRigTransformation(&transformation, sensorID, rigHandle);
37  dwRig_getSensorToRigTransformation(&transformation, sensorID, rigHandle);
38 }
39 ```
40 
41 Finally we can release all handles:
42 
43 ```{.cpp}
44 dwRig_release(rigHandle);
45 dwRelease(contextHandle);
46 ```
47 
48 For the full implementation refer to @ref dwx_rig_sample