#include <ti/drivers/uart/UART.h> | #include <ti/drivers/uart/UART.h> | ||||
#include <ti/utils/cli/cli.h> | #include <ti/utils/cli/cli.h> | ||||
#include <ti/utils/mathutils/mathutils.h> | #include <ti/utils/mathutils/mathutils.h> | ||||
#include <ti/drivers/canfd/canfd.h> //Einf�gen des Drivers f�r den Can Anschluss | |||||
/* Demo Include Files */ | /* Demo Include Files */ | ||||
#include <people_counting/68xx_3D_people_counting/src/common/mmwdemo_rfparser.h> | #include <people_counting/68xx_3D_people_counting/src/common/mmwdemo_rfparser.h> | ||||
#pragma DATA_SECTION(gMmwL3, ".l3ram"); | #pragma DATA_SECTION(gMmwL3, ".l3ram"); | ||||
uint8_t gMmwL3[MMWAVE_MSSUSED_L3RAM_SIZE]; | uint8_t gMmwL3[MMWAVE_MSSUSED_L3RAM_SIZE]; | ||||
/************************************************************************** | |||||
*************************** MCAN Global Definitions *********************** | |||||
**************************************************************************/ | |||||
volatile uint32_t gTxDoneFlag = 0, gRxDoneFlag = 0, gParityErrFlag = 0; | |||||
volatile uint32_t gTxPkts = 0, gRxPkts = 0, gErrStatusInt = 0; | |||||
volatile uint32_t iterationCount = 0U; | |||||
uint32_t dataLength = 0U; | |||||
uint32_t msgLstErrCnt = 0U; | |||||
uint32_t gDisplayStats = 0; | |||||
uint8_t rxData[64U]; | |||||
uint32_t txDataLength, rxDataLength; | |||||
CANFD_MCANFrameType frameType = CANFD_MCANFrameType_CLASSIC; //frameType auf Classic festlegen f�r kklassische CAN Kommunikation | |||||
static void MCANAppInitParams(CANFD_MCANInitParams* mcanCfgParams); | |||||
CANFD_Handle canHandle; | |||||
CANFD_MsgObjHandle txMsgObjHandle; | |||||
CANFD_MCANMsgObjCfgParams txMsgObjectParams; | |||||
/************************************************************************** | /************************************************************************** | ||||
*************************** Extern Definitions *************************** | *************************** Extern Definitions *************************** | ||||
**************************************************************************/ | **************************************************************************/ | ||||
EDMA_transferControllerErrorInfo_t *errorInfo); | EDMA_transferControllerErrorInfo_t *errorInfo); | ||||
static void Pcount3DDemo_EDMA_errorCallbackFxn(EDMA_Handle handle, EDMA_errorInfo_t *errorInfo); | static void Pcount3DDemo_EDMA_errorCallbackFxn(EDMA_Handle handle, EDMA_errorInfo_t *errorInfo); | ||||
/************************************************************************** | |||||
*************************** CAN Driver Initialize Function ***********************-------------------------------------------------------------------- | |||||
****************************************************************************************CAN-Anbindung**************/ | |||||
void Can_Initalize(void) | |||||
{ | |||||
int32_t errCode = 0; | |||||
int32_t retVal = 0; | |||||
CANFD_MCANInitParams mcanCfgParams; | |||||
CANFD_MCANBitTimingParams mcanBitTimingParams; | |||||
CANFD_MCANMsgObjCfgParams rxMsgObjectParams; | |||||
CANFD_MsgObjHandle rxMsgObjHandle; | |||||
gTxDoneFlag = 0; | |||||
gRxDoneFlag = 0; | |||||
/* Setup the PINMUX to bring out the XWR16xx CAN pins */ | |||||
Pinmux_Set_OverrideCtrl(SOC_XWR68XX_PINE14_PADAE, PINMUX_OUTEN_RETAIN_HW_CTRL, | |||||
PINMUX_INPEN_RETAIN_HW_CTRL); | |||||
Pinmux_Set_FuncSel(SOC_XWR68XX_PINE14_PADAE, SOC_XWR68XX_PINE14_PADAE_CANFD_TX); | |||||
Pinmux_Set_OverrideCtrl(SOC_XWR68XX_PIND13_PADAD, PINMUX_OUTEN_RETAIN_HW_CTRL, | |||||
PINMUX_INPEN_RETAIN_HW_CTRL); | |||||
Pinmux_Set_FuncSel(SOC_XWR68XX_PIND13_PADAD, SOC_XWR68XX_PIND13_PADAD_CANFD_RX); | |||||
/* Configure the divide value for MCAN source clock */ | |||||
SOC_setPeripheralClock(gMmwMssMCB.socHandle, SOC_MODULE_MCAN, SOC_CLKSOURCE_VCLK, 4U, &errCode); | |||||
/* Initialize peripheral memory */ | |||||
SOC_initPeripheralRam(gMmwMssMCB.socHandle, SOC_MODULE_MCAN, &errCode); | |||||
MCANAppInitParams (&mcanCfgParams); | |||||
/* Initialize the CANFD driver */ | |||||
canHandle = CANFD_init(0U, &mcanCfgParams, &errCode); | |||||
if (canHandle == NULL) | |||||
{ | |||||
System_printf ("Error: CANFD Module Initialization failed [Error code %d]\n", errCode); | |||||
return ; | |||||
} | |||||
/* Configuring 1Mbps and 5Mbps as nominal and data bit-rate respectively | |||||
Prop seg: 8 | |||||
Ph seg 1: 6 | |||||
Ph Seg2 : 5 | |||||
Sync jump: 1 | |||||
BRP(Baud rate Prescaler): 2 | |||||
Nominal Bit rate = (40)/(((8+6+5)+1)*BRP) = 1Mhz | |||||
Timing Params for Data Bit rate: | |||||
Prop seg: 2 | |||||
Ph seg 1: 2 | |||||
Ph Seg2 : 3 | |||||
Sync jump: 1 | |||||
BRP(Baud rate Prescaler): 1 | |||||
Nominal Bit rate = (40)/(((2+2+3)+1)*BRP) = 5Mhz | |||||
*/ | |||||
mcanBitTimingParams.nomBrp = 0x4U; //um vorgegebene Bitrate zu erreichen | |||||
mcanBitTimingParams.nomPropSeg = 0x8U; | |||||
mcanBitTimingParams.nomPseg1 = 0x6U; | |||||
mcanBitTimingParams.nomPseg2 = 0x5U; | |||||
mcanBitTimingParams.nomSjw = 0x1U; | |||||
mcanBitTimingParams.dataBrp = 0x4U; //um vorgegebene Bitrate zu erreichen | |||||
mcanBitTimingParams.dataPropSeg = 0x2U; | |||||
mcanBitTimingParams.dataPseg1 = 0x2U; | |||||
mcanBitTimingParams.dataPseg2 = 0x3U; | |||||
mcanBitTimingParams.dataSjw = 0x1U; | |||||
/* Configure the CAN driver */ | |||||
retVal = CANFD_configBitTime (canHandle, &mcanBitTimingParams, &errCode); | |||||
if (retVal < 0) | |||||
{ | |||||
System_printf ("Error: CANFD Module configure bit time failed [Error code %d]\n", | |||||
errCode); | |||||
return ; | |||||
} | |||||
/* Setup the transmit message object */ | |||||
txMsgObjectParams.direction = CANFD_Direction_TX; | |||||
txMsgObjectParams.msgIdType = CANFD_MCANXidType_11_BIT; //ID Type wird ge�ndert | |||||
txMsgObjectParams.msgIdentifier = 0xD1; | |||||
txMsgObjHandle = CANFD_createMsgObject (canHandle, &txMsgObjectParams, &errCode); | |||||
if (txMsgObjHandle == NULL) | |||||
{ | |||||
System_printf ("Error: CANFD create Tx message object failed [Error code %d]\n", | |||||
errCode); | |||||
return ; | |||||
} | |||||
/* Setup the receive message object */ | |||||
rxMsgObjectParams.direction = CANFD_Direction_RX; | |||||
rxMsgObjectParams.msgIdType = CANFD_MCANXidType_11_BIT; //ID Type wird ge�ndert | |||||
rxMsgObjectParams.msgIdentifier = 0xD1; | |||||
rxMsgObjHandle = CANFD_createMsgObject (canHandle, &rxMsgObjectParams, &errCode); | |||||
if (rxMsgObjHandle == NULL) | |||||
{ | |||||
System_printf ("Error: CANFD create Rx message object failed [Error code %d]\n", | |||||
errCode); | |||||
return ; | |||||
} | |||||
} | |||||
/************************************************************************** | |||||
******************** CAN Parameters initialize Function ***************** | |||||
**************************************************************************/ | |||||
static void MCANAppCallback(CANFD_MsgObjHandle handle, CANFD_Reason reason) | |||||
{ | |||||
int32_t errCode, retVal; | |||||
uint32_t id; | |||||
CANFD_MCANFrameType rxFrameType; | |||||
CANFD_MCANXidType rxIdType; | |||||
if (reason == CANFD_Reason_TX_COMPLETION) | |||||
{ | |||||
{ | |||||
gTxPkts++; | |||||
gTxDoneFlag = 1; | |||||
return; | |||||
} | |||||
} | |||||
if (reason == CANFD_Reason_RX) | |||||
{ | |||||
{ | |||||
/* Reset the receive buffer */ | |||||
memset(&rxData, 0, sizeof (rxData)); | |||||
dataLength = 0; | |||||
retVal = CANFD_getData (handle, &id, &rxFrameType, &rxIdType, &rxDataLength, | |||||
&rxData[0], &errCode); | |||||
if (retVal < 0) | |||||
{ | |||||
System_printf ("Error: CAN receive data for iteration %d failed [Error code %d]\n", iterationCount, errCode); | |||||
return; | |||||
} | |||||
if (rxFrameType != frameType) | |||||
{ | |||||
System_printf ("Error: CAN received incorrect frame type Sent %d Received %d for iteration %d failed\n", frameType, rxFrameType, iterationCount); | |||||
return; | |||||
} | |||||
/* Validate the data */ | |||||
gRxPkts++; | |||||
gRxDoneFlag = 1; | |||||
return; | |||||
} | |||||
} | |||||
if (reason == CANFD_Reason_TX_CANCELED) | |||||
{ | |||||
{ | |||||
gTxPkts++; | |||||
gTxDoneFlag = 1; | |||||
gRxDoneFlag = 1; | |||||
return; | |||||
} | |||||
} | |||||
} | |||||
static void MCANAppErrStatusCallback(CANFD_Handle handle, CANFD_Reason reason, | |||||
CANFD_ErrStatusResp* errStatusResp) | |||||
{ | |||||
/*Record the error count */ | |||||
gErrStatusInt++; | |||||
return; | |||||
} | |||||
static void MCANAppInitParams(CANFD_MCANInitParams* mcanCfgParams) | |||||
{ | |||||
/*Intialize MCAN Config Params*/ | |||||
memset (mcanCfgParams, sizeof (CANFD_MCANInitParams), 0); | |||||
mcanCfgParams->fdMode = 0x1U; | |||||
mcanCfgParams->brsEnable = 0x1U; | |||||
mcanCfgParams->txpEnable = 0x0U; | |||||
mcanCfgParams->efbi = 0x0U; | |||||
mcanCfgParams->pxhddisable = 0x0U; | |||||
mcanCfgParams->darEnable = 0x1U; | |||||
mcanCfgParams->wkupReqEnable = 0x1U; | |||||
mcanCfgParams->autoWkupEnable = 0x1U; | |||||
mcanCfgParams->emulationEnable = 0x0U; | |||||
mcanCfgParams->emulationFAck = 0x0U; | |||||
mcanCfgParams->clkStopFAck = 0x0U; | |||||
mcanCfgParams->wdcPreload = 0x0U; | |||||
mcanCfgParams->tdcEnable = 0x1U; | |||||
mcanCfgParams->tdcConfig.tdcf = 0U; | |||||
mcanCfgParams->tdcConfig.tdco = 8U; | |||||
mcanCfgParams->monEnable = 0x0U; | |||||
mcanCfgParams->asmEnable = 0x0U; | |||||
mcanCfgParams->tsPrescalar = 0x0U; | |||||
mcanCfgParams->tsSelect = 0x0U; | |||||
mcanCfgParams->timeoutSelect = CANFD_MCANTimeOutSelect_CONT; | |||||
mcanCfgParams->timeoutPreload = 0x0U; | |||||
mcanCfgParams->timeoutCntEnable = 0x0U; | |||||
mcanCfgParams->filterConfig.rrfe = 0x1U; | |||||
mcanCfgParams->filterConfig.rrfs = 0x1U; | |||||
mcanCfgParams->filterConfig.anfe = 0x1U; | |||||
mcanCfgParams->filterConfig.anfs = 0x1U; | |||||
mcanCfgParams->msgRAMConfig.lss = 127U; | |||||
mcanCfgParams->msgRAMConfig.lse = 64U; | |||||
mcanCfgParams->msgRAMConfig.txBufNum = 32U; | |||||
mcanCfgParams->msgRAMConfig.txFIFOSize = 0U; | |||||
mcanCfgParams->msgRAMConfig.txBufMode = 0U; | |||||
mcanCfgParams->msgRAMConfig.txEventFIFOSize = 0U; | |||||
mcanCfgParams->msgRAMConfig.txEventFIFOWaterMark = 0U; | |||||
mcanCfgParams->msgRAMConfig.rxFIFO0size = 0U; | |||||
mcanCfgParams->msgRAMConfig.rxFIFO0OpMode = 0U; | |||||
mcanCfgParams->msgRAMConfig.rxFIFO0waterMark = 0U; | |||||
mcanCfgParams->msgRAMConfig.rxFIFO1size = 64U; | |||||
mcanCfgParams->msgRAMConfig.rxFIFO1waterMark = 64U; | |||||
mcanCfgParams->msgRAMConfig.rxFIFO1OpMode = 64U; | |||||
mcanCfgParams->eccConfig.enable = 1; | |||||
mcanCfgParams->eccConfig.enableChk = 1; | |||||
mcanCfgParams->eccConfig.enableRdModWr = 1; | |||||
mcanCfgParams->errInterruptEnable = 1U; | |||||
mcanCfgParams->dataInterruptEnable = 1U; | |||||
mcanCfgParams->appErrCallBack = MCANAppErrStatusCallback; | |||||
mcanCfgParams->appDataCallBack = MCANAppCallback; | |||||
} | |||||
int32_t Can_Transmit_Schedule( uint32_t msg_id, uint8_t *txmsg, uint32_t len) | |||||
{ | |||||
volatile uint32_t index = 0; | |||||
int32_t retVal = 0; | |||||
int32_t errCode = 0; | |||||
if(frameType == CANFD_MCANFrameType_FD) | |||||
{ | |||||
Task_sleep(1); | |||||
while(len > 64U) | |||||
{ | |||||
retVal = CANFD_transmitData (txMsgObjHandle, msg_id, CANFD_MCANFrameType_FD, 64U, &txmsg[index], | |||||
&errCode); | |||||
index = index + 64U; | |||||
len = len - 64U; | |||||
Task_sleep(1); | |||||
} | |||||
retVal = CANFD_transmitData (txMsgObjHandle, msg_id, CANFD_MCANFrameType_FD, len, &txmsg[index], | |||||
&errCode); | |||||
} | |||||
else | |||||
{ | |||||
while(len > 8U) | |||||
{ | |||||
retVal = CANFD_transmitData (txMsgObjHandle, msg_id, | |||||
CANFD_MCANFrameType_CLASSIC, 8U, &txmsg[index], &errCode); | |||||
if (retVal < 0) | |||||
{ | |||||
continue; | |||||
} | |||||
index = index + 8U; | |||||
len = len - 8U; | |||||
} | |||||
retVal = CANFD_transmitData (txMsgObjHandle, msg_id, CANFD_MCANFrameType_CLASSIC, | |||||
len, &txmsg[index], &errCode); | |||||
while(retVal < 0) | |||||
{ | |||||
retVal = CANFD_transmitData (txMsgObjHandle, msg_id, CANFD_MCANFrameType_CLASSIC, len, | |||||
&txmsg[index], &errCode); | |||||
} | |||||
} | |||||
return retVal; | |||||
} | |||||
//---------------------------------------------------------------------------------------------------------------------------------------------------------- | |||||
/************************************************************************** | /************************************************************************** | ||||
************************* Millimeter Wave Demo Functions ********************** | ************************* Millimeter Wave Demo Functions ********************** | ||||
**************************************************************************/ | **************************************************************************/ | ||||
/* wait for new message and process all the messages received from the peer */ | /* wait for new message and process all the messages received from the peer */ | ||||
while(1) | while(1) | ||||
{ | { | ||||
uint32_t numTargets, numIndices; | |||||
uint8_t *tList; | |||||
uint8_t *tIndex; | |||||
uint32_t numTargets, numIndices; | |||||
uint8_t *tList; | |||||
uint8_t *tIndex; | |||||
Semaphore_pend(gMmwMssMCB.uartTxSemHandle, BIOS_WAIT_FOREVER); | Semaphore_pend(gMmwMssMCB.uartTxSemHandle, BIOS_WAIT_FOREVER); | ||||
startTime = Cycleprofiler_getTimeStamp(); | |||||
startTime = Cycleprofiler_getTimeStamp(); | |||||
tlvIdx = 0; | tlvIdx = 0; | ||||
uartHandle = gMmwMssMCB.loggingUartHandle; | uartHandle = gMmwMssMCB.loggingUartHandle; | ||||
header.frameProcessingTimeInUsec = timingInfo->frameProcessingTimeInUsec; | header.frameProcessingTimeInUsec = timingInfo->frameProcessingTimeInUsec; | ||||
header.trackingProcessingTimeInUsec = gMmwMssMCB.trackerProcessingTimeInUsec; | header.trackingProcessingTimeInUsec = gMmwMssMCB.trackerProcessingTimeInUsec; | ||||
header.uartSendingTimeInUsec = gMmwMssMCB.uartProcessingTimeInUsec; | header.uartSendingTimeInUsec = gMmwMssMCB.uartProcessingTimeInUsec; | ||||
numTargets = gMmwMssMCB.numTargets; | |||||
numIndices = gMmwMssMCB.numIndices; | |||||
tList = (uint8_t*)gMmwMssMCB.trackerOutput.tList[gMmwMssMCB.trackerOutput.currentDescr]; | |||||
tIndex = (uint8_t*)gMmwMssMCB.trackerOutput.tIndex[gMmwMssMCB.trackerOutput.currentDescr]; | |||||
numTargets = gMmwMssMCB.numTargets; | |||||
numIndices = gMmwMssMCB.numIndices; | |||||
tList = (uint8_t*)gMmwMssMCB.trackerOutput.tList[gMmwMssMCB.trackerOutput.currentDescr]; | |||||
tIndex = (uint8_t*)gMmwMssMCB.trackerOutput.tIndex[gMmwMssMCB.trackerOutput.currentDescr]; | |||||
if (objOut->header.length > 0) | if (objOut->header.length > 0) | ||||
{ | { | ||||
packetLen += objOut->header.length; | packetLen += objOut->header.length; | ||||
UART_write(uartHandle, (uint8_t*)&tl, sizeof(Pcount3DDemo_output_message_tl)); | UART_write(uartHandle, (uint8_t*)&tl, sizeof(Pcount3DDemo_output_message_tl)); | ||||
UART_write(uartHandle, (uint8_t*)&(gMmwMssMCB.presenceInd), sizeof(uint32_t)); | UART_write(uartHandle, (uint8_t*)&(gMmwMssMCB.presenceInd), sizeof(uint32_t)); | ||||
} | } | ||||
gMmwMssMCB.uartProcessingTimeInUsec = (Cycleprofiler_getTimeStamp() - startTime)/R4F_CLOCK_MHZ; | |||||
gMmwMssMCB.uartProcessingTimeInUsec = (Cycleprofiler_getTimeStamp() - startTime)/R4F_CLOCK_MHZ; | |||||
} | } | ||||
} | } | ||||
DMA_Params dmaParams; | DMA_Params dmaParams; | ||||
DMA_Handle dmaHandle; | DMA_Handle dmaHandle; | ||||
UART_Handle uartHandle; | |||||
char out = 'M'; | |||||
uartHandle = gMmwMssMCB.loggingUartHandle; | |||||
UART_write(uartHandle, (uint8_t*)&out, sizeof(char)); | |||||
DPC_ObjectDetectionRangeHWA_InitParams objDetInitParams; | DPC_ObjectDetectionRangeHWA_InitParams objDetInitParams; | ||||
// int32_t i; | // int32_t i; | ||||
/***************************************************************************** | /***************************************************************************** | ||||
* Initialize the mmWave SDK components: | * Initialize the mmWave SDK components: | ||||
*****************************************************************************/ | *****************************************************************************/ | ||||
Can_Initalize(); //Can Aufruf | |||||
/* Initialize the UART */ | /* Initialize the UART */ | ||||
UART_init(); | UART_init(); | ||||
TRACKING_DEFAULT_PARAM_SET = 0, | TRACKING_DEFAULT_PARAM_SET = 0, | ||||
TRACKING_TRAFFIC_MONITORING_PARAM_SET, | TRACKING_TRAFFIC_MONITORING_PARAM_SET, | ||||
TRACKING_PEOPLE_COUNTING_PARAM_SET, | TRACKING_PEOPLE_COUNTING_PARAM_SET, | ||||
TRACKING_OUTDOOR_PARAM_SET, | |||||
TRACKING_CEILING_MOUNT_PARAM_SET | |||||
TRACKING_OUTDOOR_PARAM_SET, | |||||
TRACKING_CEILING_MOUNT_PARAM_SET | |||||
} TRACKING_ADVANCED_PARAM_SET; | } TRACKING_ADVANCED_PARAM_SET; | ||||
typedef enum { | typedef enum { | ||||
/* Scenery parameters includes up to two boundary boxes and up to two static boxes */ | /* Scenery parameters includes up to two boundary boxes and up to two static boxes */ | ||||
/* Each box is in format {x1,x2, y1,y2, z1,z2}. In 2D cases, the z parameters are ignored */ | /* Each box is in format {x1,x2, y1,y2, z1,z2}. In 2D cases, the z parameters are ignored */ | ||||
GTRACK_sceneryParams appSceneryParamTable[4] = { | GTRACK_sceneryParams appSceneryParamTable[4] = { | ||||
/* TM: 1 boundary box: {-1,12, 15,75, 0,0}, and 1 static box {0,14, 19,50, 0,0} */ | |||||
1,{{-1.f,12.f, 15.f,75.f, 0.f,0.f},{0.f,0.f,0.f,0.f,0.f,0.f}},1,{{0.f,11.f, 19.f,50.f, 0.f,0.f},{0.f,0.f,0.f,0.f,0.f}}, | |||||
/* PEOPLE COUNTING: 1 boundary box: {-4,4, 0.5,7.5, 0,0}, and 1 static box {-3,3, 2,6, 0,0} */ | |||||
1,{{-4.f,4.f, 0.5f,7.5f, 0.f,0.f},{0.f,0.f,0.f,0.f,0.f,0.f}}, 1,{{-3.f,3.f,2.f,6.f,0.f,0.f},{0.f,0.f,0.f,0.f,0.f,0.f}}, | |||||
/* OUTDOOR: 1 boundary box: {-39,19, 2,50, 0,0}, and 1 static box {-30,16, 4,44, 0,0} */ | |||||
1,{{-29.f,39.f, 2.f,59.f, -1.f,3.f},{0.f,0.f,0.f,0.f,0.f,0.f}}, 1,{{-20.f,20.f, 12.f,40.f, 0.f, 2.f},{0.f,0.f,0.f,0.f,0.f,0.f}}, | |||||
/* CEILING MOUNT: 1 boundary box: {-4,4, 0.5,7.5, -1,3}, and 1 static box {-3,3, 2,6, -0.5,2.5} */ | |||||
1,{{-4.f,4.f, 0.5f,7.5f, -1.f,3.0f},{0.f,0.f,0.f,0.f,0.f,0.f}}, 1,{{-3.f,3.f,2.f,6.f,-0.5,2.5f},{0.f,0.f,0.f,0.f,0.f,0.f}} | |||||
/* TM: 1 boundary box: {-1,12, 15,75, 0,0}, and 1 static box {0,14, 19,50, 0,0} */ | |||||
1,{{-1.f,12.f, 15.f,75.f, 0.f,0.f},{0.f,0.f,0.f,0.f,0.f,0.f}},1,{{0.f,11.f, 19.f,50.f, 0.f,0.f},{0.f,0.f,0.f,0.f,0.f}}, | |||||
/* PEOPLE COUNTING: 1 boundary box: {-4,4, 0.5,7.5, 0,0}, and 1 static box {-3,3, 2,6, 0,0} */ | |||||
1,{{-4.f,4.f, 0.5f,7.5f, 0.f,0.f},{0.f,0.f,0.f,0.f,0.f,0.f}}, 1,{{-3.f,3.f,2.f,6.f,0.f,0.f},{0.f,0.f,0.f,0.f,0.f,0.f}}, | |||||
/* OUTDOOR: 1 boundary box: {-39,19, 2,50, 0,0}, and 1 static box {-30,16, 4,44, 0,0} */ | |||||
1,{{-29.f,39.f, 2.f,59.f, -1.f,3.f},{0.f,0.f,0.f,0.f,0.f,0.f}}, 1,{{-20.f,20.f, 12.f,40.f, 0.f, 2.f},{0.f,0.f,0.f,0.f,0.f,0.f}}, | |||||
/* CEILING MOUNT: 1 boundary box: {-4,4, 0.5,7.5, -1,3}, and 1 static box {-3,3, 2,6, -0.5,2.5} */ | |||||
1,{{-4.f,4.f, 0.5f,7.5f, -1.f,3.0f},{0.f,0.f,0.f,0.f,0.f,0.f}}, 1,{{-3.f,3.f,2.f,6.f,-0.5,2.5f},{0.f,0.f,0.f,0.f,0.f,0.f}} | |||||
}; | }; | ||||
/* Gating Volume 2 "liters", Limits are set to 2m in depth and width, no limit in height and doppler */ | /* Gating Volume 2 "liters", Limits are set to 2m in depth and width, no limit in height and doppler */ | ||||
GTRACK_gatingParams appGatingParamTable[4] = { | GTRACK_gatingParams appGatingParamTable[4] = { | ||||
/* TM: Gating volume = 16, Limits are set to 12m in depth, 8m in width, ignore the height, no limit in doppler */ | |||||
/* TM: Gating volume = 16, Limits are set to 12m in depth, 8m in width, ignore the height, no limit in doppler */ | |||||
{4.f, {12.f, 6.f, 4.f, 12.f}}, | {4.f, {12.f, 6.f, 4.f, 12.f}}, | ||||
/* PEOPLE COUNTING: Gating gain = 3, Limits are 2m in depth, 2m in width, ignore the height, 12m/s in doppler */ | |||||
{3.f, {2.f, 2.f, 2.f, 12.f}}, | |||||
/* OUTDOOR: Gating gain = 4, Limits are set to 6m in depth, 6m in width, ignore the height, 10m/s limit in doppler */ | |||||
/* PEOPLE COUNTING: Gating gain = 3, Limits are 2m in depth, 2m in width, ignore the height, 12m/s in doppler */ | |||||
{3.f, {2.f, 2.f, 2.f, 12.f}}, | |||||
/* OUTDOOR: Gating gain = 4, Limits are set to 6m in depth, 6m in width, ignore the height, 10m/s limit in doppler */ | |||||
{4.f, {6.f, 6.f, 4.f, 10.f}}, | {4.f, {6.f, 6.f, 4.f, 10.f}}, | ||||
/* CEILING MOUNT: Gating volume = 2, Limits are 2m in depth, 2m in width, 2m the height, no limit in doppler */ | |||||
{2.f, {2.f, 2.f, 2.f, 10.f}} | |||||
/* CEILING MOUNT: Gating volume = 2, Limits are 2m in depth, 2m in width, 2m the height, no limit in doppler */ | |||||
{2.f, {2.f, 2.f, 2.f, 10.f}} | |||||
}; | }; | ||||
GTRACK_stateParams appStateParamTable[4] = { | GTRACK_stateParams appStateParamTable[4] = { | ||||
{3U, 3U, 5U, 100U, 5U}, /* TM: det2act, det2free, act2free, stat2free, exit2free */ | |||||
{10U, 5U, 50U, 100U, 5U}, /* PC: det2act, det2free, act2free, stat2free, exit2free */ | |||||
{4U, 10U, 60U, 600U, 20U}, /* OUTDOOR: det2act, det2free, act2free, stat2free, exit2free */ | |||||
{10U, 5U, 10U, 100U, 5U} /* CEILING MOUNT: det2act, det2free, act2free, stat2free, exit2free */ | |||||
{3U, 3U, 5U, 100U, 5U}, /* TM: det2act, det2free, act2free, stat2free, exit2free */ | |||||
{10U, 5U, 50U, 100U, 5U}, /* PC: det2act, det2free, act2free, stat2free, exit2free */ | |||||
{4U, 10U, 60U, 600U, 20U}, /* OUTDOOR: det2act, det2free, act2free, stat2free, exit2free */ | |||||
{10U, 5U, 10U, 100U, 5U} /* CEILING MOUNT: det2act, det2free, act2free, stat2free, exit2free */ | |||||
}; | }; | ||||
GTRACK_allocationParams appAllocationParamTable[4] = { | GTRACK_allocationParams appAllocationParamTable[4] = { | ||||
{100.f, 100.f, 1.f, 3U, 4.f, 2.f}, /* TM: 100 (100) SNRs, 1m/s minimal velocity, 3 points with 4m in distance, 2m/c in velocity separation */ | |||||
{60.f, 200.f, 0.1f, 5U, 1.5f, 2.f}, /* PC: 150 (250 obscured), 0.1 m/s minimal velocity, 5 points, with 1m in distance, 2m/c in velocity in separation */ | |||||
{40.f, 200.f, 0.5f, 3U, 2.f, 2.f}, /* OUTDOOR: 50 (200 obscured), 0.5 m/s minimal velocity, 5 points, with 1m in distance, 2m/c in velocity in separation */ | |||||
{60.f, 200.f, 0.1f, 5U, 1.5f, 2.f} /* CEILING MOUNT: 150 (200 obscured), 0.5 m/s minimal velocity, 5 points, with 1m in distance, 2m/c in velocity in separation */ | |||||
{100.f, 100.f, 1.f, 3U, 4.f, 2.f}, /* TM: 100 (100) SNRs, 1m/s minimal velocity, 3 points with 4m in distance, 2m/c in velocity separation */ | |||||
{60.f, 200.f, 0.1f, 5U, 1.5f, 2.f}, /* PC: 150 (250 obscured), 0.1 m/s minimal velocity, 5 points, with 1m in distance, 2m/c in velocity in separation */ | |||||
{40.f, 200.f, 0.5f, 3U, 2.f, 2.f}, /* OUTDOOR: 50 (200 obscured), 0.5 m/s minimal velocity, 5 points, with 1m in distance, 2m/c in velocity in separation */ | |||||
{60.f, 200.f, 0.1f, 5U, 1.5f, 2.f} /* CEILING MOUNT: 150 (200 obscured), 0.5 m/s minimal velocity, 5 points, with 1m in distance, 2m/c in velocity in separation */ | |||||
}; | }; | ||||
/* This parameter is ignored in 2D/3D tracker versions */ | /* This parameter is ignored in 2D/3D tracker versions */ | ||||
GTRACK_varParams appVariationParamTable[4] = { | GTRACK_varParams appVariationParamTable[4] = { | ||||
{0.f, 0.f, 0.f}, | |||||
{0.f, 0.f, 0.f}, | |||||
{0.f, 0.f, 0.f}, | |||||
{0.f, 0.f, 0.f} | |||||
{0.f, 0.f, 0.f}, | |||||
{0.f, 0.f, 0.f}, | |||||
{0.f, 0.f, 0.f}, | |||||
{0.f, 0.f, 0.f} | |||||
}; | }; | ||||
float maxAccelerationParams[3] = {1, 1, 1}; | float maxAccelerationParams[3] = {1, 1, 1}; | ||||
/* @TODO: These functions need to be abstracted to the DPC */ | /* @TODO: These functions need to be abstracted to the DPC */ | ||||
void *gtrack_alloc(unsigned int numElements, unsigned int sizeInBytes) | void *gtrack_alloc(unsigned int numElements, unsigned int sizeInBytes) | ||||
{ | { | ||||
gGtrackMemoryUsed += numElements*sizeInBytes; | |||||
gGtrackMemoryUsed += numElements*sizeInBytes; | |||||
return MemoryP_ctrlAlloc(numElements*sizeInBytes, 0); | return MemoryP_ctrlAlloc(numElements*sizeInBytes, 0); | ||||
} | } | ||||
void gtrack_free(void *pFree, unsigned int sizeInBytes) | void gtrack_free(void *pFree, unsigned int sizeInBytes) | ||||
{ | { | ||||
gGtrackMemoryUsed -= sizeInBytes; | |||||
MemoryP_ctrlFree(pFree,sizeInBytes); | |||||
gGtrackMemoryUsed -= sizeInBytes; | |||||
MemoryP_ctrlFree(pFree,sizeInBytes); | |||||
} | } | ||||
void gtrack_log(GTRACK_VERBOSE_TYPE level, const char *format, ...) | void gtrack_log(GTRACK_VERBOSE_TYPE level, const char *format, ...) | ||||
{ | { | ||||
#if 0 | #if 0 | ||||
va_list args; | |||||
va_list args; | |||||
va_start(args, format); | va_start(args, format); | ||||
vprintf(format, args); | |||||
va_end(args); | |||||
vprintf(format, args); | |||||
va_end(args); | |||||
#endif | #endif | ||||
} | } | ||||
case TRACKING_TRAFFIC_MONITORING_PARAM_SET: | case TRACKING_TRAFFIC_MONITORING_PARAM_SET: | ||||
/* Initialize CLI configuration: */ | /* Initialize CLI configuration: */ | ||||
config.initialRadialVelocity = -8.0f; // for TM, detected targets are approaching | |||||
config.maxAcceleration[0] = 2.0f; // for TM, maximum acceleration in lateral direction is set to 2m/s2 | |||||
config.maxAcceleration[1] = 20.0f; // for TM, maximum acceleration is longitudinal direction set to 20m/s2 | |||||
config.maxAcceleration[2] = 0.f; // ignored | |||||
config.initialRadialVelocity = -8.0f; // for TM, detected targets are approaching | |||||
config.maxAcceleration[0] = 2.0f; // for TM, maximum acceleration in lateral direction is set to 2m/s2 | |||||
config.maxAcceleration[1] = 20.0f; // for TM, maximum acceleration is longitudinal direction set to 20m/s2 | |||||
config.maxAcceleration[2] = 0.f; // ignored | |||||
break; | break; | ||||
case TRACKING_PEOPLE_COUNTING_PARAM_SET: | case TRACKING_PEOPLE_COUNTING_PARAM_SET: | ||||
/* Initialize CLI configuration: */ | /* Initialize CLI configuration: */ | ||||
config.initialRadialVelocity = 0; //For PC, detected target velocity is unknown | |||||
config.initialRadialVelocity = 0; //For PC, detected target velocity is unknown | |||||
config.maxAcceleration[0] = 0.1f; | config.maxAcceleration[0] = 0.1f; | ||||
config.maxAcceleration[1] = 0.1f; | config.maxAcceleration[1] = 0.1f; | ||||
config.maxAcceleration[2] = 0.1f; | config.maxAcceleration[2] = 0.1f; | ||||
case TRACKING_OUTDOOR_PARAM_SET: | case TRACKING_OUTDOOR_PARAM_SET: | ||||
/* Initialize CLI configuration: */ | /* Initialize CLI configuration: */ | ||||
config.initialRadialVelocity = 0; // for OUTDOOR, detected targets velocity is unknown | |||||
config.initialRadialVelocity = 0; // for OUTDOOR, detected targets velocity is unknown | |||||
config.maxAcceleration[0] = 1.0f; | config.maxAcceleration[0] = 1.0f; | ||||
config.maxAcceleration[1] = 1.0f; | config.maxAcceleration[1] = 1.0f; | ||||
config.maxAcceleration[2] = 1.0f; | config.maxAcceleration[2] = 1.0f; | ||||
break; | |||||
break; | |||||
case TRACKING_CEILING_MOUNT_PARAM_SET: | case TRACKING_CEILING_MOUNT_PARAM_SET: | ||||
/* Initialize CLI configuration: */ | /* Initialize CLI configuration: */ | ||||
return -1; | return -1; | ||||
} | } | ||||
#ifdef GTRACK_3D | #ifdef GTRACK_3D | ||||
config.stateVectorType = GTRACK_STATE_VECTORS_3DA; // Track three dimensions with acceleration | |||||
config.stateVectorType = GTRACK_STATE_VECTORS_3DA; // Track three dimensions with acceleration | |||||
#else | #else | ||||
config.stateVectorType = GTRACK_STATE_VECTORS_2DA; // Track two dimensions with acceleration | |||||
config.stateVectorType = GTRACK_STATE_VECTORS_2DA; // Track two dimensions with acceleration | |||||
#endif | #endif | ||||
config.verbose = GTRACK_VERBOSE_NONE; | |||||
config.maxNumPoints = (uint16_t) atoi(argv[3]); | |||||
config.maxNumTracks = (uint16_t) atoi(argv[4]); | |||||
config.maxRadialVelocity = (float) atoi(argv[5]) *0.1f; | |||||
config.verbose = GTRACK_VERBOSE_NONE; | |||||
config.maxNumPoints = (uint16_t) atoi(argv[3]); | |||||
config.maxNumTracks = (uint16_t) atoi(argv[4]); | |||||
config.maxRadialVelocity = (float) atoi(argv[5]) *0.1f; | |||||
#ifndef GTRACK_3D | #ifndef GTRACK_3D | ||||
config.radialVelocityResolution = (float) atoi(argv[6]) *0.001f; | |||||
config.radialVelocityResolution = (float) atoi(argv[6]) *0.001f; | |||||
#endif | #endif | ||||
config.deltaT = (float) atoi(argv[7]) *0.001f; | |||||
config.deltaT = (float) atoi(argv[7]) *0.001f; | |||||
/* Save Configuration to use later */ | /* Save Configuration to use later */ | ||||
memcpy((void *)&gMmwMssMCB.trackerCfg.trackerDpuCfg.staticCfg.gtrackModuleConfig, (void *)&config, sizeof(GTRACK_moduleConfig)); | memcpy((void *)&gMmwMssMCB.trackerCfg.trackerDpuCfg.staticCfg.gtrackModuleConfig, (void *)&config, sizeof(GTRACK_moduleConfig)); |
DebugP_log0("ObjDet DPC: Pre-start Common Config IOCTL processed\n"); | DebugP_log0("ObjDet DPC: Pre-start Common Config IOCTL processed\n"); | ||||
} | } | ||||
#ifdef TRACKERPROC_EN | #ifdef TRACKERPROC_EN | ||||
else if (cmd == DPC_OBJDETRANGEHWA_IOCTL__STATIC_TRACKER_CFG) | |||||
else if (cmd == DPC_OBJDETRANGEHWA_IOCTL__STATIC_TRACKER_CFG) | |||||
{ | { | ||||
//System_printf("Entering Tracker Config"); | //System_printf("Entering Tracker Config"); | ||||
DPC_ObjectDetection_TrackerConfig *cfg; | DPC_ObjectDetection_TrackerConfig *cfg; |