Browse Source

3D Server - New Flip Alg

Gagua on MyIR master 7 years ago
parent
commit
581e124c91
  1. 117
      lib/App/3dSERVER/LRF_HardwareManager.cpp
  2. 1
      lib/App/3dSERVER/LRF_HardwareManager.h
  3. 2
      put_to_git

117
lib/App/3dSERVER/LRF_HardwareManager.cpp

@ -1847,7 +1847,124 @@ bool LRF_HardwareManager::performFlip( void ){
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;
th_node[0] = (volatile thresholdNode *) m_pSOC->getTH_MEMORY();
if( th_node[0] != NULL ){
th_node[1] = th_node[0]+ TH_SIZE_NODES;
th_node[2] = th_node[1]+ TH_SIZE_NODES;
th_node[3] = th_node[2]+ TH_SIZE_NODES;
th_node[4] = th_node[3]+ TH_SIZE_NODES;
th_node[5] = th_node[4]+ TH_SIZE_NODES;
th_node[6] = th_node[5]+ TH_SIZE_NODES;
th_node[7] = th_node[6]+ TH_SIZE_NODES;
th_node[8] = th_node[7]+ TH_SIZE_NODES;
th_node[9] = th_node[8]+ TH_SIZE_NODES;
th_node[10] = th_node[9]+ TH_SIZE_NODES;
th_node[11] = th_node[10]+ TH_SIZE_NODES;
th_node[12] = th_node[11]+ TH_SIZE_NODES;
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
if( ((1 << LRF_ID ) & m_nKernelFilter ) == 0 ) continue;
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;
// Get Central TH Point
tTN.data = th_node[LRF_ID][LBA_ID].data;
// if point was measured
#ifdef STRONG_STAT
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++ ) {
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 > M_SCAN_POINTS ) LocalX -= M_SCAN_POINTS;
uint32_t TestID = LBA_ID + ( LocalY * TH_LINE_NODES ) + LocalX;
tTN.data = th_node[LRF_ID][TestID].data;
#ifdef STRONG_STAT
if( tTN.values.cnt >= m_sPARAMETERS.nGPointSamples ){
#else
if( tTN.values.cnt ){
#endif
if( cMax < tTN.values.max ) cMax = tTN.values.max;
if( cMin > tTN.values.min ) cMin = tTN.values.min;
} else {
QAreaOK = false;
break;
};
};
if( !QAreaOK ) break;
};
if( QAreaOK ){
tTN.values.cnt = 0x0F;
tTN.values.min =(cMin>m_sCP_Detector.offset)?cMin-m_sCP_Detector.offset:0;
tTN.values.max =(cMax<(4095-m_sCP_Detector.offset))?cMax+m_sCP_Detector.offset:4095;
} else {
// disable detection of that point
tTN.values.cnt = 0;
tTN.values.min = 0;
tTN.values.max = 4095;
};
} else { // Not Enought points in values.cnt
// disable detection of that point
tTN.values.cnt = 0;
#ifndef TH_JUST_UPDATE_WORKING
tTN.values.min = 0;
tTN.values.max = 4095;
#endif
// Clear GoodPoint Flags at not measured point
m_nGPointsFlags &= ~( 1 << LRF_ID );
};
#ifdef TH_JUST_UPDATE_WORKING
// Just Update - Without Remove TH Old Info
if( tTN.values.cnt ){
th_node[8|LRF_ID][LBA_ID].data = tTN.data;
};
#else
th_node[8|LRF_ID][LBA_ID].data = tTN.data;
#endif
};
};
return true;
};
};
return false;
};
bool LRF_HardwareManager::performFlip___( void ){
if( !m_bInitOK ) return false;
if( m_pSOC != NULL ){
volatile thresholdNode *th_node[16];
=======
#endif
>>>>>>> 1b7de403432a292b2a4962f7b9f88d76f897df9e
uint32_t sampleID;
uint8_t lrfID;
uint32_t cMax;

1
lib/App/3dSERVER/LRF_HardwareManager.h

@ -126,6 +126,7 @@ class LRF_HardwareManager {
void *m_vMemoryBlock[4];
classSOC *m_pSOC;
bool performFlip();
bool performFlip___();
bool cleanTH( uint8_t tID );
void beginService( void );
void restartService( void );

2
put_to_git

@ -1,4 +1,4 @@
#!/bin/bash
#git commit -a -m '$1'
git commit -a -m '3D Server - Corrected CAN Bus object to start communication thread'
git commit -a -m '3D Server - New Flip Alg'
Loading…
Cancel
Save