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.

136 lines
4.6 KiB

7 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
6 years ago
​
6 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
​
​
6 years ago
7 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/detector.h"
  24. #include "../../alg/lgs/mask.h"
  25. #ifndef PRU_SLAVE
  26. #include "../../data/net/netServer.h"
  27. #include "LRF_TargetTracker.h"
  28. #ifdef __EU_PROJECT__
  29. #include "LRF_SafeShoreHandler.h"
  30. #include "LRF_DefenderHandler.h"
  31. #include "LRF_KafkaHandler.h"
  32. #define KNL_SETTINGS_SAFE_SHORE "ENABLE_SAFE_SHORE"
  33. #define KNL_SETTINGS_DEFENDER "ENABLE_DEFENDER"
  34. #define KNL_SETTINGS_KAFKA "ENABLE_INFOSTRESS"
  35. #endif
  36. #endif
  37. //#define DUMP_TH_AFTER_FLIP_ON_DISK
  38. #define MAX_CYCLE_COUNTER_VALUE 0xFFFFFFFF;
  39. #define SLEEP_KERNEL_INTERVAL 10 // 10 millisecond
  40. #define TIME_SYNC_INTERVAL 900000 // 15 minute(s) in 1 millisecond units
  41. #define STATUS_OK_INTERVAL 2000 // 2 Sec in 1 millisecond units
  42. #define KNL_SETTINGS_DETECTOR_WIDTH "DETECTOR_WIDTH"
  43. #define KNL_SETTINGS_FILTER_KERNELS "ENABLED_LRF"
  44. #define KNL_SETTINGS_DETECTOR_SST "DETECTOR_SST"
  45. //#define KNL_SETTINGS_V_MOTOR_SETPOINT "VERTICAL_ENC_FREQ"
  46. /**
  47. * LRF_Kernel class - manages communication between client
  48. * handlers and PRU cores bseide of Event management.
  49. *
  50. *
  51. * @author gagua
  52. */
  53. class LRF_Kernel: public basicThread {
  54. private:
  55. basicLogCollection * m_pLog;
  56. LRF_HardwareManager * m_pHardwareManager;
  57. basicEventHeap * m_pEventHeap;
  58. config_setting_t * m_pSettings;
  59. basicSettingsProvider * m_pSettingsProvider;
  60. uint32_t m_nKernelFilter;
  61. uint32_t m_lCycleCounter;
  62. uint32_t m_nFlipCounter;
  63. uint32_t m_nFlipSavierID;
  64. uint8_t m_bExitCause;
  65. LRF_WORK_MODE m_eWorkMode;
  66. LRF_TwinConnector * m_pTWIC;
  67. #ifdef PRU_SLAVE
  68. #else
  69. LRF_TargetTracker * m_pTracker;
  70. #ifdef __EU_PROJECT__
  71. bool m_bSafeShoreSupport;
  72. LRF_SafeShoreHandler * m_pSafeShoreHandler;
  73. bool m_bDefenderSupport;
  74. LRF_DefenderHandler * m_pDefenderHandler;
  75. bool m_bKafkaSupport;
  76. LRF_KafkaHandler * m_pKafkaHandler;
  77. #endif
  78. // Argus/LGS proto
  79. networkServer * m_pNetClientsServer;
  80. // Detection Stuff
  81. uint32_t m_nSST;
  82. #endif
  83. uint32_t m_nWidth;
  84. // Shadow
  85. ShadowMask * m_pShadow;
  86. thresholdNode * m_pThreshold;
  87. uint32_t m_nThresholdSize;
  88. protected:
  89. void m_fThreadProc( void );
  90. public:
  91. // Constructor
  92. explicit LRF_Kernel( LRF_HardwareManager *HM = NULL );
  93. // Destructor
  94. virtual ~LRF_Kernel();
  95. #ifndef PRU_SLAVE //Just Master Stuff
  96. bool create( LRF_HardwareManager *ptr = NULL, networkServer *srvPort = NULL );
  97. bool attachNetServer( networkServer *srvPort );
  98. bool stopMotors( void );
  99. bool startMotors( void );
  100. #endif
  101. ShadowMask * getShadowMask( void ){ return m_pShadow; };
  102. bool create( LRF_HardwareManager *ptr = NULL );
  103. void WaitFinish( bool Force = false );
  104. /* functional API */
  105. bool askReset( void );
  106. LRF_WORK_MODE getMode( void ){ return m_eWorkMode; };
  107. bool getParameters( void );
  108. thresholdNode * getTreshold( uint32_t &size, uint8_t kID=0 );
  109. bool setMode( LRF_WORK_MODE nMode );
  110. bool setOffset( uint8_t nOffset );
  111. bool setOrder( uint8_t nOrder );
  112. PLGS_PARAMETERS getDetectionParameters( void );
  113. bool setDetectionParameters( PLGS_PARAMETERS ptr );
  114. bool reset( bool FullRestart = false );
  115. bool shutdown( bool Restart = false );
  116. uint8_t getExitCause( void ){ return m_bExitCause; };
  117. };
  118. #endif // __LRF_KERNEL_H_INCL__