DriveWorks SDK Reference
5.4.5418 Release
For Test and Development only

Sensors.h
Go to the documentation of this file.
1 //
3 // Notice
4 // ALL NVIDIA DESIGN SPECIFICATIONS AND CODE ("MATERIALS") ARE PROVIDED "AS IS" NVIDIA MAKES
5 // NO REPRESENTATIONS, WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
6 // THE MATERIALS, AND EXPRESSLY DISCLAIMS ANY IMPLIED WARRANTIES OF NONINFRINGEMENT,
7 // MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
8 //
9 // NVIDIA CORPORATION & AFFILIATES assumes no responsibility for the consequences of use of such
10 // information or for any infringement of patents or other rights of third parties that may
11 // result from its use. No license is granted by implication or otherwise under any patent
12 // or patent rights of NVIDIA CORPORATION & AFFILIATES. No third party distribution is allowed unless
13 // expressly authorized by NVIDIA. Details are subject to change without notice.
14 // This code supersedes and replaces all information previously supplied.
15 // NVIDIA CORPORATION & AFFILIATES products are not authorized for use as critical
16 // components in life support devices or systems without express written approval of
17 // NVIDIA CORPORATION & AFFILIATES.
18 //
19 // SPDX-FileCopyrightText: Copyright (c) 2016-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
20 // SPDX-License-Identifier: LicenseRef-NvidiaProprietary
21 //
22 // NVIDIA CORPORATION, its affiliates and licensors retain all intellectual
23 // property and proprietary rights in and to this material, related
24 // documentation and any modifications thereto. Any use, reproduction,
25 // disclosure or distribution of this material and related documentation
26 // without an express license agreement from NVIDIA CORPORATION or
27 // its affiliates is strictly prohibited.
28 //
30 
54 #ifndef DW_SENSORS_SENSORS_H_
55 #define DW_SENSORS_SENSORS_H_
56 
57 #include <dw/core/base/Exports.h>
58 #include <dw/core/base/Types.h>
61 
62 #ifdef __cplusplus
63 extern "C" {
64 #endif
65 
67 typedef enum dwPlatformOS {
70 
73 
76 
79 } dwPlatformOS;
80 
82 typedef struct dwSALObject* dwSALHandle_t;
83 
85 typedef struct dwSensorObject* dwSensorHandle_t;
86 
88 #define DW_SENSOR_MAX_PROTOCOL_NAME_LENGTH 32
89 #define DW_SENSOR_MAX_PARAMETER_STRING_LENGTH 512
91 
93 typedef struct dwSensorParams
94 {
98  const char8_t* protocol;
99 
106 
112  const void* auxiliarydata;
113 
115 
117 typedef struct dwSensorStats
118 {
120  uint64_t events;
121 
123  uint64_t errors;
124 
126  uint64_t drops;
127 
131 
135 
139 
142 
145 
146 } dwSensorStats;
147 
149 typedef enum dwSensorType {
160 } dwSensorType;
161 
164 {
167 
169  uint64_t event;
170 
172  uint64_t offset;
173 
175  uint64_t size;
176 
178 
179 //Holds the available seek table entries for the sensor
180 typedef struct dwSensorSeekTable
181 {
182  size_t numEntries;
183  uint64_t* timestamp;
184  uint64_t* offset;
185  uint64_t* frameNum;
186  size_t* frameSize;
188 
201 dwStatus dwSAL_initialize(dwSALHandle_t* const sal, dwContextHandle_t const context);
202 
214 dwStatus dwSAL_reset(dwSALHandle_t const sal);
215 
229 dwStatus dwSAL_release(dwSALHandle_t const sal);
230 
250 dwStatus dwSAL_createSensor(dwSensorHandle_t* const sensor, dwSensorParams const params, dwSALHandle_t const sal);
251 
268 dwStatus dwSAL_releaseSensor(dwSensorHandle_t const sensor);
269 
284 dwStatus dwSAL_start(dwSALHandle_t const sal);
285 
297 dwStatus dwSAL_getPlatform(dwPlatformOS* const os, dwSALHandle_t sal);
298 
311 dwStatus dwSAL_getPlatformInfo(char8_t const** const osName, dwPlatformOS const os, dwSALHandle_t const sal);
312 
328 dwStatus dwSAL_getNumSensors(uint32_t* const num, dwPlatformOS const os, dwSALHandle_t const sal);
329 
343 dwStatus dwSAL_getSensorProtocol(const char** const name, uint32_t const idx, dwPlatformOS const os, dwSALHandle_t const sal);
344 
361 dwStatus dwSAL_getSensorParameterString(const char** const parameters, uint32_t const idx,
362  dwPlatformOS const os, dwSALHandle_t const sal);
363 
384 dwStatus dwSensor_start(dwSensorHandle_t const sensor);
385 
397 dwStatus dwSensor_stop(dwSensorHandle_t const sensor);
398 
412 dwStatus dwSensor_reset(dwSensorHandle_t const sensor);
413 
437 dwStatus dwSensor_readRawData(const uint8_t** const data, size_t* const size,
438  dwTime_t const timeoutUs,
439  dwSensorHandle_t const sensor);
440 
455 dwStatus dwSensor_returnRawData(const uint8_t* const data, dwSensorHandle_t const sensor);
456 
473 dwStatus dwSensor_getSeekRange(size_t* const eventCount,
474  dwTime_t* const startTimestampUs, dwTime_t* const endTimestampUs,
475  dwSensorHandle_t const sensor);
476 
491 dwStatus dwSensor_getCurrentSeekPosition(size_t* const event, dwSensorHandle_t const sensor);
492 
493 /*
494  * Returns a pointer to the shared buffer with the contents of the sensor header and bufferSize
495  * will contain the number of valid bytes in the buffer.
496  *
497  * @param[out] - buffer A pointer to the buffer owned by sensor which holds the header information.
498  * @param[out] - bufferSize A pointer to variable indicating number of valid bytes in the buffer
499  * @param[in] - sensor Handle to the sensor to which the header info is requested
500  *
501  * @return DW_INVALID_HANDLE - if given sensor handle is invalid
502  * DW_INVALID_ARGUMENTS - if given arguments are invalid
503  * DW_SUCCESS
504  */
505 dwStatus dwSensor_getHeader(uint8_t const** const buffer, size_t* bufferSize, dwSensorHandle_t const sensor);
506 
524 dwStatus dwSensor_seekToTime(dwTime_t const timestampUs, dwSensorHandle_t const sensor);
525 
542 dwStatus dwSensor_seekToEvent(size_t const event, dwSensorHandle_t const sensor);
543 
562 dwStatus dwSensor_createSeekTable(dwSensorHandle_t const sensor);
563 
577 dwStatus dwSensor_getNumSeekTableEntries(size_t* const size, dwSensorHandle_t const hsensor);
578 
595 dwStatus dwSensor_getSeekTableEntries(dwSensorSeekTableEntry* const entries, size_t const numEntries, dwSensorHandle_t const sensor);
596 
621 dwStatus dwSensor_saveSeekTable(const char* const fileName, dwSensorHandle_t const sensor);
622 
644 dwStatus dwSensor_setThreadPriority(int32_t const priority, dwSensorHandle_t const sensor);
645 
666 dwStatus dwSensor_setThreadAffinity(uint32_t const affinityMask, dwSensorHandle_t const sensor);
667 
680 dwStatus dwSensor_getStats(dwSensorStats* const stats, dwSensorHandle_t const sensor);
681 
682 #ifdef __cplusplus
683 }
684 #endif
685 
687 #endif // DW_SENSORS_SENSORS_H_
NVIDIA DriveWorks API: Core Types
DW_API_PUBLIC dwStatus dwSensor_seekToTime(dwTime_t const timestampUs, dwSensorHandle_t const sensor)
Seeks the sensor to a specific timestamp, for sensors that support seeking.
DW_API_PUBLIC dwStatus dwSensor_getSeekRange(size_t *const eventCount, dwTime_t *const startTimestampUs, dwTime_t *const endTimestampUs, dwSensorHandle_t const sensor)
Retrieves the valid range of seek parameters, for sensors that support seeking.
Holds sets of parameters for sensor creation.
Definition: Sensors.h:93
dwTime_t timeDeltaMax
Maximum observed time difference between two consecutive packets.
Definition: Sensors.h:138
uint64_t * timestamp
Definition: Sensors.h:183
DW_API_PUBLIC dwStatus dwSensor_saveSeekTable(const char *const fileName, dwSensorHandle_t const sensor)
Saves the seek table for the sensor to a file, for sensors that support seek tables.
dwSensorType
Defines the type of sensors that are available in DriveWorks.
Definition: Sensors.h:149
DW_API_PUBLIC dwStatus dwSensor_getNumSeekTableEntries(size_t *const size, dwSensorHandle_t const hsensor)
Get the number of entries in the seek Table.
dwTime_t timeDeltaMin
Minimum observed time difference between two consecutive packets.
Definition: Sensors.h:134
const void * auxiliarydata
Additional data to pass to sensor creation function.
Definition: Sensors.h:112
Holds the available statistics for a sensor.
Definition: Sensors.h:117
DW_API_PUBLIC dwStatus dwSAL_getPlatformInfo(char8_t const **const osName, dwPlatformOS const os, dwSALHandle_t const sal)
Gets detailed information about the running hardware platform and operating system.
uint64_t size
size of the event present in the virtual data file, in bytes
Definition: Sensors.h:175
DW_API_PUBLIC dwStatus dwSensor_stop(dwSensorHandle_t const sensor)
Stops the sensor.
size_t numEntries
Definition: Sensors.h:182
aarch64 based Drive 5 QNX.
Definition: Sensors.h:75
A seek structure is made of memory offset, eventcount and timestamp.
Definition: Sensors.h:163
DW_API_PUBLIC dwStatus dwSensor_readRawData(const uint8_t **const data, size_t *const size, dwTime_t const timeoutUs, dwSensorHandle_t const sensor)
Reads RAW data from sensor as byte array.
DW_API_PUBLIC dwStatus dwSAL_reset(dwSALHandle_t const sal)
Resets the SAL (sensor abstraction layer) module.
aarch64 based Drive 5 Linux.
Definition: Sensors.h:72
uint64_t drops
Number of events dropped.
Definition: Sensors.h:126
uint64_t events
Number of normal events (excluding errors and drops).
Definition: Sensors.h:120
double float64_t
Definition: Types.h:71
DW_API_PUBLIC dwStatus dwSensor_seekToEvent(size_t const event, dwSensorHandle_t const sensor)
Seeks the sensor to an event, for sensors that support seeking.
DW_API_PUBLIC dwStatus dwSensor_setThreadPriority(int32_t const priority, dwSensorHandle_t const sensor)
Sets the priority of the internal thread, for sensors that use an internal thread to communicate to t...
struct dwSensorObject * dwSensorHandle_t
Handle representing a sensor.
Definition: Sensors.h:85
DW_API_PUBLIC dwStatus dwSensor_createSeekTable(dwSensorHandle_t const sensor)
Forces recreation of the seek table, for sensors that support seeking.
dwStatus
Status definition.
Definition: Status.h:180
uint64_t offset
offset into a file of this event
Definition: Sensors.h:172
dwStatus dwSensor_getHeader(uint8_t const **const buffer, size_t *bufferSize, dwSensorHandle_t const sensor)
uint64_t * frameNum
Definition: Sensors.h:185
DW_API_PUBLIC dwStatus dwSensor_setThreadAffinity(uint32_t const affinityMask, dwSensorHandle_t const sensor)
Sets the affinity of the internal thread, for sensors that use an internal thread to communicate to t...
int64_t dwTime_t
Specifies a timestamp unit, in microseconds.
Definition: Types.h:82
DW_API_PUBLIC dwStatus dwSAL_getSensorProtocol(const char **const name, uint32_t const idx, dwPlatformOS const os, dwSALHandle_t const sal)
Gets protocol name of a sensor for a given index, e.g., &#39;camera.gmsl&#39; or &#39;can.file&#39;.
DW_API_PUBLIC dwStatus dwSAL_getPlatform(dwPlatformOS *const os, dwSALHandle_t sal)
Gets current platform the SDK is running on.
size_t * frameSize
Definition: Sensors.h:186
uint64_t * offset
Definition: Sensors.h:184
DW_API_PUBLIC dwStatus dwSAL_release(dwSALHandle_t const sal)
Releases the SAL (sensor abstraction layer) module.
DW_API_PUBLIC dwStatus dwSensor_reset(dwSensorHandle_t const sensor)
Resets the sensor.
dwTime_t timeDeltaCur
Current time difference between two consecutive packets.
Definition: Sensors.h:130
dwTime_t timestamp
timestamp of this entry
Definition: Sensors.h:166
dwPlatformOS
Defines the operating system in use.
Definition: Sensors.h:67
struct dwSALObject * dwSALHandle_t
Handle representing the Sensor Abstraction Layer interface.
Definition: Sensors.h:82
DW_API_PUBLIC dwStatus dwSAL_getNumSensors(uint32_t *const num, dwPlatformOS const os, dwSALHandle_t const sal)
Gets number of available sensors for a platform.
DW_API_PUBLIC dwStatus dwSAL_initialize(dwSALHandle_t *const sal, dwContextHandle_t const context)
Creates and initializes a SAL (sensor abstraction layer) module.
Default Linux based platform.
Definition: Sensors.h:69
uint64_t event
counter of this event
Definition: Sensors.h:169
struct dwContextObject * dwContextHandle_t
Context handle.
Definition: Context.h:79
NVIDIA DriveWorks API: Core Methods
char char8_t
Definition: Types.h:72
DW_API_PUBLIC dwStatus dwSensor_start(dwSensorHandle_t const sensor)
Starts the sensor previously successfully created with &#39;dwSAL_createSensor()&#39;.
Number of available platforms.
Definition: Sensors.h:78
DW_API_PUBLIC dwStatus dwSensor_getSeekTableEntries(dwSensorSeekTableEntry *const entries, size_t const numEntries, dwSensorHandle_t const sensor)
Fill in the pre-allocated dwSensorSeekTableEntry array.
DW_API_PUBLIC dwStatus dwSensor_getCurrentSeekPosition(size_t *const event, dwSensorHandle_t const sensor)
Gets the current seek position of the sensor.
DW_API_PUBLIC dwStatus dwSAL_createSensor(dwSensorHandle_t *const sensor, dwSensorParams const params, dwSALHandle_t const sal)
Creates a new sensor managed by the SAL module with the given parameters.
DW_API_PUBLIC dwStatus dwSensor_getStats(dwSensorStats *const stats, dwSensorHandle_t const sensor)
Gets sensor statistics (if available).
DW_API_PUBLIC dwStatus dwSAL_releaseSensor(dwSensorHandle_t const sensor)
Releases a sensor managed by the SAL module.
DW_API_PUBLIC dwStatus dwSAL_start(dwSALHandle_t const sal)
Bootstraps all sensors managed by the SAL module.
DW_API_PUBLIC dwStatus dwSensor_returnRawData(const uint8_t *const data, dwSensorHandle_t const sensor)
Returns RAW data to sensor as a byte array.
#define DW_API_PUBLIC
Definition: Exports.h:54
const char8_t * protocol
Name of the protocol.
Definition: Sensors.h:98
float64_t timeDeltaStandardDeviation
Variance of all the deltas between consecutive timestamps.
Definition: Sensors.h:141
DW_API_PUBLIC dwStatus dwSAL_getSensorParameterString(const char **const parameters, uint32_t const idx, dwPlatformOS const os, dwSALHandle_t const sal)
Gets the parameter string acceptable by a sensor.
float64_t timeDeltaMean
Mean of all the deltas between consecutive timestamps.
Definition: Sensors.h:144
uint64_t errors
Number of encountered errors.
Definition: Sensors.h:123
NVIDIA DriveWorks API: Core Exports
const char8_t * parameters
Array to additional parameters provided to sensor creation.
Definition: Sensors.h:105