DriveWorks SDK Reference
3.5.78 Release
For Test and Development only

Sensor Manager Workflow
Note
SW Release Applicability: This tutorial is applicable to modules in both NVIDIA DriveWorks and NVIDIA DRIVE Software releases.

Workflow

Before we can instantiate Sensor Manager, we need to declare and instantiate NVIDIA® DriveWorks Context , Sensor Abstration Layer and Rig Configuration :

dwContextParameters ctxParams = {};
constexpr size_t poolSize = 16;
const dwSensorEvent * event = nullptr;
dwStatus ret = DW_SUCCESS;
ret = dwInitialize(&ctx, DW_VERSION, &ctxParams);
checkError(ret);
ret = dwSAL_initialize(&sal, ctx);
checkError(ret);
ret = dwRig_initializeFromFile(&rc, ctx, "rig.json");
checkError(ret);

Now we can initialize Sensor Manager and start the underlying sensors:

ret = dwSensorManager_initializeFromRig(&sm, rc, poolSize, sal);
checkError(ret);
checkError(ret);

Once Sensor Manager object initialized and sensors are started, it is possible to read events in a loop:

while (ret == DW_SUCCESS) {
ret = dwSensorManager_acquireNextEvent(&event, 0, sm);
checkError(ret);
switch (event->type) {
case DW_SENSOR_RADAR: /* Process Event */ break;
case DW_SENSOR_LIDAR: /* Process Event */ break;
case DW_SENSOR_CAN: /* Process Event */ break;
case DW_SENSOR_GPS: /* Process Event */ break;
case DW_SENSOR_IMU: /* Process Event */ break;
case DW_SENSOR_CAMERA: /* Process Event */ break;
}
checkError(ret);
}

Clean-up procedure consists of stopping Sensor Manager and releasing the memory:

checkError(ret);
checkError(ret);

Similarly, DriveWorks Context, SAL and Rig Configuration objects must be released at the end.

Sensor Manager is used in multiple samples: