DriveWorks SDK Reference
4.0.0 Release
For Test and Development only

src/dw/rig/doc_public/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 The following code snippets shows the general structure of a program that uses a rig configuration and enumerate / query sensor properties.<br>
6 The rig module can be initialized from a rig file:
7 
8 ```{.cpp}
9 dwContextHandle_t contextHandle = DW_NULL_HANDLE;
10 dwRigHandle_t rigHandle = DW_NULL_HANDLE;
11 dwContextParameters contextParams{};
12 
13 dwInitialize(&contextHandle, DW_VERSION, &contextParams);
14 
15 dwRig_initializeFromFile(&rigHandle, contextHandle, rigconfigFilename);
16 ```
17 
18 Afterwards we can easily access the vehicle properties:
19 
20 ```{.cpp}
21 dwGenericVehicle vehicle;
22 dwRig_getGenericVehicle(&vehicle, rigHandle);
23 ```
24 
25 As well as all sensors contained in the file:
26 
27 ```{.cpp}
28 dwRig_getSensorCount(&sensorCount, ...);
29 for(uint32_t sensorID; sensorID < sensorCount; ++sensorID)
30 {
31  dwRig_getSensorProtocol(&sensorProtocol, sensorID, rigHandle);
32  dwRig_getSensorParameter(&sensorParameter, sensorID, rigHandle);
33  dwRig_getSensorName(&sensorName, sensorID, rigHandle);
34  dwRig_getNominalSensorToRigTransformation(&transformation, sensorID, rigHandle);
35  dwRig_getSensorToRigTransformation(&transformation, sensorID, rigHandle);
36 }
37 ```
38 
39 Finally we can release all handles:
40 
41 ```{.cpp}
42 dwRig_release(rigHandle);
43 dwRelease(contextHandle);
44 ```
45 
46 For the full implementation refer to @ref dwx_rig_sample