diff --git a/.gitignore b/.gitignore index d193c97..aa13eca 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ PC_104/Debug/* PC_104/Release/* +PC_104/als.exe +PC_104/alsgf.exe diff --git a/PC_104/als.exe b/PC_104/als.exe index 7e747ce..a2d3d8c 100644 Binary files a/PC_104/als.exe and b/PC_104/als.exe differ diff --git a/PC_104/alsgf.exe b/PC_104/alsgf.exe index a1f41d7..821e3e5 100644 Binary files a/PC_104/alsgf.exe and b/PC_104/alsgf.exe differ diff --git a/PC_104/lgs/DETECTOR.cpp b/PC_104/lgs/DETECTOR.cpp index 4ebb29d..fc1e2f0 100644 --- a/PC_104/lgs/DETECTOR.cpp +++ b/PC_104/lgs/DETECTOR.cpp @@ -253,21 +253,21 @@ void CDetector::GetParameters( LGS::LGS_PARAMETERS *pParameters ){ void CDetector::SetParameters( LGS::LGS_PARAMETERS *pParameters ){ // chack changes - if( pParameters->nOrder == m_Settings.nOrder && + if( pParameters->nOrder == (uint16_t)m_Settings.nOrder && #ifdef LGS_REDUCED_PRF pParameters->nOffset == (uint16_t)( m_Settings.nOffset / LGS_PRF_REDUCE_RATIO ) && #else - pParameters->nOffset == m_Settings.nOffset && + pParameters->nOffset == (uint16_t)m_Settings.nOffset && #endif - pParameters->nDelta == m_Settings.nDelta && + pParameters->nDelta == (uint16_t)m_Settings.nDelta && #ifdef LGS_MND - pParameters->nWidth == ( m_Settings.nWidth << 2 ) && + pParameters->nWidth == (uint16_t)( m_Settings.nWidth << 2 ) && #else - pParameters->nWidth == m_Settings.nWidth && + pParameters->nWidth == (uint16_t)m_Settings.nWidth && #endif - pParameters->nFlip == m_Settings.nFlip && - pParameters->nSun == m_Settings.nSun && - pParameters->bSST == m_pTracker->GetLevel() ) + pParameters->nFlip == (uint16_t)m_Settings.nFlip && + pParameters->nSun == (uint16_t)m_Settings.nSun && + pParameters->bSST == (uint16_t)m_pTracker->GetLevel() ) return; // write parameters into file diff --git a/PC_104/lgs/Detector.h b/PC_104/lgs/Detector.h index 4510488..ef84777 100644 --- a/PC_104/lgs/Detector.h +++ b/PC_104/lgs/Detector.h @@ -37,7 +37,7 @@ typedef struct LGS_SETTINGS }LGS_SETTINGS; #define LRF_ID_MASTER 0 -#define LRF_ID_SLAVE 1 +#define LRF_ID_SLAVE 1 #define LRF_ID_LFS_M1 0 #define LRF_ID_LFS_M2 1 #define LRF_ID_LFS_M3 2 @@ -74,7 +74,7 @@ public: @return true on successful initialization @return false on failure */ - bool Create( bool bDisabled, CTracker *pTracker, CShadow *pShadow, int16_t nShift, int16_t nOrder, int16_t nOffset, int16_t nDelta, int16_t nWidth, int16_t nFlip, int16_t nSun, int16_t nLevelSST ); + bool Create( bool bDisabled, CTracker *pTracker, CShadow *pShadow, int32_t nShift, int32_t nOrder, int32_t nOffset, int32_t nDelta, int32_t nWidth, int32_t nFlip, int32_t nSun, int32_t nLevelSST ); /*! @brief Initialization of the object @param[in] bDisabled Flag that is indicates if the detector is disabled @@ -261,23 +261,23 @@ private: #ifndef NO_DETECTOR_FILTERS // filters CFilterSun m_FilterSun; - CFilterMediumRange m_FilterMediumRange; + CFilterMediumRange m_FilterMediumRange; CFilterPD m_FilterPD; CFilterFog m_FilterFog; #endif CFilterWidth m_FilterWidth; private: - CShadow *m_pShadow; // plaseholder for hiddenzones - CTracker *m_pTracker; // scan to scan tracking + CShadow * m_pShadow; // plaseholder for hiddenzones + CTracker * m_pTracker; // scan to scan tracking private: - bool m_bErrorAngle; // error angle - int16_t m_nErrorAngle; // error angle - bool m_bShowErrorAngle; // prevent angle error immidiatly after reset + bool m_bErrorAngle; // error angle + int16_t m_nErrorAngle; // error angle + bool m_bShowErrorAngle; // prevent angle error immidiatly after reset private: - LGS_SETTINGS m_Settings; // settings + LGS_SETTINGS m_Settings; // settings CHAR m_pSettingsFileName[LGS_MAX_SETTINGS_FILENAME]; #ifndef INCLUDE_WINDOWS_DEFINITIONS diff --git a/PC_104/lgs/Stdafx.h b/PC_104/lgs/Stdafx.h index 10863c7..addd571 100644 --- a/PC_104/lgs/Stdafx.h +++ b/PC_104/lgs/Stdafx.h @@ -50,7 +50,7 @@ //#define COMPILE_AS_SICK_PROXY -//#define COMPILE_AS_GETFILE +#define COMPILE_AS_GETFILE #ifndef COMPILE_AS_GETFILE @@ -68,7 +68,7 @@ //#define RESTART_PC_BY_WATCHDOG #endif - #define DETECTION_MULTI_PROFILES + //#define DETECTION_MULTI_PROFILES // #define DETECT_JUST_MOVING_TARGETS // #define SENDBOARDDATA_INF //#define SHADOW_ALWAYS_ON // For Moni Finland diff --git a/PC_104/lgs/detecto_.cpp b/PC_104/lgs/detecto_.cpp index 1d1ed37..53a274b 100644 --- a/PC_104/lgs/detecto_.cpp +++ b/PC_104/lgs/detecto_.cpp @@ -23,17 +23,17 @@ CDetector::CDetector(){ // initiate default settings - m_Settings.nOrder = 5; - m_Settings.nOffset = 5; + m_Settings.nOrder = 5; + m_Settings.nOffset = 5; m_Settings.nFlip = LGS_MIN_DETECTOR_FLIP; #ifdef LGS_MND - m_Settings.nWidth = 250; + m_Settings.nWidth = 250; #else - m_Settings.nWidth = 1000; + m_Settings.nWidth = 1000; #endif - m_Settings.nDelta = 5; - m_Settings.nShift = 0; - m_Settings.nSun = 32; + m_Settings.nDelta = 5; + m_Settings.nShift = 0; + m_Settings.nSun = 32; #ifdef LGS_BOARDSAMPLE_RATIO m_nAngleDivider = LGS_BOARDSAMPLE_RATIO; #endif @@ -87,13 +87,13 @@ CDetector::~CDetector(){ bool CDetector::Create( bool bDisabled, CTracker *pTracker, CShadow *pShadow, int16_t nShift, PCHAR pFileName ){ #endif #ifndef COMPILE_AS_SICK_PROXY - int16_t nOrder = 10; - int16_t nOffset = 20; - int16_t nDelta = 60; - int16_t nWidth = 4400; - int16_t nFlip = 32; - int16_t nSun = 32; - int16_t nLevelSST = 1; + int32_t nOrder = 10; + int32_t nOffset = 20; + int32_t nDelta = 60; + int32_t nWidth = 4400; + int32_t nFlip = 32; + int32_t nSun = 32; + int32_t nLevelSST = 1; # ifdef LGS_BOARDSAMPLE_RATIO m_nAngleDivider = LGS_BOARDSAMPLE_RATIO; # endif @@ -141,13 +141,13 @@ CDetector::~CDetector(){ #endif }; #else //COMPILE_AS_SICK_PROXY - int16_t nOrder = 140; - int16_t nOffset = 60; - int16_t nDelta = 120; - int16_t nWidth = 3500; - int16_t nFlip = 255; - int16_t nSun = 32; - int16_t nLevelSST = 0; + int32_t nOrder = 140; + int32_t nOffset = 60; + int32_t nDelta = 120; + int32_t nWidth = 3500; + int32_t nFlip = 255; + int32_t nSun = 32; + int32_t nLevelSST = 0; m_nAngleDivider = LGS_BOARDSAMPLE_RATIO; #endif // COMPILE_AS_SICK_PROXY return Create( bDisabled, pTracker, pShadow, nShift, nOrder, nOffset, nDelta, nWidth, nFlip, nSun, nLevelSST ); @@ -246,7 +246,7 @@ void CDetector::unifyDataSAF( void ){ } #endif -bool CDetector::Create( bool bDisabled, CTracker *pTracker, CShadow *pShadow, int16_t nShift, int16_t nOrder, int16_t nOffset, int16_t nDelta, int16_t nWidth, int16_t nFlip, int16_t nSun, int16_t nLevelSST ) +bool CDetector::Create( bool bDisabled, CTracker *pTracker, CShadow *pShadow, int32_t nShift, int32_t nOrder, int32_t nOffset, int32_t nDelta, int32_t nWidth, int32_t nFlip, int32_t nSun, int32_t nLevelSST ) { #ifdef DEBUG_PRINTOUT_MSGS debugProcBegin( "Clear" ); diff --git a/PC_104/lgs/kernel_.cpp b/PC_104/lgs/kernel_.cpp index 0e21943..d463e59 100644 --- a/PC_104/lgs/kernel_.cpp +++ b/PC_104/lgs/kernel_.cpp @@ -359,24 +359,22 @@ bool CKernel::Create(){ #ifdef DETECTION_MULTI_PROFILES - //printf("Multiprofiles\n"); - char APFN[32]; + char APFN[32]; FILE *APFD; sprintf( APFN, "%c:\\profile.ini", (char)( 65+BoardSettings.nHID ) ); APFD = fopen( APFN, "r" ); if( APFD!=NULL ){ uint8_t profileID; fscanf( APFD, "%d\n", &m_bActiveMasterDetectionProfile ); - m_bActiveSlaveDetectionProfile = m_bActiveMasterDetectionProfile+3; + m_bActiveSlaveDetectionProfile = m_bActiveMasterDetectionProfile+3; fclose( APFD ); } else { + m_bActiveMasterDetectionProfile = 0; // to ensure no to exit from next function setActiveDetectionProfile( 1 ); }; - //printf("Done\n"); - //printf("Create Detectors\n"); #ifdef STORE_FIRST_SAF #ifdef WATCHDOG_ENABLED - if( !m_Detector[0].Create( BoardSettings.M_LRFDisable, &m_Tracker[0], m_pShadow, 0, ( PCHAR )m_pDetectionProfiles[m_bActiveMasterDetectionProfile], &m_WatchDog, LRF_ID_MASTER ) ) { + if( !m_Detector[0].Create( BoardSettings.M_LRFDisable, &m_Tracker[0], m_pShadow, 0, /*_T("init_m.ini")*/( PCHAR )m_pDetectionProfiles[m_bActiveMasterDetectionProfile], &m_WatchDog, LRF_ID_MASTER ) ) { #else if( !m_Detector[0].Create( BoardSettings.M_LRFDisable, &m_Tracker[0], m_pShadow, 0, ( PCHAR )m_pDetectionProfiles[m_bActiveMasterDetectionProfile], LRF_ID_MASTER ) ) { #endif @@ -385,8 +383,16 @@ bool CKernel::Create(){ #endif #else //printf("Singleprofiles Detector\n"); - - if( !m_Detector[0].Create( BoardSettings.M_LRFDisable, &m_Tracker[0], m_pShadow, 0, _T("init_m.ini") ) ) { + #ifdef STORE_FIRST_SAF + #ifdef WATCHDOG_ENABLED + if( !m_Detector[0].Create( BoardSettings.M_LRFDisable, &m_Tracker[0], m_pShadow, 0, _T("init_m.ini"), &m_WatchDog, LRF_ID_MASTER ) ) { + #else + if( !m_Detector[0].Create( BoardSettings.M_LRFDisable, &m_Tracker[0], m_pShadow, 0, _T("init_m.ini"), LRF_ID_MASTER ) ) { + #endif + #else + if( !m_Detector[0].Create( BoardSettings.M_LRFDisable, &m_Tracker[0], m_pShadow, 0, _T("init_m.ini") ) ) { + #endif + #endif return false; }; @@ -399,12 +405,12 @@ bool CKernel::Create(){ #ifdef DETECTION_MULTI_PROFILES #ifdef STORE_FIRST_SAF #ifdef WATCHDOG_ENABLED - if( !m_Detector[1].Create( m_LRFDisable.bSlave, &m_Tracker[0], m_pShadow, 0, ( PCHAR )m_pDetectionProfiles[m_bActiveMasterDetectionProfile], &m_WatchDog, LRF_ID_SLAVE ) ) { + if( !m_Detector[1].Create( m_LRFDisable.bSlave, &m_Tracker[0], m_pShadow, 0, ( PCHAR )m_pDetectionProfiles[m_bActiveSlaveDetectionProfile], &m_WatchDog, LRF_ID_SLAVE ) ) { #else - if( !m_Detector[1].Create( m_LRFDisable.bSlave, &m_Tracker[0], m_pShadow, 0, ( PCHAR )m_pDetectionProfiles[m_bActiveMasterDetectionProfile], LRF_ID_SLAVE ) ) { + if( !m_Detector[1].Create( m_LRFDisable.bSlave, &m_Tracker[0], m_pShadow, 0, ( PCHAR )m_pDetectionProfiles[m_bActiveSlaveDetectionProfile], LRF_ID_SLAVE ) ) { #endif #else - if( !m_Detector[1].Create( m_LRFDisable.bMaster, &m_Tracker[0], m_pShadow, 0, ( PCHAR )m_pDetectionProfiles[m_bActiveMasterDetectionProfile] ) ) { + if( !m_Detector[1].Create( m_LRFDisable.bMaster, &m_Tracker[0], m_pShadow, 0, ( PCHAR )m_pDetectionProfiles[m_bActiveSlaveDetectionProfile] ) ) { #endif #else if( !m_Detector[1].Create( m_LRFDisable.bSlave, &m_Tracker[0], m_pShadow, 0, "init_s.ini" ) ){ @@ -414,27 +420,27 @@ bool CKernel::Create(){ #ifdef DETECTION_MULTI_PROFILES #ifdef STORE_FIRST_SAF #ifdef WATCHDOG_ENABLED - if( !m_Detector[2].Create( m_LRFDisable.bSlave, &m_Tracker[0], m_pShadow, 0, ( PCHAR )m_pDetectionProfiles[m_bActiveMasterDetectionProfile], &m_WatchDog, LRF_ID_SLAVE ) ) { + if( !m_Detector[2].Create( m_LRFDisable.bSlave, &m_Tracker[0], m_pShadow, 0, ( PCHAR )m_pDetectionProfiles[m_bActiveSlaveDetectionProfile], &m_WatchDog, LRF_ID_SLAVE ) ) { #else - if( !m_Detector[2].Create( m_LRFDisable.bSlave, &m_Tracker[0], m_pShadow, 0, ( PCHAR )m_pDetectionProfiles[m_bActiveMasterDetectionProfile], LRF_ID_SLAVE ) ) { + if( !m_Detector[2].Create( m_LRFDisable.bSlave, &m_Tracker[0], m_pShadow, 0, ( PCHAR )m_pDetectionProfiles[m_bActiveSlaveDetectionProfile], LRF_ID_SLAVE ) ) { #endif #else - if( !m_Detector[2].Create( m_LRFDisable.bMaster, &m_Tracker[0], m_pShadow, 0, ( PCHAR )m_pDetectionProfiles[m_bActiveMasterDetectionProfile] ) ) { + if( !m_Detector[2].Create( m_LRFDisable.bMaster, &m_Tracker[0], m_pShadow, 0, ( PCHAR )m_pDetectionProfiles[m_bActiveSlaveDetectionProfile] ) ) { #endif #else - if( !m_Detector[2].Create( m_LRFDisable.bMaster, &m_Tracker[0], m_pShadow, 0, "init_m.ini" ) ){ + if( !m_Detector[2].Create( m_LRFDisable.bMaster, &m_Tracker[0], m_pShadow, 0, "init_s.ini" ) ){ #endif return false; }; #ifdef DETECTION_MULTI_PROFILES #ifdef STORE_FIRST_SAF #ifdef WATCHDOG_ENABLED - if( !m_Detector[3].Create( m_LRFDisable.bSlave, &m_Tracker[0], m_pShadow, 0, ( PCHAR )m_pDetectionProfiles[m_bActiveMasterDetectionProfile], &m_WatchDog, LRF_ID_SLAVE ) ) { + if( !m_Detector[3].Create( m_LRFDisable.bSlave, &m_Tracker[0], m_pShadow, 0, ( PCHAR )m_pDetectionProfiles[m_bActiveSlaveDetectionProfile], &m_WatchDog, LRF_ID_SLAVE ) ) { #else - if( !m_Detector[3].Create( m_LRFDisable.bSlave, &m_Tracker[0], m_pShadow, 0, ( PCHAR )m_pDetectionProfiles[m_bActiveMasterDetectionProfile], LRF_ID_SLAVE ) ) { + if( !m_Detector[3].Create( m_LRFDisable.bSlave, &m_Tracker[0], m_pShadow, 0, ( PCHAR )m_pDetectionProfiles[m_bActiveSlaveDetectionProfile], LRF_ID_SLAVE ) ) { #endif #else - if( !m_Detector[3].Create( m_LRFDisable.bMaster, &m_Tracker[0], m_pShadow, 0, ( PCHAR )m_pDetectionProfiles[m_bActiveMasterDetectionProfile] ) ) { + if( !m_Detector[3].Create( m_LRFDisable.bMaster, &m_Tracker[0], m_pShadow, 0, ( PCHAR )m_pDetectionProfiles[m_bActiveSlaveDetectionProfile] ) ) { #endif #else if( !m_Detector[3].Create( m_LRFDisable.bSlave, &m_Tracker[0], m_pShadow, 0, "init_s.ini" ) ){ @@ -448,19 +454,19 @@ bool CKernel::Create(){ #ifdef ALS_300 #ifdef STORE_FIRST_SAF #ifdef WATCHDOG_ENABLED - if( !m_Detector[1].Create( BoardSettings.S_LRFDisable, &m_Tracker[1], m_pShadowS, LGS_MAX_DETECTOR_ANGLES / 2, ( PCHAR )m_pDetectionProfiles[m_bActiveMasterDetectionProfile], &m_WatchDog, LRF_ID_SLAVE ) ) { + if( !m_Detector[1].Create( BoardSettings.S_LRFDisable, &m_Tracker[1], m_pShadowS, LGS_MAX_DETECTOR_ANGLES / 2, /*_T("init_s.ini")*/( PCHAR )m_pDetectionProfiles[m_bActiveSlaveDetectionProfile], &m_WatchDog, LRF_ID_SLAVE ) ) { #else - if( !m_Detector[1].Create( BoardSettings.S_LRFDisable, &m_Tracker[1], m_pShadowS, LGS_MAX_DETECTOR_ANGLES / 2, ( PCHAR )m_pDetectionProfiles[m_bActiveMasterDetectionProfile], LRF_ID_SLAVE ) ) { + if( !m_Detector[1].Create( BoardSettings.S_LRFDisable, &m_Tracker[1], m_pShadowS, LGS_MAX_DETECTOR_ANGLES / 2, ( PCHAR )m_pDetectionProfiles[m_bActiveSlaveDetectionProfile], LRF_ID_SLAVE ) ) { #endif #else - if( !m_Detector[1].Create( BoardSettings.S_LRFDisable, &m_Tracker[1], m_pShadowS, LGS_MAX_DETECTOR_ANGLES / 2, ( PCHAR )m_pDetectionProfiles[m_bActiveMasterDetectionProfile] ) ) { + if( !m_Detector[1].Create( BoardSettings.S_LRFDisable, &m_Tracker[1], m_pShadowS, LGS_MAX_DETECTOR_ANGLES / 2, ( PCHAR )m_pDetectionProfiles[m_bActiveSlaveDetectionProfile] ) ) { #endif #else #ifdef STORE_FIRST_SAF #ifdef WATCHDOG_ENABLED - if( !m_Detector[1].Create( m_LRFDisable.bSlave, &m_Tracker[1], m_pShadow, LGS_MAX_DETECTOR_ANGLES / 2, ( PCHAR )m_pDetectionProfiles[m_bActiveMasterDetectionProfile], &m_WatchDog, LRF_ID_SLAVE ) ) { + if( !m_Detector[1].Create( m_LRFDisable.bSlave, &m_Tracker[1], m_pShadow, LGS_MAX_DETECTOR_ANGLES / 2, ( PCHAR )m_pDetectionProfiles[m_bActiveSlaveDetectionProfile], &m_WatchDog, LRF_ID_SLAVE ) ) { #else - if( !m_Detector[1].Create( m_LRFDisable.bSlave, &m_Tracker[1], m_pShadow, LGS_MAX_DETECTOR_ANGLES / 2, ( PCHAR )m_pDetectionProfiles[m_bActiveMasterDetectionProfile], LRF_ID_SLAVE ) ) { + if( !m_Detector[1].Create( m_LRFDisable.bSlave, &m_Tracker[1], m_pShadow, LGS_MAX_DETECTOR_ANGLES / 2, ( PCHAR )m_pDetectionProfiles[m_bActiveSlaveDetectionProfile], LRF_ID_SLAVE ) ) { #endif #else if( !m_Detector[1].Create( m_LRFDisable.bSlave, &m_Tracker[1], m_pShadow, LGS_MAX_DETECTOR_ANGLES / 2, ( PCHAR ) m_pDetectionProfiles[m_bActiveSlaveDetectionProfile] ) ) { @@ -468,7 +474,15 @@ bool CKernel::Create(){ #endif #else #ifdef ALS_300 - if( !m_Detector[1].Create( m_LRFDisable.bSlave, &m_Tracker[1], m_pShadowS, LGS_MAX_DETECTOR_ANGLES / 2, _T("init_s.ini") ) ){ + #ifdef STORE_FIRST_SAF + #ifdef WATCHDOG_ENABLED + if( !m_Detector[1].Create( BoardSettings.S_LRFDisable, &m_Tracker[1], m_pShadowS, LGS_MAX_DETECTOR_ANGLES / 2, _T("init_s.ini"), &m_WatchDog, LRF_ID_SLAVE ) ) { + #else + if( !m_Detector[1].Create( BoardSettings.S_LRFDisable, &m_Tracker[1], m_pShadowS, LGS_MAX_DETECTOR_ANGLES / 2, _T("init_s.ini"), LRF_ID_SLAVE ) ) { + #endif + #else + if( !m_Detector[1].Create( m_LRFDisable.bSlave, &m_Tracker[1], m_pShadowS, LGS_MAX_DETECTOR_ANGLES / 2, _T("init_s.ini") ) ){ + #endif #else if( !m_Detector[1].Create( m_LRFDisable.bSlave, &m_Tracker[1], m_pShadow, LGS_MAX_DETECTOR_ANGLES / 2, _T("init_s.ini") ) ){ #endif diff --git a/se16.vtg b/se16.vtg index fc66011..202e0bf 100644 Binary files a/se16.vtg and b/se16.vtg differ