DriveWorks SDK Reference

| 0.6.67 Release

SensorManager

Detailed Description

Defines sensor management interface layer.

Data Structures

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

Macros

#define DW_SENSORMANGER_MAX_CAMERAS   6U
 

Typedefs

typedef struct dwSensorManagerObject * dwSensorManagerHandle_t
 

Functions

DW_API_PUBLIC dwStatus dwSensorManager_acquireNextEvent (const dwSensorEvent **ev, dwTime_t timeout_us, 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 char *groupName, size_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 (size_t *count, dwSensorType type, dwSensorManagerHandle_t sm)
 Gets the number of sensors instantiated for a given sensor type. More...
 
DW_API_PUBLIC dwStatus dwSensorManager_getSensorHandle (dwSensorHandle_t *handle, dwSensorType type, size_t index, dwSensorManagerHandle_t sm)
 Gets the sensor handle to the specified sensor. 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_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_start (dwSensorManagerHandle_t sm)
 Starts all sensors. More...
 
DW_API_PUBLIC dwStatus dwSensorManager_stop (dwSensorManagerHandle_t sm)
 Stops all sensors. More...
 

Data Structure Documentation

◆ dwSensorEvent

struct dwSensorEvent
Data Fields
dwCameraFrameHandle_t camFrames[DW_SENSORMANGER_MAX_CAMERAS]
dwCANMessage canFrame
uint64_t clientData[DW_SENSORMANGER_MAX_CAMERAS]
dwGPSFrame gpsFrame Data accessor for all other sensors.
dwIMUFrame imuFrame
const dwLidarDecodedPacket * lidFrame
size_t numCamFrames Data accessor for camera.
const dwRadarScan * radFrame
uint32_t sensorId Index of the given sensor (aligns w/ sensor count)
dwTime_t timestamp_us Timestamp (us)
dwSensorType type Type of sensor providing data for this event.

Macro Definition Documentation

◆ DW_SENSORMANGER_MAX_CAMERAS

#define DW_SENSORMANGER_MAX_CAMERAS   6U

Definition at line 60 of file SensorManager.h.

Typedef Documentation

◆ dwSensorManagerHandle_t

typedef struct dwSensorManagerObject* dwSensorManagerHandle_t

Definition at line 62 of file SensorManager.h.

Function Documentation

◆ dwSensorManager_acquireNextEvent()

DW_API_PUBLIC dwStatus dwSensorManager_acquireNextEvent ( const dwSensorEvent **  ev,
dwTime_t  timeout_us,
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 amonst all sensors.

Parameters
[out]evA pointer to a pointer of the event to be acquired
[in]timeout_ustime 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 availble within timeout period
DW_END_OF_STREAM - reached end of camera stream (video only)
DW_SUCCESS

◆ dwSensorManager_addCameraSensor()

DW_API_PUBLIC dwStatus dwSensorManager_addCameraSensor ( const char *  groupName,
size_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 passed w/ each event 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_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 passed w/ each event 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 ( size_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_getSensorHandle()

DW_API_PUBLIC dwStatus dwSensorManager_getSensorHandle ( dwSensorHandle_t handle,
dwSensorType  type,
size_t  index,
dwSensorManagerHandle_t  sm 
)

Gets the sensor handle to the specified sensor.

Parameters
[in]handlePointer to location where handle shall be returned
[in]typeType of sensor being requested
[in]indexIndex of the sensor
[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_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
[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_release()

DW_API_PUBLIC dwStatus dwSensorManager_release ( dwSensorManagerHandle_t sm)

Releases the SensorManager module.

Parameters
[out]smA pointer to the sm handle will be returned here.
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_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_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_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_SUCCESS