For DOS Protected Mode version of sensor core software
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.
 
 
 
 

164 lines
4.6 KiB

//----------------------------------------------------------------------------
// Laser Guard Ltd.
// Copyright © 2000-2002. All Rights Reserved.
// Version 1.0 01/01/2000
// Last modification: 08/10/2003
// PROJECT:
// SUBSYSTEM:
// FILE: Tracker.h
// AUTHOR: Sergey Chizhevskiy
// OVERVIEW
// ~~~~~~~~
// Header file of Tracker.h
//----------------------------------------------------------------------------
#ifndef __TRACKER__H__INCLUDED__
#define __TRACKER__H__INCLUDED__
#include "StdAfx.h"
#include "..\lglib\comm\lgsm.h"
#include "stream.h"
#include "camera.h"
#include "relay.h"
#include "areset.h"
#ifdef INCLUDE_WINDOWS_DEFINITIONS
// #include "camera.h"
// #include "relay.h"
#else
/* class CCamera
{
public:
void OnTarget( int16_t nAngle, int16_t nRange ){}
void Invalidate( DWORD nSlowTimer, uint16_t nFastTimer, bool bFastTimeValid ){}
};
class CRelay
{
public:
void OnTarget( int16_t nAngle, int16_t nRange ){}
void Invalidate( uint16_t nFastTimer, DWORD nSlowTimer ) {}
};
*/
#endif
class CTracker
{
public:
CTracker();
~CTracker();
void RemoveTarget( int16_t nTargetID );
public:
bool Create( bool bDisabled, CCamera *pCamera, CRelay *pRelay, CAutoReset *pAutoReset );
void Reset();
void Destroy();
void SetLevel( int16_t nLevel ) { m_nLevel = nLevel; }
int16_t GetLevel() { return m_nLevel; }
public:
void Invalidate();
#ifdef LGS_TEST_SEND_TARGET_WIDTH
bool AddTarget( uint8_t bType, int32_t nAngle, int32_t nRange, int32_t nWidth );
#else
bool AddTarget( uint8_t bType, int32_t nAngle, int32_t nRange );
#endif
public:
typedef struct TARGET
{
uint8_t bType; // target type
int32_t nAngle; // target angle
int32_t nRange; // target range
bool bSent;
#ifdef LGS_TEST_SEND_TARGET_WIDTH
int32_t nWidth; // target width
#endif
} TARGET, *PTARGET;
bool GetTarget( PTARGET pTarget ) { return m_TargetStream.Get( pTarget ); }
public:
int16_t GetLastErrorOverflow() { return m_TargetStream.GetOverflow(); }
int16_t GetLastErrorOverflowSST() { int16_t nError = m_nErrorOverflowSST; m_nErrorOverflowSST = 0; return nError; }
private:
typedef struct TARGET_EX
{
TARGET target;
int16_t nRemoveTime; // time when target shuld be removed as false alarm
int16_t nDetectionTime; // time when begins comparison with other incoming targets
int16_t nAllertTime;
int16_t nLevel; // current SST level of target
bool bSent;
#ifdef LGS_MIRROR
int16_t nDelaySST; // Delay SST decrement for LGS Mirror system
#endif
int32_t nAngleMin; // scan2scan area left order in board angle units
int32_t nAngleMax; // scan2scan area right order in board angle units
int32_t nRangeMin; // scan2scan area bottom offset in board range units
int32_t nRangeMax; // scan2scan area top offset in board range units
#ifdef DETECT_JUST_MOVING_TARGETS
int32_t nAngleStart;
int32_t nAngleStop;
int32_t nRangeStart;
int32_t nRangeStop;
#endif
#ifdef DEBUG_GRAPH_SCREEN_SST
int32_t nP[4];
#endif
}TARGET_EX, *PTARGET_EX, far*LPTARGET_EX;
private:
TARGET_EX m_pTargets[ LGS_MAX_TRACKER_TARGETS ];
PTARGET_EX m_ppTargets[ LGS_MAX_TRACKER_TARGETS ];
int16_t m_nTargetCount;
int16_t m_nLevel;
private:
CFastStreamOverflow< TARGET, LGS_TRACKER_MAX_TARGETS > m_TargetStream;
int16_t m_nErrorOverflowSST;
#ifdef DETECT_JUST_MOVING_TARGETS
private:
int32_t m_nRadialDelta;
int32_t m_nDistanceDelta;
int32_t m_nSAngle;
int32_t m_nEAngle;
int32_t m_nSRange;
int32_t m_nERange;
bool targetInBlindZone( int32_t nAngle, int32_t nRange ){
if( nAngle > m_nSAngle )
if( nRange > m_nSRange )
if( nRange < m_nERange )
if( (( m_nEAngle+LGS_MAX_DETECTOR_ANGLES-m_nSAngle)%LGS_MAX_DETECTOR_ANGLES ) > ( nAngle - m_nSAngle ) ) return true;
return false;
};
bool targetIsMoving( PTARGET_EX a, int32_t nAngle, int32_t nRange );
bool m_bMovingFilter;
public:
void SetMovingFilter( int32_t Rvalue, int32_t Dvalue ){
m_nRadialDelta = Rvalue;
m_nDistanceDelta = Dvalue;
if( m_nRadialDelta != 0 || m_nDistanceDelta != 0 ){
m_bMovingFilter = true;
} else {
m_bMovingFilter = false;
};
};
void SetBlindZoneFilter(int32_t SAngle, int32_t EAngle, int32_t SRange, int32_t ERange ){
m_nSAngle = SAngle; m_nEAngle = EAngle; m_nSRange = SRange; m_nERange = ERange; };
#endif
#ifdef DEBUG_GRAPH_SCREEN_SST
public:
void SetIndex( int16_t nIndex ) { m_nIndex = nIndex; }
private:
int16_t m_nTargetColumn;
int16_t m_nIndex;
#endif
private:
CCamera *m_pCamera;
CRelay *m_pRelay;
CAutoReset *m_pAutoReset;
private:
bool m_bDisabled;
};
#endif