DriveWorks SDK Reference
3.5.78 Release
For Test and Development only

SensorManager

Detailed Description

Defines sensor management interface layer.

Note
SW Release Applicability: These APIs are available in both NVIDIA DriveWorks and NVIDIA DRIVE Software releases.

Data Structures

struct  dwDispatcherParams
 
struct  dwSensorEvent
 Structure for returning data upon any sensor event. More...
 
struct  dwSensorManagerParams
 

Macros

#define DW_SENSORMANGER_MAX_CAMERAS   16U
 
#define DW_SENSORMANGER_MAX_NUM_SENSORS   64U
 

Typedefs

typedef void(* dwSensorManagerDispatcher_t) (const dwSensorEvent *, void *, dwStatus)
 
typedef struct dwSensorManagerObject * dwSensorManagerHandle_t
 

Enumerations

enum  dwSensorManagerDataMode {
  DW_SENSOR_MANAGER_DATA_MODE_NON_RAW = 0,
  DW_SENSOR_MANAGER_DATA_MODE_RAW = 1
}
 

Functions

DW_API_PUBLIC dwStatus dwSensorManager_acquireNextEvent (const dwSensorEvent **ev, dwTime_t timeoutMicroSeconds, dwSensorManagerHandle_t sm)
 Called by the application to consume the next available sensor event ready for consumption. More...
 
DW_API_PUBLIC dwStatus dwSensorManager_addCameraSensor (const char8_t *groupName, uint32_t siblingIndex, dwSensorParams params, uint64_t clientData, dwSensorManagerHandle_t sm)
 Adds a camera sensor to the SAL instance. More...
 
DW_API_PUBLIC dwStatus dwSensorManager_addSensor (dwSensorParams params, uint64_t clientData, dwSensorManagerHandle_t sm)
 Adds a sensor to the SAL instance. More...
 
DW_API_PUBLIC dwStatus dwSensorManager_getNumSensors (uint32_t *count, dwSensorType type, dwSensorManagerHandle_t sm)
 Gets the number of sensors instantiated for a given sensor type. More...
 
DW_API_PUBLIC dwStatus dwSensorManager_getSensorClientData (uint64_t *cd, uint32_t sensorIndex, dwSensorManagerHandle_t sm)
 Gets sensor's clientData. More...
 
DW_API_PUBLIC dwStatus dwSensorManager_getSensorHandle (dwSensorHandle_t *handle, uint32_t sensorIndex, dwSensorManagerHandle_t sm)
 Gets the sensor handle to the specified sensor. More...
 
DW_API_PUBLIC dwStatus dwSensorManager_getSensorIndex (uint32_t *sensorIndex, dwSensorType type, uint32_t sensorTypeIndex, dwSensorManagerHandle_t sm)
 Gets sensor's index. More...
 
DW_API_PUBLIC dwStatus dwSensorManager_getSensorTypeIndex (uint32_t *sensorTypeIndex, dwSensorType *type, uint32_t sensorIndex, dwSensorManagerHandle_t sm)
 Gets sensor's relative index and type based upon its sensor index. More...
 
DW_API_PUBLIC dwStatus dwSensorManager_initialize (dwSensorManagerHandle_t *sm, size_t poolSize, dwSALHandle_t sal)
 Creates and initializes a SensorManager module. More...
 
DW_API_PUBLIC dwStatus dwSensorManager_initializeFromRig (dwSensorManagerHandle_t *sm, dwRigHandle_t rc, size_t poolSize, dwSALHandle_t sal)
 Creates and initializes a SensorManager module, adding all sensors in the provided Rig Configuration. More...
 
DW_API_PUBLIC dwStatus dwSensorManager_initializeFromRigWithParams (dwSensorManagerHandle_t *sm, dwRigHandle_t rc, const dwSensorManagerParams *params, size_t poolSize, dwSALHandle_t sal)
 Creates and initializes a SensorManager module, adding enabled sensors in the provided Rig Configuration, and configuring SensorManager according to params provided. More...
 
DW_API_PUBLIC dwStatus dwSensorManager_release (dwSensorManagerHandle_t sm)
 Releases the SensorManager module. More...
 
DW_API_PUBLIC dwStatus dwSensorManager_releaseAcquiredEvent (const dwSensorEvent *ev, dwSensorManagerHandle_t sm)
 Releases a previously acquired event back to the pool. More...
 
DW_API_PUBLIC dwStatus dwSensorManager_reset (dwSensorManagerHandle_t sm)
 Resets all sensors. More...
 
DW_API_PUBLIC dwStatus dwSensorManager_setDispatcher (dwSensorManagerDispatcher_t dispatchPtr, void *cookie, dwSensorManagerHandle_t sm)
 Sets sensor's dispatcher function when the feature is turned on. More...
 
DW_API_PUBLIC dwStatus dwSensorManager_start (dwSensorManagerHandle_t sm)
 Starts all sensors. More...
 
DW_API_PUBLIC dwStatus dwSensorManager_stop (dwSensorManagerHandle_t sm)
 Stops all sensors. More...
 

Data Structure Documentation

◆ dwDispatcherParams

struct dwDispatcherParams
Data Fields
bool accumCamFrames Whether Dispatcher shall accumulated frames from all cameras into a single event.
dwTime_t camFramesTimeDiffLimit Up to how much can timstamps of camera frames accumulated in a single event differ.
dwTime_t timeout Timeout value to be used in dispatcher mode for virtual files.

◆ dwSensorEvent

struct dwSensorEvent
Data Fields
dwCameraFrameHandle_t camFrames[DW_SENSORMANGER_MAX_CAMERAS]
dwCANMessage canFrame
const dwDataPacket * dataFrame
dwGPSFrame gpsFrame Data accessor for all other sensors.
dwIMUFrame imuFrame
const dwLidarDecodedPacket * lidFrame
uint32_t numCamFrames Data accessor for camera.
const dwRadarScan * radFrame
const uint8_t * rawData
size_t rawDataSize
uint32_t sensorIndex The index of the sensor as defined by the order in which it was created.

If the sensor manager was created via the rig configuration file this will match that sensor index. If it was not created via the rig configuration will be the number of sensors already created

uint32_t sensorIndices[DW_SENSORMANGER_MAX_CAMERAS] If the event is a multisensor event then the sensor indices of all sensors involved will be stored here.
uint32_t sensorTypeIndex Index of the given sensor as defined by the order in which it was created and the type of sensor it is (ie Camera and Lidar can have sensorTypeIndex 0 because they are different sensor types.
dwTime_t timestamp_us Timestamp (us)
dwSensorType type Type of sensor providing data for this event.

◆ dwSensorManagerParams

struct dwSensorManagerParams
Data Fields
dwDispatcherParams dispatcherParams Parameters to configure dispatcher mode.
uint32_t enableSensors[DW_SENSORMANGER_MAX_NUM_SENSORS] List of sensors indices to be enabled during initialization (i.e. whitelist)
uint32_t numEnableSensors Number of entries in the 'enableSensors' list.
Note
if this number is 0 all sensors will be enabled

Macro Definition Documentation

◆ DW_SENSORMANGER_MAX_CAMERAS

#define DW_SENSORMANGER_MAX_CAMERAS   16U

Definition at line 66 of file SensorManager.h.

◆ DW_SENSORMANGER_MAX_NUM_SENSORS

#define DW_SENSORMANGER_MAX_NUM_SENSORS   64U

Definition at line 67 of file SensorManager.h.

Typedef Documentation

◆ dwSensorManagerDispatcher_t

typedef void(* dwSensorManagerDispatcher_t) (const dwSensorEvent *, void *, dwStatus)

Definition at line 137 of file SensorManager.h.

◆ dwSensorManagerHandle_t

typedef struct dwSensorManagerObject* dwSensorManagerHandle_t

Definition at line 69 of file SensorManager.h.

Enumeration Type Documentation

◆ dwSensorManagerDataMode

Enumerator
DW_SENSOR_MANAGER_DATA_MODE_NON_RAW 
DW_SENSOR_MANAGER_DATA_MODE_RAW 

Definition at line 108 of file SensorManager.h.

Function Documentation

◆ dwSensorManager_acquireNextEvent()

DW_API_PUBLIC dwStatus dwSensorManager_acquireNextEvent ( const dwSensorEvent **  ev,
dwTime_t  timeoutMicroSeconds,
dwSensorManagerHandle_t  sm 
)

Called by the application to consume the next available sensor event ready for consumption.

The method will return the oldest available event among all sensors.

Parameters
[out]evA pointer to a pointer of the event to be acquired
[in]timeoutMicroSecondstime threshold to bail out if no new event is available
[in]smSM handle instantiated by the caller
Returns
DW_INVALID_ARGUMENT - pointer to the dwSensorEvent point is null
DW_INVALID_HANDLE - if provided SM handle is invalid.
DW_BUFFER_FULL - all event buffers are currently being used
DW_TIME_OUT - no new event was available within timeout period
DW_END_OF_STREAM - reached end of all sensor streams
DW_SUCCESS

◆ dwSensorManager_addCameraSensor()

DW_API_PUBLIC dwStatus dwSensorManager_addCameraSensor ( const char8_t groupName,
uint32_t  siblingIndex,
dwSensorParams  params,
uint64_t  clientData,
dwSensorManagerHandle_t  sm 
)

Adds a camera sensor to the SAL instance.

All addCameraSensor() calls must be completed before the start() call.

Parameters
[in]groupNameSpecifies the group name for this camera
[in]siblingIndexSpecifies the sibling id for this camera (GMSL only)
[in]paramsSpecifies the parameters for sensor creation.
[in]clientDataClient data to be added for this sensor
[in]smSM handle instantiated by the caller
Returns
DW_INVALID_HANDLE - if provided SM handle is invalid.
DW_SAL_NO_DRIVER_FOUND - if provided protocol name is unknown.
DW_SAL_SENSOR_ERROR - if a non recoverable error happens during sensor creation. For a virtual sensor which is reading from a file it could be file I/O error.
DW_INVALID_ARGUMENT - if the sensor parameters are invalid or incomplete.
DW_FILE_NOT_FOUND - if a specified video or other file parameter cannot be found.
DW_SUCCESS
Note
This method will perform memory allocations

◆ dwSensorManager_addSensor()

DW_API_PUBLIC dwStatus dwSensorManager_addSensor ( dwSensorParams  params,
uint64_t  clientData,
dwSensorManagerHandle_t  sm 
)

Adds a sensor to the SAL instance.

All addSensor() calls must be completed before the start() call.

Parameters
[in]paramsSpecifies the parameters for sensor creation.
[in]clientDataClient data to be added for this sensor
[in]smSM handle instantiated by the caller
Returns
DW_INVALID_HANDLE - if provided SM handle is invalid.
DW_SAL_NO_DRIVER_FOUND - if provided protocol name is unknown.
DW_SAL_SENSOR_ERROR - if a non recoverable error happens during sensor creation. For a virtual sensor which is reading from a file it could be file I/O error.
DW_SUCCESS
Note
This method will perform memory allocations

◆ dwSensorManager_getNumSensors()

DW_API_PUBLIC dwStatus dwSensorManager_getNumSensors ( uint32_t *  count,
dwSensorType  type,
dwSensorManagerHandle_t  sm 
)

Gets the number of sensors instantiated for a given sensor type.

Parameters
[out]countA pointer to return the number of sensors
[in]typeType of sensor to return the count for
[in]smSM handle instantiated by the caller
Returns
DW_INVALID_ARGUMENT - pointer to the count is null
DW_INVALID_HANDLE - if provided SM handle is invalid.
DW_SUCCESS

◆ dwSensorManager_getSensorClientData()

DW_API_PUBLIC dwStatus dwSensorManager_getSensorClientData ( uint64_t *  cd,
uint32_t  sensorIndex,
dwSensorManagerHandle_t  sm 
)

Gets sensor's clientData.

Parameters
[out]cdPointer to location where clientData shall be returned
[in]sensorIndexIndex of the sensor
[in]smSM handle instantiated by the caller
Returns
DW_INVALID_ARGUMENT - pointer to the cd is null
DW_INVALID_HANDLE - if provided SM handle is invalid.
DW_SUCCESS

◆ dwSensorManager_getSensorHandle()

DW_API_PUBLIC dwStatus dwSensorManager_getSensorHandle ( dwSensorHandle_t handle,
uint32_t  sensorIndex,
dwSensorManagerHandle_t  sm 
)

Gets the sensor handle to the specified sensor.

Parameters
[in]handlePointer to location where handle shall be returned
[in]sensorIndexIndex of the sensor
[in]smSM handle instantiated by the caller
Returns
DW_INVALID_ARGUMENT - pointer to the handle is null
DW_INVALID_HANDLE - if provided SM handle is invalid.
DW_SUCCESS

◆ dwSensorManager_getSensorIndex()

DW_API_PUBLIC dwStatus dwSensorManager_getSensorIndex ( uint32_t *  sensorIndex,
dwSensorType  type,
uint32_t  sensorTypeIndex,
dwSensorManagerHandle_t  sm 
)

Gets sensor's index.

Parameters
[out]sensorIndexPointer to location where the sensor index should be returned
[in]typeType of sensor being requested
[in]sensorTypeIndexIndex of the sensor as defined by the dwSensorType
[in]smSM handle instantiated by the caller
Returns
DW_INVALID_ARGUMENT - pointer to the sensorIndex is null or no sensor of that type and index exists
DW_INVALID_HANDLE - if provided SM handle is invalid.
DW_SUCCESS

◆ dwSensorManager_getSensorTypeIndex()

DW_API_PUBLIC dwStatus dwSensorManager_getSensorTypeIndex ( uint32_t *  sensorTypeIndex,
dwSensorType type,
uint32_t  sensorIndex,
dwSensorManagerHandle_t  sm 
)

Gets sensor's relative index and type based upon its sensor index.

Parameters
[out]sensorTypeIndexPointer to location where the index of the sensor as defined by the dwSensorType should be returned
[out]typePointer to location where the type of sensor should be returned
[in]sensorIndexIndex of the sensor
[in]smSM handle instantiated by the caller
Returns
DW_INVALID_ARGUMENT - pointer to the sensorTypeIndex or type is null or no sensorIndex exists
DW_INVALID_HANDLE - if provided SM handle is invalid.
DW_SUCCESS

◆ dwSensorManager_initialize()

DW_API_PUBLIC dwStatus dwSensorManager_initialize ( dwSensorManagerHandle_t sm,
size_t  poolSize,
dwSALHandle_t  sal 
)

Creates and initializes a SensorManager module.

Parameters
[out]smA pointer to the sm handle will be returned here.
[in]poolSizeSize of the event pool to be allocated. Has to be greater than 0
[in]salSAL handle instantiated by the caller
Returns
DW_INVALID_ARGUMENT - if pointer to the SM handle is NULL.
DW_INVALID_HANDLE - if provided contex/SAL handle is invalid.
DW_SUCCESS

◆ dwSensorManager_initializeFromRig()

DW_API_PUBLIC dwStatus dwSensorManager_initializeFromRig ( dwSensorManagerHandle_t sm,
dwRigHandle_t  rc,
size_t  poolSize,
dwSALHandle_t  sal 
)

Creates and initializes a SensorManager module, adding all sensors in the provided Rig Configuration.

Parameters
[out]smA pointer to the sm handle will be returned here.
[in]rcRig Configuration handle
[in]poolSizeSize of the event pool to be allocated. Has to be greater than 0
[in]salSAL handle instantiated by the caller
Returns
DW_INVALID_ARGUMENT - if pointer to the SM handle is NULL.
DW_INVALID_HANDLE - if provided contex/SAL handle is invalid.
DW_SAL_NO_DRIVER_FOUND - if provided protocol name is unknown.
DW_SAL_SENSOR_ERROR - if a non recoverable error happens during
sensor creation. For a virtual sensor
which is reading from a file it could be
file I/O error.
DW_SUCCESS

◆ dwSensorManager_initializeFromRigWithParams()

DW_API_PUBLIC dwStatus dwSensorManager_initializeFromRigWithParams ( dwSensorManagerHandle_t sm,
dwRigHandle_t  rc,
const dwSensorManagerParams params,
size_t  poolSize,
dwSALHandle_t  sal 
)

Creates and initializes a SensorManager module, adding enabled sensors in the provided Rig Configuration, and configuring SensorManager according to params provided.

Parameters
[out]smA pointer to the sm handle will be returned here.
[in]rcRig Configuration handle
[in]paramsParams to configure SensorManager
[in]poolSizeSize of the event pool to be allocated. Has to be greater than 0
[in]salSAL handle instantiated by the caller
Returns
DW_INVALID_ARGUMENT - if pointer to the SM handle is NULL.
DW_INVALID_HANDLE - if provided contex/SAL handle is invalid.
DW_SAL_NO_DRIVER_FOUND - if provided protocol name is unknown.
DW_SAL_SENSOR_ERROR - if a non recoverable error happens during
sensor creation. For a virtual sensor
which is reading from a file it could be
file I/O error.
DW_SUCCESS

◆ dwSensorManager_release()

DW_API_PUBLIC dwStatus dwSensorManager_release ( dwSensorManagerHandle_t  sm)

Releases the SensorManager module.

Parameters
[out]smThe sensor manager handle that needs to be released
Returns
DW_INVALID_HANDLE - if provided sm handle is invalid.
DW_SUCCESS

◆ dwSensorManager_releaseAcquiredEvent()

DW_API_PUBLIC dwStatus dwSensorManager_releaseAcquiredEvent ( const dwSensorEvent ev,
dwSensorManagerHandle_t  sm 
)

Releases a previously acquired event back to the pool.

For certain sensors, this call will also trigger returning the backing buffer back to the DW sensor bufferpools.

Parameters
[in]evA pointer to the event to be returned
[in]smSM handle instantiated by the caller
Returns
DW_INVALID_ARGUMENT - pointer to the event is null
DW_INVALID_HANDLE - if provided SM handle is invalid.
DW_SUCCESS

◆ dwSensorManager_reset()

DW_API_PUBLIC dwStatus dwSensorManager_reset ( dwSensorManagerHandle_t  sm)

Resets all sensors.

Parameters
[in]smSM handle instantiated by the caller
Returns
DW_INVALID_HANDLE - if provided SM handle is invalid.
DW_FAILURE - if the sensor is tried to be reset while it is still running
DW_SUCCESS

◆ dwSensorManager_setDispatcher()

DW_API_PUBLIC dwStatus dwSensorManager_setDispatcher ( dwSensorManagerDispatcher_t  dispatchPtr,
void *  cookie,
dwSensorManagerHandle_t  sm 
)

Sets sensor's dispatcher function when the feature is turned on.

Parameters
[in]dispatchPtrdispatcher function pointer
[in]cookiepointer of the the class object in which the dispatcher member function is defined
[in]smSM handle instantiated by the caller
Returns
DW_INVALID_ARGUMENT - pointer to the dispatchPtr is null or no function with that pointer exists
DW_INVALID_HANDLE - if provided SM handle is invalid.
DW_SUCCESS

◆ dwSensorManager_start()

DW_API_PUBLIC dwStatus dwSensorManager_start ( dwSensorManagerHandle_t  sm)

Starts all sensors.

Parameters
[in]smSM handle instantiated by the caller
Returns
DW_INVALID_HANDLE - if provided SM handle is invalid.
DW_FAILURE - if the sensor already running
DW_SUCCESS

◆ dwSensorManager_stop()

DW_API_PUBLIC dwStatus dwSensorManager_stop ( dwSensorManagerHandle_t  sm)

Stops all sensors.

Parameters
[in]smSM handle instantiated by the caller
Returns
DW_INVALID_HANDLE - if provided SM handle is invalid.
DW_FAILURE - if the sensor is not running and is tried to be stopped
DW_SUCCESS