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.

143 lines
5.0 KiB

7 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
6 years ago
6 years ago
6 years ago
​
​
​
​
​
​
​
​
​
​
7 years ago
​
​
​
​
​
​
​
​
7 years ago
​
​
​
​
​
​
​
​
​
​
​
​
7 years ago
​
​
​
​
​
​
​
​
​
6 years ago
7 years ago
6 years ago
​
​
​
​
​
​
​
​
6 years ago
​
6 years ago
​
6 years ago
6 years ago
​
7 years ago
​
​
​
​
​
​
7 years ago
​
​
6 years ago
​
6 years ago
​
3 years ago
6 years ago
6 years ago
7 years ago
​
3 years ago
​
​
3 years ago
​
​
​
​
7 years ago
​
​
  1. //----------------------------------------------------------------------------
  2. // Dr.Frucht Systems Ltd.
  3. // Copyright � 2000-2017. All Rights Reserved.
  4. // Version 2.0 7/20/2017
  5. // Last modification: 7/20/2017
  6. // PROJECT:
  7. // SUBSYSTEM:
  8. // FILE: LRF_Kernel.h
  9. // AUTHOR: gagua
  10. // OVERVIEW
  11. // ~~~~~~~~
  12. // Header file of LRF_Kernel.cpp
  13. //----------------------------------------------------------------------------
  14. //
  15. #ifndef __LRF_KERNEL_H_INCL__
  16. #define __LRF_KERNEL_H_INCL__
  17. #include "../../components/base/basicThread.h"
  18. #include "../../components/base/basicEngine.h"
  19. #include "../../components/base/basicSettingsProvider.h"
  20. #include "../../components/base/basicEventHeap.h"
  21. #include "LRF_HardwareManager.h"
  22. #include "LRF_TwinConnector.h"
  23. #include "../../alg/lgs/detectorStructures.h"
  24. #include "../../alg/lgs/detector.h"
  25. #include "../../alg/lgs/mask.h"
  26. #include "../../data/net/netServiceEngine.h"
  27. #ifndef PRU_SLAVE
  28. #include "../../data/net/netServer.h"
  29. #include "LRF_TargetTracker.h"
  30. #ifdef __EU_PROJECT__
  31. #include "LRF_SafeShoreHandler.h"
  32. #include "LRF_DefenderHandler.h"
  33. #include "LRF_KafkaHandler.h"
  34. #define KNL_SETTINGS_SAFE_SHORE "ENABLE_SAFE_SHORE"
  35. #define KNL_SETTINGS_DEFENDER "ENABLE_DEFENDER"
  36. #define KNL_SETTINGS_KAFKA "ENABLE_INFOSTRESS"
  37. #endif
  38. #endif
  39. //#define DUMP_TH_AFTER_FLIP_ON_DISK
  40. #define MAX_CYCLE_COUNTER_VALUE 0xFFFFFFFF;
  41. #define SLEEP_KERNEL_INTERVAL 10 // 10 millisecond
  42. #define TIME_SYNC_INTERVAL 900000 // 15 minute(s) in 1 millisecond units
  43. #define STATUS_OK_INTERVAL 2000 // 2 Sec in 1 millisecond units
  44. #define KNL_SETTINGS_DETECTOR_WIDTH "DETECTOR_WIDTH"
  45. #define KNL_SETTINGS_FILTER_KERNELS "ENABLED_LRF"
  46. #define KNL_SETTINGS_DETECTOR_SST "DETECTOR_SST"
  47. //#define KNL_SETTINGS_V_MOTOR_SETPOINT "VERTICAL_ENC_FREQ"
  48. /**
  49. * LRF_Kernel class - manages communication between client
  50. * handlers and PRU cores bseide of Event management.
  51. *
  52. *
  53. * @author gagua
  54. */
  55. class LRF_Kernel: public basicThread, public networkServiceEngine{
  56. private:
  57. basicLogCollection * m_pLog;
  58. LRF_HardwareManager * m_pHardwareManager;
  59. basicEventHeap * m_pEventHeap;
  60. config_setting_t * m_pSettings;
  61. basicSettingsProvider * m_pSettingsProvider;
  62. uint32_t m_nKernelFilter;
  63. uint32_t m_lCycleCounter;
  64. uint32_t m_nFlipCounter;
  65. uint32_t m_nFlipSavierID;
  66. uint8_t m_bExitCause;
  67. LRF3D_WORK_MODE m_eWorkMode;
  68. LRF_TwinConnector * m_pTWIC;
  69. #ifdef PRU_SLAVE
  70. #else
  71. LRF_TargetTracker * m_pTracker;
  72. #ifdef __EU_PROJECT__
  73. bool m_bSafeShoreSupport;
  74. LRF_SafeShoreHandler * m_pSafeShoreHandler;
  75. bool m_bDefenderSupport;
  76. LRF_DefenderHandler * m_pDefenderHandler;
  77. bool m_bKafkaSupport;
  78. LRF_KafkaHandler * m_pKafkaHandler;
  79. #endif
  80. // Argus/LGS proto
  81. networkServer * m_pNetClientsServer;
  82. // Detection Stuff
  83. uint32_t m_nSST;
  84. #endif
  85. uint32_t m_nWidth;
  86. // Shadow
  87. ShadowMask * m_pShadow;
  88. thresholdNode * m_pThreshold;
  89. uint32_t m_nThresholdSize;
  90. protected:
  91. void m_fThreadProc( void );
  92. public:
  93. // Constructor
  94. explicit LRF_Kernel( LRF_HardwareManager *HM = NULL );
  95. // Destructor
  96. virtual ~LRF_Kernel();
  97. bool attachNetServer( networkServer *srvPort );
  98. virtual networkClientHandler * attachNewClient( int SocketID );
  99. virtual bool detachClient( networkClientHandler *ptr );
  100. #ifndef PRU_SLAVE //Just Master Stuff
  101. bool create( LRF_HardwareManager *ptr = NULL, networkServer *srvPort = NULL );
  102. bool stopMotors( void );
  103. bool startMotors( void );
  104. bool getRuntimeStatus( ALG_RUN_STATUS *ptr );
  105. #endif
  106. ShadowMask * getShadowMask( void ){ return m_pShadow; };
  107. bool create( LRF_HardwareManager *ptr = NULL );
  108. void WaitFinish( bool Force = false );
  109. /* functional API */
  110. bool askReset( void );
  111. //LRF3D_WORK_MODE getWM( void );
  112. //void setWM( LRF3D_WORK_MODE nMode );
  113. //LRF3D_WORK_MODE getMode( void ){ return m_eWorkMode; };
  114. bool getParameters( void );
  115. thresholdNode * getTreshold( uint32_t &size, uint8_t kID=0 );
  116. //bool setMode( LRF3D_WORK_MODE nMode );
  117. bool setOffset( uint8_t nOffset );
  118. bool setOrder( uint8_t nOrder );
  119. PLGS_3D_PARAMETERS getDetectionParameters( void );
  120. bool setDetectionParameters( PLGS_3D_PARAMETERS ptr );
  121. bool reset( bool FullRestart = false );
  122. bool shutdown( bool Restart = false );
  123. uint8_t getExitCause( void ){ return m_bExitCause; };
  124. };
  125. #endif // __LRF_KERNEL_H_INCL__