NVIDIA DriveOS Linux NSR SDK API Reference

7.0.3.0 Release

Detailed Description

Defines sensor management interface layer.

Data Structures

struct  dwSensorEvent
 Structure for returning data upon any sensor event. More...
 
struct  dwDispatcherParams
 Parameters for dispatcher, used to define some behaviors of dispatcher. More...
 
struct  dwSensorManagerParams
 Parameters for sensor manager, used to create a sensor manager. More...
 

Typedefs

typedef struct dwSensorManagerObject * dwSensorManagerHandle_t
 Handle of sensor manager. More...
 
typedef struct dwUltrasonicEnvelope dwUltrasonicEnvelope
 Not available as of current release. Will be added in future releases. More...
 
typedef struct dwUltrasonicFrame dwUltrasonicFrame
 
typedef dwLidarDecodedPacket dwLidarDecodedPacket_t
 
typedef void(* dwSensorManagerDispatcher_t) (const dwSensorEvent *, void *, dwStatus)
 function pointer of sensormanager dispatcher. More...
 

Enumerations

enum  dwSensorManagerDataMode {
  DW_SENSOR_MANAGER_DATA_MODE_NON_RAW = 0,
  DW_SENSOR_MANAGER_DATA_MODE_RAW = 1
}
 Data mode in this unit, which determines whether read raw data. More...
 

Functions

DW_API_PUBLIC dwStatus dwSensorManager_initialize (dwSensorManagerHandle_t *sm, size_t poolSize, dwSALHandle_t const sal)
 Creates an instance of SensorManager module. More...
 
DW_API_PUBLIC dwStatus dwSensorManager_initializeFromRig (dwSensorManagerHandle_t *sm, dwConstRigHandle_t rc, size_t poolSize, dwSALHandle_t sal)
 Create and initialize a SensorManager module, adding all sensors in the provided Rig Configuration. More...
 
DW_API_PUBLIC dwStatus dwSensorManager_initializeFromRigWithParams (dwSensorManagerHandle_t *sm, dwConstRigHandle_t rc, const dwSensorManagerParams *params, size_t poolSize, dwSALHandle_t const 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 by deleting the handle. More...
 
DW_API_PUBLIC dwStatus dwSensorManager_addSensor (dwSensorParams params, uint64_t clientData, dwSensorManagerHandle_t sm)
 Adds a sensor to the SAL instance and add it to SensorManager to manage it. 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 and add it to SensorManager to manage it. 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...
 
DW_API_PUBLIC dwStatus dwSensorManager_reset (dwSensorManagerHandle_t sm)
 Resets all sensors. More...
 
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_releaseAcquiredEvent (const dwSensorEvent *ev, dwSensorManagerHandle_t sm)
 Releases a previously acquired event back to the pool. More...
 
DW_API_PUBLIC dwStatus dwSensorManager_getNumSensors (uint32_t *count, dwSensorType type, dwSensorManagerHandle_t sm)
 Gets the number of sensors in the SensorManager instantiated for a given sensor type. 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_getSensorClientData (uint64_t *cd, uint32_t sensorIndex, dwSensorManagerHandle_t sm)
 Gets sensor's clientData according to the assigned sensorIndex. More...
 
DW_API_PUBLIC dwStatus dwSensorManager_getSensorIndex (uint32_t *sensorIndex, dwSensorType type, uint32_t sensorTypeIndex, dwSensorManagerHandle_t sm)
 Gets sensor's index according to the dwSensorType and the sensorTypeIndex. 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_setDispatcher (dwSensorManagerDispatcher_t dispatchPtr, void *const cookie, dwSensorManagerHandle_t sm)
 Register sensor's dispatcher function when the feature is turned on. More...
 
DW_API_PUBLIC dwStatus dwSensorManager_setTimeout (dwTime_t timeout, dwSensorManagerHandle_t sm)
 Sets the timeout to wait for a new frame across all sensors. More...
 

Typedef Documentation

◆ dwLidarDecodedPacket_t

Definition at line 61 of file SensorManager.h.

◆ dwSensorManagerDispatcher_t

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

function pointer of sensormanager dispatcher.

Definition at line 155 of file SensorManager.h.

◆ dwSensorManagerHandle_t

typedef struct dwSensorManagerObject* dwSensorManagerHandle_t

Handle of sensor manager.

Definition at line 52 of file SensorManager.h.

◆ dwUltrasonicEnvelope

Not available as of current release. Will be added in future releases.

Definition at line 55 of file SensorManager.h.

◆ dwUltrasonicFrame

Definition at line 56 of file SensorManager.h.

Enumeration Type Documentation

◆ dwSensorManagerDataMode

Data mode in this unit, which determines whether read raw data.

Enumerator
DW_SENSOR_MANAGER_DATA_MODE_NON_RAW 

Sensor manager doesn't read raw data, but just offer decoded packet for users.

DW_SENSOR_MANAGER_DATA_MODE_RAW 

Sensor manager will read only raw data.

Definition at line 109 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
Return values
DW_INVALID_ARGUMENTpointer to the dwSensorEvent point is null
DW_INVALID_HANDLEif provided SM handle is invalid.
DW_BUFFER_FULLall event buffers are currently being used
DW_TIME_OUTno new event was available within timeout period
DW_END_OF_STREAMreached end of all sensor streams
DW_SUCCESSacquire successfully.
API Group
  • Init: Yes
  • Runtime: Yes
  • De-Init: Yes

◆ 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 and add it to SensorManager to manage it.

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. This parameters is assigned by users and saved with sensors added.
[in]smSM handle instantiated by the caller
Return values
DW_INVALID_HANDLEif provided SM handle is invalid.
DW_SAL_NO_DRIVER_FOUNDif provided protocol name is unknown.
DW_SAL_SENSOR_ERRORif 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_ARGUMENTif the sensor parameters are invalid or incomplete.
DW_FILE_NOT_FOUNDif a specified video or other file parameter cannot be found.
DW_SUCCESSadd successfully.
DW_CALL_NOT_ALLOWEDaddSensor cannot add sensor while running
Note
This method will perform memory allocations.
API Group
  • Init: Yes
  • Runtime: Yes
  • De-Init: Yes

◆ dwSensorManager_addSensor()

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

Adds a sensor to the SAL instance and add it to SensorManager to manage it.

All addSensor calls must be completed before the dwSensorManager_start call.

Parameters
[in]paramsSpecifies the parameters for sensor creation.
[in]clientDataClient data to be added for this sensor. This parameters is assigned by users and saved with sensors added.
[in]smSM handle instantiated by the caller
Return values
DW_INVALID_HANDLEif provided SM handle is invalid.
DW_SAL_NO_DRIVER_FOUNDif provided protocol name is unknown.
DW_SAL_SENSOR_ERRORif 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_SUCCESSadd successfully.
DW_CALL_NOT_ALLOWEDaddSensor cannot add sensor while running
Note
This method will perform memory allocations.
API Group
  • Init: Yes
  • Runtime: Yes
  • De-Init: Yes

◆ dwSensorManager_getNumSensors()

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

Gets the number of sensors in the SensorManager 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
Return values
DW_INVALID_ARGUMENTpointer to the count is null
DW_INVALID_HANDLEif provided SM handle is invalid.
DW_SUCCESSget successfully.
API Group
  • Init: Yes
  • Runtime: Yes
  • De-Init: Yes

◆ dwSensorManager_getSensorClientData()

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

Gets sensor's clientData according to the assigned sensorIndex.

Parameters
[out]cdPointer to location where clientData shall be returned
[in]sensorIndexIndex of the sensor. This index can refers to sensorIndex in dwSensorEvent.
[in]smSM handle instantiated by the caller
Return values
DW_INVALID_ARGUMENTpointer to the cd is null
DW_INVALID_HANDLEif provided SM handle is invalid.
DW_SUCCESSget successfully.
API Group
  • Init: Yes
  • Runtime: Yes
  • De-Init: Yes

◆ 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. This index can refers to sensorIndex in dwSensorEvent.
[in]smSM handle instantiated by the caller
Return values
DW_INVALID_ARGUMENTpointer to the handle is null
DW_INVALID_HANDLEif provided SM handle is invalid.
DW_SUCCESSget successfully.
API Group
  • Init: Yes
  • Runtime: Yes
  • De-Init: Yes

◆ dwSensorManager_getSensorIndex()

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

Gets sensor's index according to the dwSensorType and the sensorTypeIndex.

Parameters
[out]sensorIndexPointer to location where the sensor index should be returned. This index can refers to sensorIndex in dwSensorEvent.
[in]typeType of sensor being requested
[in]sensorTypeIndexIndex of the sensor as defined by the dwSensorType. This index can refers to sensorTypeIndex in dwSensorEvent.
[in]smSM handle instantiated by the caller
Return values
DW_INVALID_ARGUMENTpointer to the sensorIndex is null or no sensor of that type and index exists
DW_INVALID_HANDLEif provided SM handle is invalid.
DW_SUCCESSget successfully.
API Group
  • Init: Yes
  • Runtime: Yes
  • De-Init: Yes

◆ 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. This index can refers to sensorTypeIndex in dwSensorEvent.
[out]typePointer to location where the type of sensor should be returned
[in]sensorIndexIndex of the sensor. This index can refers to sensorIndex in dwSensorEvent.
[in]smSM handle instantiated by the caller
Return values
DW_INVALID_ARGUMENTpointer to the sensorTypeIndex or type is null or no sensorIndex exists
DW_INVALID_HANDLEif provided SM handle is invalid.
DW_SUCCESSget successfully.
API Group
  • Init: Yes
  • Runtime: Yes
  • De-Init: Yes

◆ dwSensorManager_initialize()

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

Creates an instance of SensorManager module.

Parameters
[out]smA pointer to the sm handle will be returned here.
[in]poolSizeSize of the internal event pool to be allocated. Has to be greater than 0
[in]salSAL handle instantiated by the caller
Return values
DW_INVALID_ARGUMENTif pointer to the SM handle is NULL.
DW_INVALID_HANDLEif provided context/SAL handle is invalid.
DW_SUCCESSinit successfully.
API Group
  • Init: Yes
  • Runtime: No
  • De-Init: No

◆ dwSensorManager_initializeFromRig()

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

Create and initialize a SensorManager module, adding all sensors in the provided Rig Configuration.

That means SensorManager will create all enabled sensors in the Rig Configuration and add them to SensorManager handle created by this api in order to manage them in SensorManager.

Parameters
[out]smA pointer to the sm handle will be returned here.
[in]rcRig Configuration handle
[in]poolSizeSize of the internal event pool to be allocated. Has to be greater than 0
[in]salSAL handle instantiated by the caller
Return values
DW_INVALID_ARGUMENTif pointer to the SM handle or Rig Configuration handle is NULL.
DW_INVALID_HANDLEif provided context/SAL handle is invalid.
DW_SAL_NO_DRIVER_FOUNDif provided protocol name is unknown.
DW_SAL_SENSOR_ERRORif 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_SUCCESSinit successfully.
API Group
  • Init: Yes
  • Runtime: No
  • De-Init: No

◆ dwSensorManager_initializeFromRigWithParams()

DW_API_PUBLIC dwStatus dwSensorManager_initializeFromRigWithParams ( dwSensorManagerHandle_t sm,
dwConstRigHandle_t  rc,
const dwSensorManagerParams params,
size_t  poolSize,
dwSALHandle_t const  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 internal event pool to be allocated. Has to be greater than 0
[in]salSAL handle instantiated by the caller
Return values
DW_INVALID_ARGUMENTif pointer to the SM handle is NULL.
DW_INVALID_HANDLEif provided context/SAL handle is invalid.
DW_SAL_NO_DRIVER_FOUNDif provided protocol name is unknown.
DW_SAL_SENSOR_ERRORif 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_SUCCESSinit successfully.
Note
This method will perform memory allocations.
API Group
  • Init: Yes
  • Runtime: No
  • De-Init: No

◆ dwSensorManager_release()

DW_API_PUBLIC dwStatus dwSensorManager_release ( dwSensorManagerHandle_t  sm)

Releases the SensorManager module by deleting the handle.

Parameters
[out]smThe sensor manager handle that needs to be released. This handle is created before by 'dwSensorManager_initialize/dwSensorManager_initializeFromRig/dwSensorManager_initializeFromRigWithParams'.
Return values
DW_INVALID_HANDLEif provided sm handle is invalid.
DW_SUCCESSrelease successfully.
Note
This API implements the function by calling the deleteUniqueCHandle.
API Group
  • Init: Yes
  • Runtime: No
  • De-Init: Yes

◆ 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
Return values
DW_INVALID_ARGUMENTpointer to the event is null
DW_INVALID_HANDLEif provided SM handle is invalid.
DW_SUCCESSrelease successfully.
API Group
  • Init: Yes
  • Runtime: No
  • De-Init: Yes

◆ dwSensorManager_reset()

DW_API_PUBLIC dwStatus dwSensorManager_reset ( dwSensorManagerHandle_t  sm)

Resets all sensors.

All sensors's reset function will be called by the sensor manager.

Parameters
[in]smSM handle instantiated by the caller
Return values
DW_INVALID_HANDLEif provided SM handle is invalid.
DW_FAILUREif the sensor is tried to be reset while it is still running
DW_SUCCESSreset successfully.
API Group
  • Init: Yes
  • Runtime: Yes
  • De-Init: Yes

◆ dwSensorManager_setDispatcher()

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

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

When users register a dispatcher function. Once an event is already, the function registered will be called. That means SensorManager will help users to deal events using the function registered. Users needn't to call dwSensorManager_acquireNextEvent to acquire event and deal it.

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
Return values
DW_INVALID_ARGUMENTpointer to the dispatchPtr is null or no function with that pointer exists
DW_INVALID_HANDLEif provided SM handle is invalid.
DW_SUCCESSRegister successfully.
API Group
  • Init: Yes
  • Runtime: Yes
  • De-Init: Yes

◆ dwSensorManager_setTimeout()

DW_API_PUBLIC dwStatus dwSensorManager_setTimeout ( dwTime_t  timeout,
dwSensorManagerHandle_t  sm 
)

Sets the timeout to wait for a new frame across all sensors.

Should be called before dwSensorManager_start.

Parameters
[in]timeoutTimeout in microseconds to wait for a new frame.
[in]smSM handle instantiated by the caller
Return values
DW_INVALID_ARGUMENTSM handle is nullptr
DW_INVALID_HANDLEif provided SM handle is invalid.
DW_SUCCESSset successfully.
API Group
  • Init: Yes
  • Runtime: Yes
  • De-Init: Yes

◆ dwSensorManager_start()

DW_API_PUBLIC dwStatus dwSensorManager_start ( dwSensorManagerHandle_t  sm)

Starts all sensors.

Sensor manager will begin to read data and decode them after calling.

Parameters
[in]smSM handle instantiated by the caller
Return values
DW_INVALID_HANDLEif provided SM handle is invalid.
DW_FAILUREif the sensor already running
DW_SUCCESSstart successfully.
API Group
  • Init: Yes
  • Runtime: Yes
  • De-Init: Yes

◆ dwSensorManager_stop()

DW_API_PUBLIC dwStatus dwSensorManager_stop ( dwSensorManagerHandle_t  sm)

Stops all sensors.

Sensor manager will stop to read data and decode them after calling.

Parameters
[in]smSM handle instantiated by the caller
Return values
DW_INVALID_HANDLEif provided SM handle is invalid.
DW_FAILUREif the sensor is not running and is tried to be stopped
DW_SUCCESSstop successfully.
API Group
  • Init: Yes
  • Runtime: Yes
  • De-Init: Yes