- Welcome
- Getting Started With the NVIDIA DriveWorks SDK
- Modules
- Samples
- Tools
- Tutorials
- SDK Porting Guide
- DriveWorks API
- More
Defines sensor management interface layer.
Data Structures | |
struct | dwDispatcherParams |
Parameters for dispatcher, used to define some behaviors of dispatcher. More... | |
struct | dwSensorEvent |
Structure for returning data upon any sensor event. More... | |
struct | dwSensorManagerParams |
Parameters for sensor manager, used to create a sensor manager. More... | |
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 |
Handle of sensor manager. More... | |
typedef struct _dwUltrasonicEnvelope | dwUltrasonicEnvelope |
Not available as of current release. Will be added in future releases. 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_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 according to the assigned sensorIndex. 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 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_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, 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 const 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_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 *const cookie, dwSensorManagerHandle_t sm) |
Sets 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... | |
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... | |
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 timestamps of camera frames accumulated in a single event differ, in microsecond. |
dwTime_t | timeout | Timeout value to be used in dispatcher mode for virtual files, in microsecond. |
struct dwSensorEvent |
Data Fields | ||
---|---|---|
dwCameraFrameHandle_t | camFrames[DW_SENSORMANGER_MAX_CAMERAS] | An array saving all created camera's frame in this event. Users get the frame by 'sensorTypeIndex'. |
dwCANMessage | canFrame | CAN message frame in this event. |
const dwDataPacket * | dataFrame | dwDataPacket(see reference 15) in this event. |
dwGPSFrame | gpsFrame | GPS frame in this event. |
dwIMUFrame | imuFrame | IMU frame in this event. |
const dwLidarDecodedPacket * | lidFrame | Lidar decoded packet in this event. |
uint32_t | numCamFrames | The number of camera frames. |
const dwRadarScan * | radFrame | Radar scan in this event. |
const uint8_t * | rawData | Raw data in this event. |
size_t | rawDataSize | Raw data size in this event. |
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. |
const dwUltrasonicEnvelope * | ultrasonicFrame |
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.
|
bool | singleVirtualCameraGroup |
Whether to associate virtual cameras to individual 'camera-group's (default), or to a single 'camera-group' (in case no dedicated per sensor 'camera-group' is specified for a given camera sensor in its sensor parameters). Distinct groups for each virtual camera are beneficial if sensors were recorded within different groups / on different devices (as otherwise potential time-offsets can be introduced if all virtual cameras are treated as a single group), but some applications might expect virtual cameras to be associated to a single group |
#define DW_SENSORMANGER_MAX_CAMERAS 16U |
Definition at line 67 of file SensorManager.h.
#define DW_SENSORMANGER_MAX_NUM_SENSORS 64U |
Definition at line 69 of file SensorManager.h.
typedef void(* dwSensorManagerDispatcher_t) (const dwSensorEvent *, void *, dwStatus) |
Definition at line 166 of file SensorManager.h.
typedef struct dwSensorManagerObject* dwSensorManagerHandle_t |
Handle of sensor manager.
Definition at line 71 of file SensorManager.h.
typedef struct _dwUltrasonicEnvelope dwUltrasonicEnvelope |
Not available as of current release. Will be added in future releases.
Definition at line 74 of file SensorManager.h.
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 120 of file SensorManager.h.
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.
[out] | ev | A pointer to a pointer of the event to be acquired |
[in] | timeoutMicroSeconds | time threshold to bail out if no new event is available |
[in] | sm | SM handle instantiated by the caller |
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 | acquire successfully. |
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.
[in] | groupName | Specifies the group name for this camera |
[in] | siblingIndex | Specifies the sibling id for this camera (GMSL only) |
[in] | params | Specifies the parameters for sensor creation. |
[in] | clientData | Client data to be added for this sensor |
[in] | sm | SM handle instantiated by the caller |
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 | add successfully. |
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.
[in] | params | Specifies the parameters for sensor creation. |
[in] | clientData | Client data to be added for this sensor |
[in] | sm | SM handle instantiated by the caller |
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 | add successfully. |
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.
[out] | count | A pointer to return the number of sensors |
[in] | type | Type of sensor to return the count for |
[in] | sm | SM handle instantiated by the caller |
DW_INVALID_ARGUMENT | pointer to the count is null |
DW_INVALID_HANDLE | if provided SM handle is invalid. |
DW_SUCCESS | get successfully. |
DW_API_PUBLIC dwStatus dwSensorManager_getSensorClientData | ( | uint64_t * | cd, |
uint32_t | sensorIndex, | ||
dwSensorManagerHandle_t | sm | ||
) |
Gets sensor's clientData according to the assigned sensorIndex.
[out] | cd | Pointer to location where clientData shall be returned |
[in] | sensorIndex | Index of the sensor |
[in] | sm | SM handle instantiated by the caller |
DW_INVALID_ARGUMENT | pointer to the cd is null |
DW_INVALID_HANDLE | if provided SM handle is invalid. |
DW_SUCCESS | get successfully. |
DW_API_PUBLIC dwStatus dwSensorManager_getSensorHandle | ( | dwSensorHandle_t * | handle, |
uint32_t | sensorIndex, | ||
dwSensorManagerHandle_t | sm | ||
) |
Gets the sensor handle to the specified sensor.
[in] | handle | Pointer to location where handle shall be returned |
[in] | sensorIndex | Index of the sensor |
[in] | sm | SM handle instantiated by the caller |
DW_INVALID_ARGUMENT | pointer to the handle is null |
DW_INVALID_HANDLE | if provided SM handle is invalid. |
DW_SUCCESS | get successfully. |
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.
[out] | sensorIndex | Pointer to location where the sensor index should be returned |
[in] | type | Type of sensor being requested |
[in] | sensorTypeIndex | Index of the sensor as defined by the dwSensorType |
[in] | sm | SM handle instantiated by the caller |
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 | get successfully. |
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.
[out] | sensorTypeIndex | Pointer to location where the index of the sensor as defined by the dwSensorType should be returned |
[out] | type | Pointer to location where the type of sensor should be returned |
[in] | sensorIndex | Index of the sensor |
[in] | sm | SM handle instantiated by the caller |
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 | get successfully. |
DW_API_PUBLIC dwStatus dwSensorManager_initialize | ( | dwSensorManagerHandle_t * | sm, |
size_t | poolSize, | ||
dwSALHandle_t const | sal | ||
) |
Creates an instance of SensorManager module.
[out] | sm | A pointer to the sm handle will be returned here. |
[in] | poolSize | Size of the event pool to be allocated. Has to be greater than 0 |
[in] | sal | SAL handle instantiated by the caller |
DW_INVALID_ARGUMENT | if pointer to the SM handle is NULL. |
DW_INVALID_HANDLE | if provided contex/SAL handle is invalid. |
DW_SUCCESS | init successfully. |
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.
[out] | sm | A pointer to the sm handle will be returned here. |
[in] | rc | Rig Configuration handle |
[in] | poolSize | Size of the event pool to be allocated. Has to be greater than 0 |
[in] | sal | SAL handle instantiated by the caller |
DW_INVALID_ARGUMENT | if pointer to the SM handle or Rig Configuration 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 | init successfully. |
DW_API_PUBLIC dwStatus dwSensorManager_initializeFromRigWithParams | ( | dwSensorManagerHandle_t * | sm, |
dwRigHandle_t const | 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.
[out] | sm | A pointer to the sm handle will be returned here. |
[in] | rc | Rig Configuration handle |
[in] | params | Params to configure SensorManager |
[in] | poolSize | Size of the event pool to be allocated. Has to be greater than 0 |
[in] | sal | SAL handle instantiated by the caller |
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 | init successfully. |
DW_API_PUBLIC dwStatus dwSensorManager_release | ( | dwSensorManagerHandle_t | sm | ) |
Releases the SensorManager module by deleting the handle.
[out] | sm | The sensor manager handle that needs to be released |
DW_INVALID_HANDLE | if provided sm handle is invalid. |
DW_SUCCESS | release successfully. |
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.
[in] | ev | A pointer to the event to be returned |
[in] | sm | SM handle instantiated by the caller |
DW_INVALID_ARGUMENT | pointer to the event is null |
DW_INVALID_HANDLE | if provided SM handle is invalid. |
DW_SUCCESS | release successfully. |
DW_API_PUBLIC dwStatus dwSensorManager_reset | ( | dwSensorManagerHandle_t | sm | ) |
Resets all sensors.
All sensors's reset function will be called by the sensor manager.
[in] | sm | SM handle instantiated by the caller |
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 | reset successfully. |
DW_API_PUBLIC dwStatus dwSensorManager_setDispatcher | ( | dwSensorManagerDispatcher_t | dispatchPtr, |
void *const | cookie, | ||
dwSensorManagerHandle_t | sm | ||
) |
Sets sensor's dispatcher function when the feature is turned on.
[in] | dispatchPtr | dispatcher function pointer |
[in] | cookie | pointer of the the class object in which the dispatcher member function is defined |
[in] | sm | SM handle instantiated by the caller |
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 | set successfully. |
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.
[in] | timeout | Timeout in microseconds to wait for a new frame. |
[in] | sm | SM handle instantiated by the caller |
DW_INVALID_ARGUMENT | no function with that pointer exists |
DW_INVALID_HANDLE | if provided SM handle is invalid. |
DW_SUCCESS | set successfully. |
DW_API_PUBLIC dwStatus dwSensorManager_start | ( | dwSensorManagerHandle_t | sm | ) |
Starts all sensors.
Sensor manager will begin to read data and decode them after calling.
[in] | sm | SM handle instantiated by the caller |
DW_INVALID_HANDLE | if provided SM handle is invalid. |
DW_FAILURE | if the sensor already running |
DW_SUCCESS | start successfully. |
DW_API_PUBLIC dwStatus dwSensorManager_stop | ( | dwSensorManagerHandle_t | sm | ) |
Stops all sensors.
Sensor manager will stop to read data and decode them after calling.
[in] | sm | SM handle instantiated by the caller |
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 | stop successfully. |