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.
130 lines
4.2 KiB
130 lines
4.2 KiB
//----------------------------------------------------------------------------
|
|
// Dr.Frucht Systems Ltd.
|
|
// Copyright © 2000-2017. All Rights Reserved.
|
|
// Version 2.0 7/20/2017
|
|
// Last modification: 7/20/2017
|
|
// PROJECT:
|
|
// SUBSYSTEM:
|
|
// FILE: LRF_Kernel.h
|
|
// AUTHOR: gagua
|
|
// OVERVIEW
|
|
// ~~~~~~~~
|
|
// Header file of LRF_Kernel.cpp
|
|
//----------------------------------------------------------------------------
|
|
//
|
|
|
|
#ifndef __LRF_KERNEL_H_INCL__
|
|
#define __LRF_KERNEL_H_INCL__
|
|
|
|
|
|
#include "../../components/base/basicThread.h"
|
|
#include "../../components/base/basicEngine.h"
|
|
#include "../../components/base/basicSettingsProvider.h"
|
|
|
|
#define __EU_PROJECT__
|
|
|
|
#ifdef __EU_PROJECT__
|
|
#include "LRF_SafeShoreHandler.h"
|
|
#endif
|
|
|
|
#include "../../components/base/basicEventHeap.h"
|
|
#include "../../data/net/netServer.h"
|
|
#include "LRF_HardwareManager.h"
|
|
#include "LRF_targetTracker.h"
|
|
#include "LRF_SafeShoreHandler.h"
|
|
#include "LRF_DefenderHandler.h"
|
|
#include "../../alg/lgs/detector.h"
|
|
#include "../../alg/lgs/mask.h"
|
|
|
|
//#define DUMP_TH_AFTER_FLIP_ON_DISK
|
|
|
|
#define MAX_CYCLE_COUNTER_VALUE 0xFFFFFFFF;
|
|
#define SLEEP_KERNEL_INTERVAL 10 // 10 millisecond
|
|
#define TIME_SYNC_INTERVAL 900000 // 15 minute(s) in 1 millisecond units
|
|
#define STATUS_OK_INTERVAL 2000 // 2 Sec in 1 millisecond units
|
|
|
|
#define KNL_SETTINGS_SAFE_SHORE "ENABLE_SAFE_SHORE"
|
|
#define KNL_SETTINGS_DEFENDER "ENABLE_DEFENDER"
|
|
#define KNL_SETTINGS_DETECTOR_WIDTH "DETECTOR_WIDTH"
|
|
#define KNL_SETTINGS_FILTER_KERNELS "ENABLED_LRF"
|
|
#define KNL_SETTINGS_DETECTOR_SST "DETECTOR_SST"
|
|
//#define KNL_SETTINGS_V_MOTOR_SETPOINT "VERTICAL_ENC_FREQ"
|
|
|
|
/**
|
|
* LRF_Kernel class - manages communication between client
|
|
* handlers and PRU cores bseide of Event management.
|
|
*
|
|
*
|
|
* @author gagua
|
|
*/
|
|
|
|
class LRF_Kernel: public basicThread {
|
|
private:
|
|
basicLogCollection *m_pLog;
|
|
LRF_HardwareManager *m_pHardwareManager;
|
|
basicEventHeap *m_pEventHeap;
|
|
LRF_targetTracker *m_pTracker;
|
|
config_setting_t *m_pSettings;
|
|
basicSettingsProvider *m_pSettingsProvider;
|
|
uint32_t m_nKernelFilter;
|
|
uint32_t m_lCycleCounter;
|
|
uint32_t m_nFlipCounter;
|
|
uint32_t m_nFlipSavierID;
|
|
uint8_t m_bExitCause;
|
|
LRF_WORK_MODE m_eWorkMode;
|
|
|
|
#ifdef __EU_PROJECT__
|
|
bool m_bSafeShoreSupport;
|
|
LRF_SafeShoreHandler *m_pSafeShoreHandler;
|
|
//clientPort *m_pSocketPort;
|
|
//protocolSafeShore *m_pSafeshoreProt;
|
|
#endif
|
|
bool m_bDefenderSupport;
|
|
LRF_DefenderHandler *m_pDefenderHandler;
|
|
|
|
networkServer *m_pNetClientsServer;
|
|
thresholdNode *m_pThreshold;
|
|
uint32_t m_nThresholdSize;
|
|
// Detection Stuff
|
|
uint32_t m_nWidth;
|
|
uint32_t m_nSST;
|
|
// Shadow
|
|
ShadowMask *m_pShadow;
|
|
protected:
|
|
void m_fThreadProc( void );
|
|
|
|
public:
|
|
// Constructor
|
|
explicit LRF_Kernel( LRF_HardwareManager *HM = NULL );
|
|
|
|
// Destructor
|
|
virtual ~LRF_Kernel();
|
|
|
|
bool create( LRF_HardwareManager *ptr = NULL, networkServer *srvPort = NULL );
|
|
bool attachNetServer( networkServer *srvPort );
|
|
void WaitFinish( bool Force = false );
|
|
|
|
/* functional API */
|
|
bool askReset( void );
|
|
LRF_WORK_MODE getMode( void ){ return m_eWorkMode; };
|
|
bool getParameters( void );
|
|
ShadowMask *getShadowMask( void ){ return m_pShadow; };
|
|
thresholdNode *getTreshold( uint32_t &size, uint8_t kID=0 );
|
|
//bool getTarget( TARGET *t );
|
|
//uint32_t getErrorAngle( void );
|
|
//void clearErrorAngle( void );
|
|
//bool isErrorAngle( void );
|
|
bool setMode( LRF_WORK_MODE nMode );
|
|
bool setOffset( uint8_t nOffset );
|
|
bool setOrder( uint8_t nOrder );
|
|
|
|
PLGS_PARAMETERS getDetectionParameters( void );
|
|
bool setDetectionParameters( PLGS_PARAMETERS ptr );
|
|
bool reset( bool FullRestart = false );
|
|
bool shutdown( bool Restart = false );
|
|
uint8_t getExitCause( void ){ return m_bExitCause; };
|
|
bool stopMotors( void );
|
|
bool startMotors( void );
|
|
};
|
|
|
|
#endif // __LRF_KERNEL_H_INCL__
|