1 # Copyright (c) 2019-2020 NVIDIA CORPORATION. All rights reserved.
3 @page sensormanager_usecase1 Sensor Manager Workflow
5 @note SW Release Applicability: This tutorial is applicable to modules in both **NVIDIA DriveWorks** and **NVIDIA DRIVE Software** releases.
9 Before we can instantiate Sensor Manager, we need to declare and instantiate
10 NVIDIA<sup>®</sup> DriveWorks @ref core_usecase5 , Sensor Abstration Layer and @ref rig_mainsection :
13 dwContextHandle_t ctx = DW_NULL_HANDLE;
14 dwSALHandle_t sal = DW_NULL_HANDLE;
15 dwRigHandle_t rc = DW_NULL_HANDLE;
16 dwSensorManagerHandle_t sm = DW_NULL_HANDLE;
18 dwContextParameters ctxParams = {};
19 constexpr size_t poolSize = 16;
20 const dwSensorEvent * event = nullptr;
21 dwStatus ret = DW_SUCCESS;
23 ret = dwInitialize(&ctx, DW_VERSION, &ctxParams);
26 ret = dwSAL_initialize(&sal, ctx);
29 ret = dwRig_initializeFromFile(&rc, ctx, "rig.json");
33 Now we can initialize Sensor Manager and start the underlying sensors:
36 ret = dwSensorManager_initializeFromRig(&sm, rc, poolSize, sal);
39 ret = dwSensorManager_start(sm);
43 Once Sensor Manager object initialized and sensors are started, it is possible
44 to read events in a loop:
47 while (ret == DW_SUCCESS) {
48 ret = dwSensorManager_acquireNextEvent(&event, 0, sm);
51 switch (event->type) {
52 case DW_SENSOR_RADAR: /* Process Event */ break;
53 case DW_SENSOR_LIDAR: /* Process Event */ break;
54 case DW_SENSOR_CAN: /* Process Event */ break;
55 case DW_SENSOR_GPS: /* Process Event */ break;
56 case DW_SENSOR_IMU: /* Process Event */ break;
57 case DW_SENSOR_CAMERA: /* Process Event */ break;
60 ret = dwSensorManager_releaseAcquiredEvent(event, sm);
65 Clean-up procedure consists of stopping Sensor Manager and releasing the memory:
68 ret = dwSensorManager_stop(sm);
71 ret = dwSensorManager_release(&sm);
75 Similarly, DriveWorks @ref core_usecase5, SAL and @ref rig_mainsection objects must be
78 Sensor Manager is used in multiple samples:
79 - @ref dwx_camera_calibration_sample
80 - @ref dwx_imu_calibration_sample
81 - @ref dwx_lidar_calibration_sample
82 - @ref dwx_struct_from_motion_sample