xWRL6432 MMWAVE-L-SDK  05.04.00.01
trackerproc.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2022 Texas Instruments Incorporated
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions
6  * are met:
7  *
8  * Redistributions of source code must retain the above copyright
9  * notice, this list of conditions and the following disclaimer.
10  *
11  * Redistributions in binary form must reproduce the above copyright
12  * notice, this list of conditions and the following disclaimer in the
13  * documentation and/or other materials provided with the
14  * distribution.
15  *
16  * Neither the name of Texas Instruments Incorporated nor the names of
17  * its contributors may be used to endorse or promote products derived
18  * from this software without specific prior written permission.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  */
32 
40 /**************************************************************************
41  *************************** Include Files ********************************
42  **************************************************************************/
43 #ifndef TRACKERPROC_H
44 #define TRACKERPROC_H
45 
46 /* Standard Include Files. */
47 #include <stdint.h>
48 #include <stdlib.h>
49 #include <stddef.h>
50 #include <string.h>
51 #include <stdio.h>
52 #include <math.h>
53 
54 /* mmWave SDK Data Path Include Files */
55 #include <common/mmwave_error.h>
56 #include <datapath/dpif/dpif_pointcloud.h>
57 #include <alg/gtrack/gtrack.h>
58 
62 #define DPU_TRACKERPROC_POINT_CLOUD_CARTESIAN_BYTE_ALIGNMENT DPIF_POINT_CLOUD_CARTESIAN_CPU_BYTE_ALIGNMENT
63 
67 #define DPU_TRACKERPROC_POINT_CLOUD_SIDE_INFO_BYTE_ALIGNMENT DPIF_POINT_CLOUD_SIDE_INFO_CPU_BYTE_ALIGNMENT
68 
69 
70 
71 #ifdef __cplusplus
72 extern "C" {
73 #endif
74 
75 //#define TRACKER_MAX_NUM_TR (5U)
76 
80 #define DPU_TRACKERPROC_MAX_NUM_TRACKS TRACKER_MAX_NUM_TR
81 
82 #define DP_ERRNO_TRACKER_PROC_BASE (MMWAVE_ERRNO_DPU_BASE -900)
83 
92 #define DPU_TRACKERPROC_EINVAL (DP_ERRNO_TRACKER_PROC_BASE-1)
93 
97 #define DPU_TRACKERPROC_ENOMEM (DP_ERRNO_TRACKER_PROC_BASE-2)
98 
102 #define DPU_TRACKERPROC_EINTERNAL (DP_ERRNO_TRACKER_PROC_BASE-3)
103 
107 #define DPU_TRACKERPROC_ENOTIMPL (DP_ERRNO_TRACKER_PROC_BASE-4)
108 
112 #define DPU_TRACKERPROC_EINPROGRESS (DP_ERRNO_TRACKER_PROC_BASE-5)
113 
117 #define DPU_TRACKERPROC_ECMD (DP_ERRNO_TRACKER_PROC_BASE-6)
118 
122 #define DPU_TRACKERPROC_EMAX_NUM_TRACKS_EXCEEDED (DP_ERRNO_TRACKER_PROC_BASE-7)
123 
128 /* @TODO: Remove this hardcoding and define these correctly in the DPC or elsewhere.
129  */
130 
131 #define TRACKERPROC_OUTPUT_TARGET_LIST 7
132 #define TRACKERPROC_OUTPUT_TARGET_INDEX 8
133 
134 #define TRACKERPROC_ACCEL_PARAMS_NUM_ELEMENTS 3
135 
145 typedef struct DPU_TrackerProc_StaticConfig_t
146 {
148  uint8_t trackerEnabled;
156  GTRACK_allocationParams allocationParams;
158  GTRACK_gatingParams gatingParams;
160  GTRACK_stateParams stateParams;
162  //GTRACK_varParams variationParams;
164  GTRACK_sceneryParams sceneryParams;
166  GTRACK_presenceParams presenceParams;
168  float accelerationParams[TRACKERPROC_ACCEL_PARAMS_NUM_ELEMENTS];
170  uint32_t trackingParamSet;
172  GTRACK_moduleConfig gtrackModuleConfig;
176 
177 
186 typedef struct DPU_TrackerProc_Resources_t
187 {
188 
190  uint32_t numDetObjIn;
191 
193 
202 typedef struct DPU_TrackerProc_Config_t
203 {
206 
208 
209 typedef uint8_t trackerProc_TargetIndex;
210 
220 typedef enum DPU_TrackerProc_Cmd_e
221 {
225 
233 typedef struct trackerProc_Target_t
234 {
235 #if defined (GTRACK_2D)
236 
237  uint32_t tid;
239  float posX;
241  float posY;
243  float velX;
245  float velY;
247  float accX;
249  float accY;
250 
252  float ec[9];
253  float g;
255  //float dim[3];
257  //float mCenter[3];
259  float confidenceLevel;
260 
261 #elif defined (GTRACK_3D)
262 
264  uint32_t tid;
266  float posX;
268  float posY;
270  float posZ;
272  float velX;
274  float velY;
276  float velZ;
278  float accX;
280  float accY;
282  float accZ;
284  float ec[16];
286  float g;
288  float confidenceLevel;
289 #endif
291 
292 typedef struct trackerProc_TargetDescrHandle_t
293 {
296 
301 
305 
315 typedef struct DPU_TrackerProc_OutParams_t
316 {
318  uint32_t numTargets;
320  uint32_t numIndices;
321 
323  uint8_t presenceInd;
324 
327 
331 
339 /* Compatible with GTRACK_measurementPoint */
340 typedef struct trackerProc_Point_t
341 {
343  float range;
345  float azimuth;
347 #ifdef GTRACK_3D
348  float elevation;
349 #endif
350  float doppler;
352  float snr;
353 
355 #if 0
356 typedef struct trackerProc_PointCloud_t
357 {
358  trackerProc_Tl header;
359  trackerProc_Point point[];
360 } trackerProc_PointCloud;
361 #endif
362 
370 
380 typedef struct trackerProcObj_t
381 {
384 
386  uint32_t pointCloudSize;
387 
390 #if 0
391 
392  trackerProc_OutputPointCloud *pointCloudTlv;
393 #endif
394 
396 
399 
402 
404 
405 /**************************************************************************
406  ************************TrackerProc External APIs **************************
407  **************************************************************************/
408 
425 (
426  int32_t* errCode
427 );
428 
447 (
448  DPU_TrackerProc_Handle handle,
449  DPU_TrackerProc_Config *pConfigIn
450 );
451 
472 (
473  DPU_TrackerProc_Handle handle,
474  uint32_t numObjsIn,
475  DPIF_PointCloudCartesianExt *cfarDetObjList,
476  DPU_TrackerProc_OutParams *outParams
477 );
478 
499 (
500  DPU_TrackerProc_Handle handle,
502  void* arg,
503  uint32_t argSize
504 );
505 
524 (
526 );
527 
547 (
548  uint16_t numPoints,
549  DPIF_PointCloudCartesianExt *objCartExtIn,
550  trackerProc_Point *detObjSphericalOut
551 );
552 
553 #ifdef __cplusplus
554 }
555 #endif
556 
557 #endif
DPU_TrackerProc_OutParams::presenceInd
uint8_t presenceInd
Target presence indicator.
Definition: trackerproc.h:323
TRACKERPROC_ACCEL_PARAMS_NUM_ELEMENTS
#define TRACKERPROC_ACCEL_PARAMS_NUM_ELEMENTS
Definition: trackerproc.h:134
DPU_TrackerProc_CartesianToSpherical
int32_t DPU_TrackerProc_CartesianToSpherical(uint16_t numPoints, DPIF_PointCloudCartesianExt *objCartExtIn, trackerProc_Point *detObjSphericalOut)
DPU_TrackerProc_process
int32_t DPU_TrackerProc_process(DPU_TrackerProc_Handle handle, uint32_t numObjsIn, DPIF_PointCloudCartesianExt *cfarDetObjList, DPU_TrackerProc_OutParams *outParams)
DPU_TrackerProc_config
int32_t DPU_TrackerProc_config(DPU_TrackerProc_Handle handle, DPU_TrackerProc_Config *pConfigIn)
DPU_TrackerProc_StaticConfig::sensorHeight
float sensorHeight
Application level parameters.
Definition: trackerproc.h:154
DPU_TrackerProc_StaticConfig::isCliCmdMaxAccelParamReceived
uint8_t isCliCmdMaxAccelParamReceived
Flag indicating CLI command for max acceleration parameters has been received.
Definition: trackerproc.h:174
DPU_TrackerProc_StaticConfig::sensorAzimuthTilt
float sensorAzimuthTilt
Application level parameters.
Definition: trackerproc.h:150
trackerProc_Point::snr
float snr
Range detection SNR, linear.
Definition: trackerproc.h:352
DPU_TrackerProc_StaticConfig::gatingParams
GTRACK_gatingParams gatingParams
Application level parameters.
Definition: trackerproc.h:158
DPU_TrackerProc_OutParams::targetIndex
trackerProc_TargetIndex * targetIndex
Index list - point-cloud points association with target Ids.
Definition: trackerproc.h:329
trackerProcObjType::inProgress
bool inProgress
trackerProc DPU is in processing state
Definition: trackerproc.h:401
DPU_TrackerProc_HW_Resources::numDetObjIn
uint32_t numDetObjIn
Number of AoA DPU detected points.
Definition: trackerproc.h:190
trackerProcObjType::pointCloudSize
uint32_t pointCloudSize
Point Cloud Size.
Definition: trackerproc.h:386
trackerProcObjType::targetDescrHandle
trackerProc_TargetDescrHandle * targetDescrHandle
Target Descriptors.
Definition: trackerproc.h:395
trackerProc_TargetDescrHandle
Definition: trackerproc.h:293
trackerProc_TargetIndex
uint8_t trackerProc_TargetIndex
Definition: trackerproc.h:209
DPU_TrackerProc_StaticConfig::sensorElevationTilt
float sensorElevationTilt
Application level parameters.
Definition: trackerproc.h:152
trackerProc_Point
Structure holds the message body for the Point Cloud.
Definition: trackerproc.h:341
DPU_TrackerProc_Cmd
DPU_TrackerProc_Cmd
TrackerProc control command.
Definition: trackerproc.h:221
DPU_TrackerProc_Config::staticCfg
DPU_TrackerProc_StaticConfig staticCfg
trackerProc static configuration
Definition: trackerproc.h:205
DPU_TrackerProc_deinit
int32_t DPU_TrackerProc_deinit(DPU_TrackerProc_Handle handle)
DPU_TrackerProc_OutParams
TrackerProc output parameter structure.
Definition: trackerproc.h:316
DPU_TrackerProc_StaticConfig::presenceParams
GTRACK_presenceParams presenceParams
Application level parameters.
Definition: trackerproc.h:166
DPU_TrackerProc_HW_Resources
TrackerProc DPU Hardware resources.
Definition: trackerproc.h:187
trackerProcObjType::pDpuCfg
DPU_TrackerProc_Config pDpuCfg
Pointer to DPU config.
Definition: trackerproc.h:398
DPU_TrackerProc_StaticConfig::trackingParamSet
uint32_t trackingParamSet
Application level parameters.
Definition: trackerproc.h:170
trackerProc_Point::range
float range
Detected point range, in m.
Definition: trackerproc.h:343
DPU_TrackerProc_StaticConfig::trackerEnabled
uint8_t trackerEnabled
Application level parameters.
Definition: trackerproc.h:148
trackerProcObjType::gtrackHandle
DPU_TrackerProc_Handle gtrackHandle
Structure holds the message body for the Point Cloud.
Definition: trackerproc.h:383
DPU_TrackerProc_StaticConfig::allocationParams
GTRACK_allocationParams allocationParams
Application level parameters.
Definition: trackerproc.h:156
DPU_TrackerProc_StaticConfig::sceneryParams
GTRACK_sceneryParams sceneryParams
Application level parameters.
Definition: trackerproc.h:164
DPU_TrackerProc_Config
Tracking configuration.
Definition: trackerproc.h:203
DPU_TrackerProc_OutParams::numTargets
uint32_t numTargets
Number of tracked objects.
Definition: trackerproc.h:318
trackerProc_TargetDescrHandle::trackProcessingTime
uint32_t trackProcessingTime
track processing time in usec
Definition: trackerproc.h:303
trackerProc_Target
Structure holds the target features.
Definition: trackerproc.h:234
trackerProc_Point::doppler
float doppler
Detected point elevation, in rad.
Definition: trackerproc.h:350
DPU_TrackerProc_Cmd_sensorTiltCfg
@ DPU_TrackerProc_Cmd_sensorTiltCfg
Command to update configuration.
Definition: trackerproc.h:223
DPU_TrackerProc_StaticConfig::gtrackModuleConfig
GTRACK_moduleConfig gtrackModuleConfig
GTRACK lib Core Parameters.
Definition: trackerproc.h:172
DPU_TrackerProc_OutParams::numIndices
uint32_t numIndices
Number of point-cloud points.
Definition: trackerproc.h:320
DPU_TrackerProc_StaticConfig::stateParams
GTRACK_stateParams stateParams
Application level parameters.
Definition: trackerproc.h:160
DPU_TrackerProc_OutParams::tList
trackerProc_Target * tList
Output list of tracked targets.
Definition: trackerproc.h:326
DPU_TrackerProc_StaticConfig
TrackerProc static configuration.
Definition: trackerproc.h:146
trackerProcObjType
TrackerProc DPU Object.
Definition: trackerproc.h:381
trackerProc_TargetDescrHandle::tIndex
trackerProc_TargetIndex * tIndex
Index list - point-cloud points association with target Ids.
Definition: trackerproc.h:298
DPU_TrackerProc_init
DPU_TrackerProc_Handle DPU_TrackerProc_init(int32_t *errCode)
trackerProcObjType::pointCloud
trackerProc_Point * pointCloud
Structure holds the Input Point Cloud.
Definition: trackerproc.h:389
trackerProc_Point::azimuth
float azimuth
Detected point azimuth, in rad.
Definition: trackerproc.h:345
trackerProc_TargetDescrHandle::uartProcessingTime
uint32_t uartProcessingTime
UART processing time in usec.
Definition: trackerproc.h:300
DPU_TrackerProc_control
int32_t DPU_TrackerProc_control(DPU_TrackerProc_Handle handle, DPU_TrackerProc_Cmd cmd, void *arg, uint32_t argSize)
trackerProc_TargetDescrHandle::tList
trackerProc_Target * tList
Output list of tracked targets.
Definition: trackerproc.h:295
DPU_TrackerProc_Handle
void * DPU_TrackerProc_Handle
TrackerProc DPU Handle.
Definition: trackerproc.h:369