Browse Source

3D Server - New Flip Alg Tested and Updated

AGP
Gagua on MyIR master 7 years ago
parent
commit
2417542eeb
  1. 1
      .gitignore
  2. 58
      Projects/LRF_Server/Debug/default.conf
  3. 219
      lib/App/3dSERVER/LRF_HardwareManager.cpp
  4. 6
      lib/App/3dSERVER/LRF_HardwareManager.h
  5. 4
      lib/App/3dSERVER/LRF_Kernel.cpp
  6. 3
      lib/App/3dSERVER/LRF_targetTracker.cpp
  7. 18
      lib/data/net/serverPort.cpp
  8. 4
      lib/data/protocol/protocolLGS.cpp
  9. 47
      lib/hardware/soc/general/3DLRF.h
  10. 9
      lib/pru/core11/main_core11.c
  11. 2
      put_to_git

1
.gitignore

@ -7,6 +7,7 @@
*.pdb
*.opensdf
*.suo
*.bak
*~
/Projects/QT-Gui-App/swscale-4.dll
/Projects/QT-Gui-App/swresample-2.dll

58
Projects/LRF_Server/Debug/default.conf

@ -0,0 +1,58 @@
NETWORK_SERVER :
{
NW_HOSTNAME_IP = "localhost";
NW_LISTEN_PORT = 2222;
};
HARDWARE_MANAGER :
{
DUMP_TH_ON_DISK = false;
MASTER_ROLE = true;
SUNBIT_ENABLE = false;
LRF_ENABLED = true;
SIG_SYM_ENABLE = false;
MOTORS_AUTOSTART = false;
VERTICAL_MOTOR_CTRL = false;
HORIZONTAL_MOTOR_CTRL = false;
VERTICAL_ENC_FREQ = 57600;
HORIZONTAL_ENC_FREQ = 4000;
LRF_PULSES_INTERLEAVE = 4;
TH_OFFSET = 32;
TH_ORDER = 3;
TH_DELTA = 64;
TH_FLIP = 16;
TH_GOOD_POINTS = 8;
TH_GENERATED_BY_PRU = true;
TH_SPIKE_SIZE = 1;
CAN_BUS_ENABLE = false;
CAN_BUS_ID = 1;
CAN_MY_ID = 768;
CAN_TGZ_ID = 769;
TGZ_MIRROR_SPEED = 14400;
TGZ_BASE_SPEED = 250;
BASE_SHIFT = 0;
MIRROR_SHIFT = 0;
};
KERNEL :
{
ENABLE_SAFE_SHORE = false;
ENABLE_DEFENDER = true;
DETECTOR_WIDTH = 1000;
ENABLED_LRF = 255;
DETECTOR_SST = 0;
SAFESHORE_CONNECTION :
{
CURL_POST_CONTENT_TYPE = "application/xml";
SCANNER_NAME = "LRF_2D_001";
SCANNER_DIMENTIONS = 2;
LCU_IP_ADDRESS = "192.168.200.204";
LCU_IP_PORT = 80;
};
DEFENDER_CONNECTION :
{
CURL_POST_CONTENT_TYPE = "application/json";
SCANNER_NAME = "LRF_3D_001";
SCANNER_DIMENTIONS = 3;
CEP_IP_ADDRESS = "192.168.200.125";
CEP_IP_PORT = 80;
};
};

219
lib/App/3dSERVER/LRF_HardwareManager.cpp

@ -39,6 +39,7 @@ LRF_HardwareManager::LRF_HardwareManager( config_setting_t *SNode ){
#ifdef THREADED_FLIP
m_pFlipThreadHandler = NULL;
m_bWaitFirstFlip = true;
m_bFlipUnlockRequested = false;
m_pFlipMutex = (pthread_mutex_t *) malloc(sizeof(pthread_mutex_t));
if( m_pFlipMutex != NULL ) {
@ -978,6 +979,7 @@ void LRF_HardwareManager::beginService( void ){
m_bInitOK = false;
return;
};
memset( m_bTHSteadyCounter, ( m_sCP_Detector.flip_size && 0xFF ), KERNEL_COUNT);
m_bInitOK = true;
};
};
@ -1650,8 +1652,10 @@ bool LRF_HardwareManager::validateCores( void ){
};
#endif
#ifdef THREADED_FLIP
if(m_bFlipUnlockRequested){
// LOG("Unlocking Flip protecting Mutex");
if( m_bFlipUnlockRequested ){
#ifdef DEBUG
LOG("Unlocking Flip protecting Mutex");
#endif
if( m_pFlipMutex != NULL ){
if( 0 != pthread_mutex_unlock( m_pFlipMutex ) ){
LOG_ERROR("Error Unlocking Flip protecting Mutex!");
@ -1662,7 +1666,7 @@ bool LRF_HardwareManager::validateCores( void ){
#endif
if( m_sCS_Detector.req ) {
#ifdef DEBUG
// LOG("Detector CORE REQ");
LOG("Detector CORE REQ");
#endif
uint32_t mCoreReq;
mCoreReq = m_pSOC->getThCoreRequest();
@ -1671,30 +1675,35 @@ bool LRF_HardwareManager::validateCores( void ){
#ifdef THREADED_FLIP
if( m_pFlipMutex != NULL ) {
if( 0 == pthread_mutex_trylock( m_pFlipMutex ) ){
if( 0 != pthread_detach( *m_pFlipThreadHandler ) ){
LOG_ERROR("Thread Detach Failed!");
pthread_mutex_unlock( m_pFlipMutex );
};
if( !m_bWaitFirstFlip ) {
if( 0 != pthread_detach( *m_pFlipThreadHandler ) ){
LOG_ERROR("Thread Detach Failed!");
pthread_mutex_unlock( m_pFlipMutex );
};
} else m_bWaitFirstFlip = false;
#ifdef DEBUG
LOG("Build Working Threshold Memories MT Mode!");
#endif
if( 0 != pthread_create( m_pFlipThreadHandler, NULL, m_fFlipThreadFunction, ( void * ) this ) ) {
LOG_ERROR("Thread Creation Faled.");
pthread_mutex_unlock( m_pFlipMutex );
};
#ifdef DEBUG
// LOG("TH Flip Thread Started");
LOG("TH Flip Thread Started");
#endif
} else {
#ifdef DEBUG
// LOG("TH Flip Request Overlapped!");
LOG("TH Flip Request Overlapped!");
#endif
};
}
#else
#ifdef DEBUG
// LOG("Build Working Threshold Memories");
LOG("Build Working Threshold Memories NT Mode!");
#endif
if( performFlip() ){
#ifdef DEBUG
// LOG("CORE REQ Done.");
LOG("CORE REQ Done.");
#endif
} else {
LOG_ERROR("Building Detector's TH Error!");
@ -1840,26 +1849,27 @@ void *LRF_HardwareManager::m_fFlipThreadFunction( void *ptr ){
static uint32_t m_sgnFlipCounter = 0;
#ifdef TH_NEW_FLIP_FUNC
bool LRF_HardwareManager::performFlip( void ){
if( !m_bInitOK ) return false;
if( m_pSOC != NULL ){
#ifdef TH_PER_MIRROR
volatile thresholdNode *th_node[40];
#else
volatile thresholdNode *th_node[16];
<<<<<<< HEAD
uint32_t LBA_ID;
uint8_t LRF_ID;
uint32_t cMax;
uint32_t cMin;
thresholdNode tTN;
int32_t cNodeID;
int32_t sNodeID; // Start point
bool QAreaOK;
const uint8_t Orders = m_sPARAMETERS.nOrder+1;
int x,y;
char Buffer[256];//Used also in Event!!
volatile thresholdNode * th_node[16];
uint32_t LBA_ID;
uint8_t LRF_ID;
uint32_t cMax;
uint32_t cMin;
thresholdNode tTN;
int32_t cNodeID;
int32_t sNodeID; // Start point
bool QAreaOK;
th_node[0] = (volatile thresholdNode *) m_pSOC->getTH_MEMORY();
#ifdef DEBUG
sprintf( Buffer, "NF TH pointer is: %p", th_node );
LOG( Buffer );
#endif
if( th_node[0] != NULL ){
th_node[1] = th_node[0]+ TH_SIZE_NODES;
th_node[2] = th_node[1]+ TH_SIZE_NODES;
@ -1876,36 +1886,60 @@ bool LRF_HardwareManager::performFlip( void ){
th_node[13] = th_node[12]+ TH_SIZE_NODES;
th_node[14] = th_node[13]+ TH_SIZE_NODES;
th_node[15] = th_node[14]+ TH_SIZE_NODES;
m_nGPointsFlags = 0xFF;
for( LRF_ID=0; LRF_ID<KERNEL_COUNT; LRF_ID++ ){
//Filter Kernel
// Set All TH as full of Good Points
m_nGPointsFlags = m_nKernelFilter; //0xFF
for( LRF_ID = 0; LRF_ID<KERNEL_COUNT; LRF_ID++ ){
//Filter Disabled Kernels
if( ((1 << LRF_ID ) & m_nKernelFilter ) == 0 ) continue;
for(LBA_ID = 0; LBA_ID < TH_SIZE_NODES; LBA_ID++) {
// Begin Scan Threshold
#ifdef DEBUG
sprintf( Buffer, "Building WTH for %dth Kernel", LRF_ID );
LOG( Buffer );
#endif
for( LBA_ID = 0; LBA_ID < TH_SIZE_NODES; LBA_ID++ ){
uint32_t LocalStrideX = LBA_ID % TH_LINE_NODES;
uint32_t LocalStrideY = LBA_ID \ TH_LINE_NODES;
uint32_t LocalStrideY = LBA_ID / TH_LINE_NODES;
// Get Central TH Point
tTN.data = th_node[LRF_ID][LBA_ID].data;
// if point was blocked by SunBit
if( tTN.values.sbit ) {
tTN.values.sbit = 0;
tTN.values.cnt = 0;
tTN.values.min = 0;
tTN.values.max = 4095;
for( int x = -m_sPARAMETERS.nOrder; x < (m_sPARAMETERS.nOrder+1); x++ ) {
for( int y = -m_sPARAMETERS.nOrder; y < (m_sPARAMETERS.nOrder+1); y++ ) {
int LocalX = LocalStrideX+x;
int LocalY = LocalStrideY+y;
if( LocalY < 0 ) LocalY += Q_SCAN_COUNT;
if( LocalY >= Q_SCAN_COUNT ) LocalY -= Q_SCAN_COUNT;
if( LocalX < 0 ) LocalX += M_SCAN_POINTS;
if( LocalX >= TH_LINE_NODES ) LocalX -= TH_LINE_NODES;
uint32_t CleanID = ( LocalY * TH_LINE_NODES ) + LocalX;
th_node[8|LRF_ID][CleanID].data = tTN.data;
};
};
continue;
};
// if point was measured
#ifdef STRONG_STAT
if( tTN.values.cnt >= m_sPARAMETERS.nGPointSamples ){
if( tTN.values.cnt >= m_sPARAMETERS.nGPointSamples ){
#else
if( tTN.values.cnt ){
#endif
cMax = 0;
cMin = 4095;
QAreaOK = true;
for( x = -m_sPARAMETERS.nOrder; x < Orders; x++ ) {
for( y = -m_sPARAMETERS.nOrder; y < Orders; y++ ) {
for( int x = -m_sPARAMETERS.nOrder; x < (m_sPARAMETERS.nOrder+1); x++ ) {
for( int y = -m_sPARAMETERS.nOrder; y < (m_sPARAMETERS.nOrder+1); y++ ) {
int LocalX = LocalStrideX+x;
int LocalY = LocalStrideY+y;
if( LocalY < 0 ) LocalY += Q_SCAN_COUNT;
if( LocalY > Q_SCAN_COUNT ) LocalY -= Q_SCAN_COUNT;
if( LocalY >= Q_SCAN_COUNT ) LocalY -= Q_SCAN_COUNT;
if( LocalX < 0 ) LocalX += M_SCAN_POINTS;
if( LocalX > M_SCAN_POINTS ) LocalX -= M_SCAN_POINTS;
uint32_t TestID = LBA_ID + ( LocalY * TH_LINE_NODES ) + LocalX;
if( LocalX >= TH_LINE_NODES ) LocalX -= TH_LINE_NODES;
uint32_t TestID = ( LocalY * TH_LINE_NODES ) + LocalX;
tTN.data = th_node[LRF_ID][TestID].data;
#ifdef STRONG_STAT
@ -1931,8 +1965,14 @@ bool LRF_HardwareManager::performFlip( void ){
tTN.values.cnt = 0;
tTN.values.min = 0;
tTN.values.max = 4095;
#ifdef STRONG_STAT
// Clear GoodPoint Flags at not complete TH Measurement
// Turn off TH Clean
m_nGPointsFlags &= ~( 1 << LRF_ID );
#endif
};
} else { // Not Enought points in values.cnt
} else {
// Not Enought points in values.cnt
// disable detection of that point
tTN.values.cnt = 0;
#ifndef TH_JUST_UPDATE_WORKING
@ -1940,6 +1980,7 @@ bool LRF_HardwareManager::performFlip( void ){
tTN.values.max = 4095;
#endif
// Clear GoodPoint Flags at not measured point
// Turn off TH Clean
m_nGPointsFlags &= ~( 1 << LRF_ID );
};
#ifdef TH_JUST_UPDATE_WORKING
@ -1952,19 +1993,96 @@ bool LRF_HardwareManager::performFlip( void ){
#endif
};
};
return true;
#ifdef DEBUG
LOG("Finish Cycle");
#endif
#ifdef TH_FORCED_BOOM_CLEAN
for( LRF_ID = 0; LRF_ID < KERNEL_COUNT; LRF_ID++ ){
if( m_nFlipEnaFLags & (1<<LRF_ID) ){
if( m_bTHSteadyCounter[LRF_ID] ){
m_bTHSteadyCounter[LRF_ID] --;
} else {
#ifdef DEBUG
sprintf( Buffer, "Cleanup TH%d", LRF_ID );
LOG(Buffer);
#endif
cleanTH( LRF_ID );
#ifdef DEBUG
sprintf( Buffer, "Done Cleanup TH%d", LRF_ID );
LOG( Buffer );
#endif
m_bTHSteadyCounter[LRF_ID] = m_sCP_Detector.good_points;
};
};
};
#endif //TH_FORCED_BOOM_CLEAN
// To perform cleaning of Threshold next time
m_nFlipEnaFLags = m_nGPointsFlags;
// To Enable Detection
m_nDetectionFilter |= m_nGPointsFlags;
m_sgnFlipCounter++;
sprintf( Buffer, "Flip#%d is Done: 0x%X", m_sgnFlipCounter, m_nFlipEnaFLags );
#ifdef DEBUG
LOG( Buffer );
#endif
if( m_bDumpMemoryToDisk && ( ( m_sgnFlipCounter % 6 ) == 0 ) ) {
thresholdNode *tNode;
thresholdNode *rNode;
rNode = tNode = (thresholdNode *) m_pSOC->getTH_MEMORY();
if( tNode != NULL ) {
LOG( "Save Memory Dump!");
FILE *fd;
char tName[64];
for( int index = 0; index < KERNEL_COUNT; index++ ) {
sprintf( tName, "memdump_%03d-%02d.raw", nMemoryDumpID, index );
fd = fopen(tName, "wb+");
if( fd != NULL ) {
uint32_t tSize;
tSize = TH_SIZE_NODES;
fwrite( &tSize, sizeof(uint32_t), 1, fd );
fwrite( tNode, sizeof(thresholdNode), TH_SIZE_NODES, fd );
fclose(fd);
} else {
LOG_ERROR( "Mem Dump Failure!");
};
tNode += TH_SIZE_NODES;
};
nMemoryDumpID++;
};
};
basicEvent *tEvt = createBasicEvent( 0, EVT_CLASS_SENSOR, EVT_FLIP, Buffer, NULL );
if( tEvt != NULL ){
basicEventHeap::getInstance()->broadcast( tEvt );
// Evt utilisation done by EventHeap thread
tEvt = NULL;
};
#ifdef HIBERNATE_ENABLE
return saveHibernatedTH();
#else
return true;
#endif
} else {
LOG_ERROR("Cannot access TH Memory!");
};
} else {
LOG_ERROR("No SOC Object!");
};
return false;
};
bool LRF_HardwareManager::performFlip___( void ){
#else // TH_NEW_FLIP_FUNC == 0
bool LRF_HardwareManager::performFlip( void ){
if( !m_bInitOK ) return false;
if( m_pSOC != NULL ){
if( m_pSOC != NULL ){
char Buffer[256];
#ifdef TH_PER_MIRROR
volatile thresholdNode *th_node[40];
#else
volatile thresholdNode *th_node[16];
=======
#endif
>>>>>>> 1b7de403432a292b2a4962f7b9f88d76f897df9e
uint32_t sampleID;
uint8_t lrfID;
uint32_t cMax;
@ -2017,7 +2135,8 @@ bool LRF_HardwareManager::performFlip___( void ){
th_node[38] = th_node[37]+ TH_SIZE_NODES;
th_node[39] = th_node[38]+ TH_SIZE_NODES;
#endif
sprintf( Buffer, "OF TH pointer is: %p", th_node );
LOG( Buffer );
m_nGPointsFlags = 0xFF;
#ifdef DEBUG
//LOG("Performing FLIP in HOST SOC");
@ -2116,7 +2235,6 @@ bool LRF_HardwareManager::performFlip___( void ){
for( lrfID = 0; lrfID < KERNEL_COUNT; lrfID++ ){
if( m_nFlipEnaFLags & (1<<lrfID) ){
#ifdef DEBUG
char Buffer[64];
sprintf( Buffer, "Cleanup TH%d", lrfID );
LOG(Buffer);
#endif
@ -2132,8 +2250,6 @@ bool LRF_HardwareManager::performFlip___( void ){
m_nFlipEnaFLags = m_nGPointsFlags;
// To Enable Detection
m_nDetectionFilter |= m_nGPointsFlags;
char Buffer[256];
m_sgnFlipCounter++;
sprintf( Buffer, "Flip#%d is Done: 0x%X", m_sgnFlipCounter, m_nFlipEnaFLags );
#ifdef DEBUG
@ -2181,6 +2297,7 @@ bool LRF_HardwareManager::performFlip___( void ){
};
return false;
};
#endif //TH_NEW_FLIP_FUNC
#ifdef HIBERNATE_ENABLE
bool LRF_HardwareManager::saveHibernatedTH( CSTR fname ){
@ -2237,7 +2354,7 @@ bool LRF_HardwareManager::cleanTH( uint8_t tID ){
thPtr = m_pSOC->getTH_MEMORY();
if( thPtr ){
thPtr += ( tID & 0x0F ) * TH_SIZE_NODES;
int index = 0;
int index = 0; // fl|Max|Min
for(; index < TH_SIZE_NODES; thPtr++, index++ ) *thPtr = 0x00000FFF;
return true;
};

6
lib/App/3dSERVER/LRF_HardwareManager.h

@ -124,9 +124,10 @@ class LRF_HardwareManager {
uint32_t m_iDataIndex;
uint32_t m_nKernelFilter;
void *m_vMemoryBlock[4];
classSOC *m_pSOC;
classSOC *m_pSOC;
bool performFlip();
bool performFlip___();
uint8_t m_bTHSteadyCounter[KERNEL_COUNT];
bool cleanTH( uint8_t tID );
void beginService( void );
void restartService( void );
@ -142,6 +143,7 @@ class LRF_HardwareManager {
static void *m_fFlipThreadFunction(void *);
pthread_mutex_t *m_pFlipMutex;
bool m_bFlipUnlockRequested;
bool m_bWaitFirstFlip;
#endif
#ifdef THREADED_MOTORS_START
pthread_t *m_pMotorCtrlThreadHandler;

4
lib/App/3dSERVER/LRF_Kernel.cpp

@ -328,12 +328,12 @@ void LRF_Kernel::m_fThreadProc( void ){
m_nThresholdSize = TH_SIZE_NODES;
m_pThreshold = (thresholdNode *) malloc( sizeof(thresholdNode)* m_nThresholdSize);
if( m_pThreshold!= NULL ) {
memcpy(m_pThreshold, ptr, m_nThresholdSize );
memcpy( m_pThreshold, ptr, m_nThresholdSize );
} else m_nThresholdSize = 0;
};
};
};
} else { //m_eWorkMode != WM_DETECTOR
} else { //m_eWorkMode == WM_DETECTOR
// Readout Events
int index;
bool bActiveRecordsPresent;

3
lib/App/3dSERVER/LRF_targetTracker.cpp

@ -187,6 +187,9 @@ int LRF_targetTracker::validateTarget( targetRecord *TR, bool bIsMaster ){
TRACKING_RECORD *pTREC;
char tBuff[256];
//LOG("Validate Target");
// Filter Width
if( TR->width < m_nWidth ) return 0;
m_nSTS++;
pTREC = createTrackingRecord( TR, bIsMaster );
if( pTREC == NULL ) {

18
lib/data/net/serverPort.cpp

@ -40,7 +40,7 @@ int serverPort::sendBlock(unsigned char *Data, int DataSize){
close( m_nSocketFD );
m_nSocketFD = -1;
m_bConnected = false;
//setConnectionStatus( CS_DISCONNECTED );
setConnectionStatus( CS_DISCONNECTED );
return -1;
};
if( RetVal < 0 ) RetVal = 0;
@ -51,7 +51,7 @@ int serverPort::sendBlock(unsigned char *Data, int DataSize){
} else {
LOG_ERROR("Not Connected!");
m_bConnected = false;
//setConnectionStatus( CS_DISCONNECTED );
setConnectionStatus( CS_DISCONNECTED );
return -1;
};
#else
@ -66,7 +66,7 @@ int serverPort::sendBlock(unsigned char *Data, int DataSize){
closesocket(m_nSocketFD);
WSACleanup();
m_bConnected = false;
//setConnectionStatus( CS_DISCONNECTED );
setConnectionStatus( CS_DISCONNECTED );
return -1;
};
#ifdef DUBUG_COMMUNICATION
@ -78,11 +78,11 @@ int serverPort::sendBlock(unsigned char *Data, int DataSize){
WSACleanup();
m_bConnected = false;
m_nSocketFD = INVALID_SOCKET;
//setConnectionStatus( CS_DISCONNECTED );
setConnectionStatus( CS_DISCONNECTED );
};
} else {
m_bConnected = false;
//setConnectionStatus( CS_DISCONNECTED );
setConnectionStatus( CS_DISCONNECTED );
return -1;
};
#endif
@ -95,7 +95,7 @@ int serverPort::recptBlock(unsigned char *Buffer, int *BufferLength){
LOG_ERROR("Not Connected!");
m_bInitComplete = false;
m_bConnected = false;
//setConnectionStatus( CS_DISCONNECTED );
setConnectionStatus( CS_DISCONNECTED );
return -1; // Exit after unsuccess reconnect
}
@ -115,7 +115,7 @@ int serverPort::recptBlock(unsigned char *Buffer, int *BufferLength){
*BufferLength = 0;
m_bConnected = false;
m_nSocketFD = -1;
//setConnectionStatus( CS_DISCONNECTED );
setConnectionStatus( CS_DISCONNECTED );
return -1;
};
};
@ -130,7 +130,7 @@ int serverPort::recptBlock(unsigned char *Buffer, int *BufferLength){
LOG_ERROR("Not Connected!");
*BufferLength = 0;
m_bConnected = false;
//setConnectionStatus( CS_DISCONNECTED );
setConnectionStatus( CS_DISCONNECTED );
return -1;
};
#else
@ -159,7 +159,7 @@ int serverPort::recptBlock(unsigned char *Buffer, int *BufferLength){
LOG_ERROR("Not Connected!");
*BufferLength = 0;
m_bConnected = false;
//setConnectionStatus( CS_DISCONNECTED );
setConnectionStatus( CS_DISCONNECTED );
return -1;
};
#endif

4
lib/data/protocol/protocolLGS.cpp

@ -431,10 +431,10 @@ bool protocolLGS_SERVER::sendBorderData(uint32_t SampleID, uint8_t KernelID, thr
thresholdNode cNode;
//cNode = WorkingSAF[node_index++];
memcpy( &cNode, &WorkingSAF[node_index++], sizeof(thresholdNode));
Buffer[index++] = (cNode.data >> 24 ) & 0xFF;
Buffer[index++] = (cNode.data >> 24 ) & 0xFE; // to clear Sunbit data
Buffer[index++] = (cNode.data >> 16 ) & 0xFF;
Buffer[index++] = (cNode.data >> 8 ) & 0xFF;
Buffer[index++] = cNode.data & 0xFF;
Buffer[index++] = cNode.data & 0xFF;
cCount++;
};
# ifdef DEBUG

47
lib/hardware/soc/general/3DLRF.h

@ -12,37 +12,8 @@ typedef enum E_LRF_WORK_MODE{
WM_ERROR = 0xFF
}LRF_WORK_MODE;
/* Moved to basicTypes.h
typedef enum E_INFO_SW_FLAGS{
SW_INFO_FLAG_MASTER = 0x00000001,
SW_INFO_NO_BLACK_TARGETS = 0x00000002,
SW_INFO_EU_PROJECT = 0x00000004,
SW_INFO_TGD_MOTORS = 0x00000008,
SW_INFO_DEBUG_MODE = 0x00000010,
SW_INFO_NO_TARGET_LOG = 0x00000020,
SW_INFO_HIBERNATE_ENA = 0x00000040,
SW_INFO_MOTOR_CTRL_ENA = 0x00000080,
SW_INFO_TGD_VER_2 = 0x00000100,
SW_INFO_THREAD_FLIP = 0x00000200
}INFO_SW_FLAGS;
typedef struct S_SOFTWARE_INFO{
uint32_t SW_MODE_FLAGS;
uint32_t SW_BUILD_DATE;
uint32_t FW_CORE1_VER;
uint32_t FW_CORE1_TYP;
uint32_t FW_CORE2_VER;
uint32_t FW_CORE2_TYP;
uint32_t FW_CORE3_VER;
uint32_t FW_CORE3_TYP;
uint32_t FW_CORE4_VER;
uint32_t FW_CORE4_TYP;
uint8_t DATA_VALID;
} SOFTWARE_INFO;
*/
#ifdef __linux__
extern SOFTWARE_INFO gsSOFT_INFO;
extern SOFTWARE_INFO gsSOFT_INFO;
#endif
#define SKIP_TARGET_LOG
@ -50,15 +21,19 @@ extern SOFTWARE_INFO gsSOFT_INFO;
#define THREADED_FLIP
#define TH_JUST_UPDATE_WORKING
#define TH_FORCED_BOOM_CLEAN
//#define TH_PER_MIRROR
#define TH_FULL_PER_LRF
#define TH_NEW_FLIP_FUNC
#define STRONG_STAT
#define TRACKER_INSTANT_TARGET
//#define TRACKER_FULL_COMPARE
//#define SIMULATE_TARGETS
//#define SIMULATE_FLIPS
#define CHECK_SUN_BIT
#define THREADED_MOTORS_START
#define NO_BLACK_TARGETS
#define SHIFT_50 683
//#define SHIFT_50 683
#define TGD
@ -81,7 +56,7 @@ extern SOFTWARE_INFO gsSOFT_INFO;
#define MINIMAL_DISTANCE_ADC 400 //~30 meters
//#define NO_MOTORS
//#define PRU_SLAVE
#define PRU_SLAVE
#ifndef ENCODER_8192
#define ENCODER_7200
@ -301,7 +276,12 @@ typedef union U_thresholdNode{
struct S_values{
uint32_t min: 12; // 11:0
uint32_t max: 12; // 23:12
#ifdef CHECK_SUN_BIT
uint32_t sbit: 1; // 24:24
uint32_t cnt: 7; // 32:25
#else
uint32_t cnt: 8; // 32:24
#endif
} values;
} thresholdNode;
@ -527,9 +507,6 @@ enum {
#define TH_2ZONES_SIZE_BYTES 0x1440000
*/
//#define TH_PER_MIRROR
#define TH_FULL_PER_LRF
#ifndef TH_FULL_PER_LRF
#define TH_PER_LRF
#endif

9
lib/pru/core11/main_core11.c

@ -653,12 +653,14 @@ soft_reset:
// m_sCurrentThresholdNode.values.max = 0;
// m_sCurrentThresholdNode.values.min = 4095;
// detector will clear values on first measure
m_sCurrentThresholdNode.values.sbit = 1;
m_sCurrentThresholdNode.values.cnt = 0;
#ifndef TH_PER_MIRROR
th_node[ index ][cSampleID] = m_sCurrentThresholdNode;
#else
th_node[ m_nMirrorID | index ][cSampleID] = m_sCurrentThresholdNode;
#endif
// Cleaning node in Working TH!
th_node[ WORKING_TH_MASK | index ][cSampleID] = m_sCurrentThresholdNode;
} else {
# endif
@ -696,7 +698,12 @@ soft_reset:
// Get Working MinMax Values
m_sCurrentThresholdNode = th_node[ WORKING_TH_MASK | index ][cSampleID];
// If Working TH Node is Valid
# ifdef CHECK_SUN_BIT
bSunBit = th_node[ index ][cSampleID].values.sbit;
if( m_sCurrentThresholdNode.values.cnt != 0 && bSunBit == 0 ){
# else
if( m_sCurrentThresholdNode.values.cnt != 0 ){
# endif
// Check Current Measured Values
if( m_nSignal > m_sCurrentThresholdNode.values.max ){
// Target Freeze TH Black Target
@ -789,7 +796,7 @@ soft_reset:
m_sCurrentThresholdNode.values.max = m_nSignal;
m_sCurrentThresholdNode.values.min = m_nSignal;
};
m_sCurrentThresholdNode.values.cnt++; // cnt = 8 bit 0 - 256
m_sCurrentThresholdNode.values.cnt++; // cnt = 7 bit 0 - 127
#ifdef TH_PER_MIRROR
th_node[ m_nMirrorID | index ][cSampleID] = m_sCurrentThresholdNode;
#else

2
put_to_git

@ -1,4 +1,4 @@
#!/bin/bash
#git commit -a -m '$1'
git commit -a -m '3D Server - New Flip Alg'
git commit -a -m '3D Server - New Flip Alg Tested and Updated'
Loading…
Cancel
Save