Old fashion design for PC-104
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

182 lines
5.3 KiB

4 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
4 years ago
​
​
​
4 years ago
​
​
​
4 years ago
​
​
​
4 years ago
​
​
4 years ago
​
​
​
4 years ago
​
​
4 years ago
​
4 years ago
​
4 years ago
​
​
​
​
​
4 years ago
​
​
​
​
​
​
​
​
​
​
​
4 years ago
​
​
​
​
​
​
​
​
4 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
4 years ago
​
​
​
4 years ago
​
4 years ago
​
​
​
​
​
​
​
​
​
​
​
4 years ago
​
​
​
​
​
​
​
​
4 years ago
​
​
  1. //----------------------------------------------------------------------------
  2. // Laser Guard Ltd.
  3. // Copyright � 2000-2002. All Rights Reserved.
  4. // Version 1.0 01/01/2000
  5. // Last modification: 08/10/2003
  6. // PROJECT:
  7. // SUBSYSTEM:
  8. // FILE: Detector.h
  9. // AUTHOR: Sergey Chizhevskiy
  10. // OVERVIEW
  11. // ~~~~~~~~
  12. // Header file of Detector.h
  13. //----------------------------------------------------------------------------
  14. #ifndef __DETECTOR__H__INCLUDED__
  15. #define __DETECTOR__H__INCLUDED__
  16. #include "StdAfx.h"
  17. #include "..\lglib\comm\lgsm.h"
  18. #include "stream.h"
  19. #include "shadow.h"
  20. #include "tracker.h"
  21. #include "filters.h"
  22. typedef struct LGS_SETTINGS
  23. {
  24. LONG nOrder;
  25. LONG nOffset;
  26. LONG nDelta;
  27. LONG nWidth;
  28. LONG nFlip;
  29. LONG nShift;
  30. LONG nSun;
  31. }LGS_SETTINGS;
  32. class CDetector
  33. {
  34. public:
  35. CDetector();
  36. ~CDetector();
  37. public:
  38. BOOL Create( BOOL bDisabled, CTracker *pTracker, CShadow *pShadow, INT nShift, INT nOrder, INT nOffset, INT nDelta, INT nWidth, INT nFlip, INT nSun, INT nLevelSST );
  39. BOOL Create( BOOL bDisabled, CTracker *pTracker, CShadow *pShadow, INT nShift, PCHAR pFileName );
  40. void Destroy();
  41. public:
  42. BOOL Reset( BOOL bFullReset );
  43. void GetParameters( LGS::LGS_PARAMETERS *pParameters );
  44. void SetParameters( LGS::LGS_PARAMETERS *pParameters );
  45. public:
  46. void Invalidate( BOOL bZero, BOOL bSun, INT Range, BOOL bAllowFlip );
  47. BOOL IsAllowFlip() { return m_bAllowFlip; }
  48. public:
  49. BOOL GetLastErrorSun() { return m_FilterSun.GetLastErrorSun(); }
  50. BOOL GetLastErrorAngle() { BOOL bError = m_bErrorAngle; m_bErrorAngle = FALSE; return bError; }
  51. INT GetLastErrorAngleValue() { INT nAngle = m_nErrorAngle; m_nErrorAngle = 0; return nAngle; }
  52. public:
  53. void BorderEnable( BOOL bEnable );
  54. BOOL GetBorderRange( INT nAngle, PINT pRange );
  55. public:
  56. BOOL GetFullBorderRange( INT nAngle, PINT pRange );
  57. public:
  58. CFilterWidth *GetFilterWidth() { return &m_FilterWidth; }
  59. public:
  60. typedef struct SAF
  61. {
  62. INT nMax;
  63. INT nMin;
  64. }SAF, far* LPSAF;
  65. public:
  66. typedef struct QPD
  67. {
  68. BYTE nOffset;
  69. BYTE nOrder;
  70. }QPD, far* LPQPD;
  71. #ifndef INCLUDE_WINDOWS_DEFINITIONS
  72. public:
  73. #else
  74. private:
  75. #endif
  76. LPSAF m_ppSAF[3]; // check max and min
  77. LPQPD m_ppQPD[2]; // quality point description
  78. INT m_nActiveSAF; // stores number active SAF (detection SAF)
  79. INT m_nActiveSAFReady; // holds amount of angles remainig until SAF threshold calculation stops
  80. INT m_nAngle; // current phisical angle ( according to encoder )
  81. BOOL m_bWaitFirstZero; // used during waiting first ZERO
  82. BOOL m_bWaitFirstSAF; // used during waiting first SAF (area studing)
  83. INT m_nFlip; // stores number rounds before flip
  84. INT m_nFlipLoopSAF; // stores number of angles after SAF start
  85. BOOL m_bSemiFlip; // perform flip into to stages (for making more linear calculation power consumption)
  86. BOOL m_bAllowFlip; // prevent simultaneous flip
  87. BOOL m_bTarget; // indicate that before this angle was target
  88. INT m_nTargetRange; // stores last target range
  89. LONG m_nTargetWidth; // used for accumulate target sun width
  90. LONG m_nTargetDelta; // used for accumulate target deltas
  91. LONG m_nTargetCount; // used for colculating target angle width
  92. BOOL m_bTargetWhite; // used for delta calculation
  93. // spikes algorithm
  94. INT m_nSpikeCount; // amount of spikes per current loop
  95. INT m_nSpikeTempCount; // temporary storage for spikes amount during target building
  96. // calculate long spikes to minimum (fog)
  97. INT m_nSpikeFogCount;
  98. INT m_nSpikeFogTempCount;
  99. BOOL m_bSpikeFogBlind;
  100. BOOL m_bSpikeFogNoTarget;
  101. INT m_pSpikeHistory[ LGS_MAX_SPIKE_HISTORY ];
  102. INT m_nSpikeHistoryPosition;
  103. INT m_nSpikeHistoryCount;
  104. INT m_nSpikeHistoryMax;
  105. INT m_nFlipWaitHistory; // left FLIPs before floating starts
  106. INT m_nFloatFlip; // floating flip
  107. INT m_nFlipCounter;
  108. LPINT m_lpBorder;
  109. INT m_nBorderRangeCount;
  110. LONG m_nBorderRangeSum;
  111. BOOL m_bBorderEnable;
  112. INT m_nBorderAngle;
  113. LONG m_nBorderSector;
  114. BOOL m_bBorderWaitZero;
  115. BOOL m_bSkipDetection; // to perform soft reset
  116. // filters
  117. CFilterSun m_FilterSun;
  118. CFilterMediumRange m_FilterMediumRange;
  119. CFilterPD m_FilterPD;
  120. CFilterWidth m_FilterWidth;
  121. private:
  122. CShadow *m_pShadow; // plaseholder for hiddenzones
  123. CTracker *m_pTracker; // scan to scan tracking
  124. private:
  125. BOOL m_bErrorAngle; // error angle
  126. INT m_nErrorAngle; // error angle
  127. BOOL m_bShowErrorAngle; // prevent angle error immidiatly after reset
  128. private:
  129. LGS_SETTINGS m_Settings; // settings
  130. CHAR m_pSettingsFileName[LGS_MAX_SETTINGS_FILENAME];
  131. #ifndef INCLUDE_WINDOWS_DEFINITIONS
  132. public:
  133. enum{ SPIKE_NONE = 0, SPIKE_BEFORE_SST, SPIKE_AFTER_SST };
  134. typedef struct SPIKE
  135. {
  136. INT nType;
  137. INT nRange;
  138. };
  139. inline INT SAFGetActive() { return m_nActiveSAF; }
  140. inline SAF& SAFGetSAF( INT nSAF, INT nAngle ) { return m_ppRealSAF[nSAF][nAngle]; }
  141. inline SPIKE& SAFGetSpike( INT nAngle ) { return m_pSpike[nAngle]; }
  142. inline BOOL SAFIsReady() { return (!m_bWaitFirstSAF) && (m_nFlip != m_Settings.nFlip); }
  143. private:
  144. SAF m_ppRealSAF[2][ LGS_MAX_DETECTOR_ANGLES ];
  145. SPIKE m_pSpike[ LGS_MAX_DETECTOR_ANGLES ];
  146. #endif
  147. private:
  148. BOOL m_bDisabled;
  149. private:
  150. BOOL m_bBlind180;
  151. };
  152. #endif