Initial commit
This commit is contained in:
commit
b7d90b9afe
16245 files changed
+3396666
No files matched your search
+60
@@ -0,0 +1,60 @@
|
||||
#
|
||||
# --- Library svcCesGeoPairingImpl --------------------------------------------------------------------------------
|
||||
#
|
||||
SET(SRCS_common
|
||||
GeoPairingDataBase.cpp
|
||||
GeoPairingDataFireReport.cpp
|
||||
GeoPairingImplAirTargetCache.cpp
|
||||
GeoPairingImplAirTarget.cpp
|
||||
GeoPairingImplAirTargetTracker.cpp
|
||||
GeoPairingImplAirTargetUpdater.cpp
|
||||
GeoPairingImplBalistic.cpp
|
||||
GeoPairingImpl.cpp
|
||||
GeoPairingImplDted.cpp
|
||||
GeoPairingImplDummy.cpp
|
||||
GeoPairingImplFactory.cpp
|
||||
GeoPairingImplFiredBulletBalistic.cpp
|
||||
GeoPairingImplFiredBullet.cpp
|
||||
GeoPairingImplFiredBulletDted.cpp
|
||||
GeoPairingDataBase.hpp
|
||||
GeoPairingDataFireReport.hpp
|
||||
GeoPairingImplAirTargetCacheData.hpp
|
||||
GeoPairingImplAirTargetCache.hpp
|
||||
GeoPairingImplAirTarget.hpp
|
||||
GeoPairingImplAirTargetTracker.hpp
|
||||
GeoPairingImplAirTargetUpdater.hpp
|
||||
GeoPairingImplBalistic.hpp
|
||||
GeoPairingImplDted.hpp
|
||||
GeoPairingImplDummy.hpp
|
||||
GeoPairingImplFactory.hpp
|
||||
GeoPairingImplFiredBulletBalistic.hpp
|
||||
GeoPairingImplFiredBulletDted.hpp
|
||||
GeoPairingImplFiredBullet.hpp
|
||||
GeoPairingImpl.hpp
|
||||
GeoPairingImplImpactData.hpp
|
||||
GeoPairingImplMeteoData.hpp
|
||||
GeoPairingImplSensorData.hpp
|
||||
GeoPairingImplTrajectoryData.hpp
|
||||
geo_settings.h
|
||||
geo_settings.cpp
|
||||
)
|
||||
|
||||
NGL_ADD_LIBRARY(AAR SV svcCesGeoPairingImpl STATIC ${SRCS_common})
|
||||
NGL_TARGET_INCLUDE_DIRECTORIES(svcCesGeoPairingImpl
|
||||
PUBLIC
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../
|
||||
${CMAKE_CURRENT_BINARY_DIR}/../
|
||||
)
|
||||
NGL_TARGET_LINK_LIBRARIES(svcCesGeoPairingImpl
|
||||
PRIVATE
|
||||
RTI::nddscpp2
|
||||
PUBLIC
|
||||
Qt5::Core
|
||||
NGLLogger
|
||||
svcPdmCommon
|
||||
LtsCoordTrans
|
||||
GBL_Types
|
||||
GBL_ConfigSystem
|
||||
FW_Ballistic
|
||||
NGLLogger
|
||||
)
|
||||
Executable
+56
@@ -0,0 +1,56 @@
|
||||
// **************************************************************************
|
||||
//
|
||||
// (C) Copyright 2009 Swiss SIMTEC AG
|
||||
//
|
||||
// **************************************************************************
|
||||
//
|
||||
// $HeadURL$
|
||||
// $LastChangedBy$
|
||||
// $LastChangedDate$
|
||||
// $LastChangedRevision$
|
||||
//
|
||||
// **************************************************************************
|
||||
|
||||
// manual class headers
|
||||
#include "GeoPairingDataBase.hpp"
|
||||
#include "../logger.h"
|
||||
|
||||
namespace N_GeoPairingImpl
|
||||
{
|
||||
|
||||
GeoPairingDataBase::GeoPairingDataBase(const char *loggerName)
|
||||
: m_logger(CesGeoPairing::getLogger(loggerName ? loggerName : "GeoPairingDataBase"))
|
||||
{
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
// This function parses a data stream
|
||||
// ---------------------------------------------------------------
|
||||
bool GeoPairingDataBase::parse(const QByteArray& a_transparentData)
|
||||
{
|
||||
const int startMessageId = 0;
|
||||
//const int lenMessageId = 1;
|
||||
const int startDevice = 1;
|
||||
//const int lenDevice = 1;
|
||||
|
||||
if (a_transparentData.size() < m_Size)
|
||||
{
|
||||
ERROR_LOG(m_logger) << "Size of transparent Data not valid :" << a_transparentData.size()
|
||||
<< " instead of " << m_Size;
|
||||
return false;
|
||||
}
|
||||
|
||||
m_MessageID = a_transparentData[startMessageId];
|
||||
int messageId = m_MessageID;
|
||||
INFO_LOG(m_logger) << "Header -> MessageID : " << messageId;
|
||||
|
||||
UInt8 deviceId;
|
||||
deviceId = a_transparentData[startDevice];
|
||||
|
||||
m_DeviceID = static_cast<PanGeoPairingDeviceId>(deviceId);
|
||||
INFO_LOG(m_logger) << "Header -> DeviceID : " << m_DeviceID;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace N_GeoPairingImpl
|
||||
Executable
+101
@@ -0,0 +1,101 @@
|
||||
// **************************************************************************
|
||||
//
|
||||
// (C) Copyright 2009 Swiss SIMTEC AG
|
||||
//
|
||||
// **************************************************************************
|
||||
//
|
||||
// $HeadURL$
|
||||
// $LastChangedBy$
|
||||
// $LastChangedDate$
|
||||
// $LastChangedRevision$
|
||||
//
|
||||
// **************************************************************************
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <GBL_Global/Types.hpp>
|
||||
#include <NGLLogger/INGLLogger.h>
|
||||
|
||||
enum PanGeoPairingDeviceId
|
||||
{
|
||||
PAN_GP_INVALID = -1,
|
||||
PAN_GP_REQUEST_MORTAR = 0,
|
||||
PAN_GP_REPORT_MORTAR = 1,
|
||||
PAN_GP_REQUEST_IGLA = 2,
|
||||
PAN_GP_REPORT_IGLA = 3,
|
||||
PAN_GP_REQUEST_MK19 = 4,
|
||||
PAN_GP_REPORT_MK19 = 5,
|
||||
PAN_GP_REQUEST_M109 = 6,
|
||||
PAN_GP_REPORT_M109 = 7,
|
||||
/*
|
||||
PAN_GP_REPORT_AGS17 = 8,
|
||||
PAN_GP_REPORT_MORTAR_2S12_SANI = 9,
|
||||
PAN_GP_REPORT_UR_83P = 10,
|
||||
PAN_GP_REPORT_2S19_HOWITZER = 11,
|
||||
PAN_GP_REPORT_2S3M_HOWITZER = 12,
|
||||
*/
|
||||
PAN_GP_REQUEST_G5_G6 = 13,
|
||||
PAN_GP_REPORT_G5_G6 = 14
|
||||
};
|
||||
|
||||
enum e_AmmunitionType
|
||||
{
|
||||
AmmunitionTypeUnknown = -1,
|
||||
MortarType1 = 1, // Siehe Geo-Munition [GUEZE-2411]
|
||||
MortarType2 = 2,
|
||||
M60mm_m385 = 1,
|
||||
M60mm_m430 = 2,
|
||||
MK19Type_m385 = 2,
|
||||
MK19Type_m430 = 3,
|
||||
HE_M1A2 = 4,
|
||||
VLAP_M9703 = 5,
|
||||
SMK_BE_M2 = 6,
|
||||
CLUSTER_HEHC_M9609 = 7
|
||||
};
|
||||
|
||||
enum e_IgnitionTypeG5G6
|
||||
{
|
||||
IgnitionTypeUnknown = -1,
|
||||
IgnitionTypePercussion = 0,
|
||||
IgnitionTypeProximity = 1,
|
||||
IgnitionTypeTime = 2
|
||||
};
|
||||
|
||||
|
||||
|
||||
namespace N_GeoPairingImpl
|
||||
{
|
||||
|
||||
/**
|
||||
* This is the Data base class
|
||||
*
|
||||
* @author Daniel.Schmid
|
||||
* @version 1.0
|
||||
* @created 01-Nov-2011 08:37:58
|
||||
*/
|
||||
class GeoPairingDataBase
|
||||
{
|
||||
public:
|
||||
|
||||
GeoPairingDataBase(const char *loggerName = nullptr);
|
||||
virtual ~GeoPairingDataBase() = default;
|
||||
|
||||
|
||||
UInt8 m_MessageID = 0;
|
||||
PanGeoPairingDeviceId m_DeviceID = PAN_GP_INVALID;
|
||||
|
||||
/**
|
||||
* This function parses a data stream
|
||||
*
|
||||
* @param a_transparentData
|
||||
* @param a_sizeOfTransparentData
|
||||
*/
|
||||
virtual bool parse(const QByteArray& a_transparentData);
|
||||
|
||||
protected:
|
||||
int m_Size = 2;
|
||||
NGL::INGLLogger &m_logger;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
Executable
+122
@@ -0,0 +1,122 @@
|
||||
// **************************************************************************
|
||||
//
|
||||
// (C) Copyright 2009 Swiss SIMTEC AG
|
||||
//
|
||||
// **************************************************************************
|
||||
//
|
||||
// $HeadURL$
|
||||
// $LastChangedBy$
|
||||
// $LastChangedDate$
|
||||
// $LastChangedRevision$
|
||||
//
|
||||
// **************************************************************************
|
||||
|
||||
// manual class headers
|
||||
#include "GeoPairingDataFireReport.hpp"
|
||||
|
||||
namespace N_GeoPairingImpl
|
||||
{
|
||||
|
||||
GeoPairingDataFireReport::GeoPairingDataFireReport()
|
||||
: GeoPairingDataBase("GeoPairingDataFireReport")
|
||||
{
|
||||
m_Size = 18;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
bool GeoPairingDataFireReport::parse(const QByteArray& a_transparentData)
|
||||
{
|
||||
|
||||
if (!GeoPairingDataBase::parse(a_transparentData))
|
||||
{
|
||||
ERROR_LOG(m_logger) << "Couldn't parse Header";
|
||||
return false;
|
||||
}
|
||||
|
||||
//char *l_Buffer = (char *) a_transparentData;
|
||||
const char *l_Buffer = a_transparentData.constData();
|
||||
int l_StreamPosition = 2;
|
||||
|
||||
memcpy(&m_TimerTick, l_Buffer + l_StreamPosition, sizeof(m_TimerTick));
|
||||
l_StreamPosition += sizeof(m_TimerTick);
|
||||
INFO_LOG(m_logger) << "Stream -> TimerTick : " << (int) m_TimerTick;
|
||||
|
||||
memcpy(&m_Ammunition, l_Buffer + l_StreamPosition, sizeof(m_Ammunition));
|
||||
l_StreamPosition += sizeof(m_Ammunition);
|
||||
INFO_LOG(m_logger) << "Stream -> Ammunition : " << (int) m_Ammunition;
|
||||
|
||||
memcpy(&m_Pitch, l_Buffer + l_StreamPosition, sizeof(m_Pitch));
|
||||
memcpy(&m_PitchMin, l_Buffer + l_StreamPosition, sizeof(m_PitchMin));
|
||||
memcpy(&m_PitchMax, l_Buffer + l_StreamPosition + sizeof(m_PitchMin), sizeof(m_PitchMax));
|
||||
l_StreamPosition += sizeof(m_Pitch);
|
||||
INFO_LOG(m_logger) << "Stream -> Elevation : " << (int) m_Pitch;
|
||||
|
||||
memcpy(&m_Heading, l_Buffer + l_StreamPosition, sizeof(m_Heading));
|
||||
memcpy(&m_HeadingMin, l_Buffer + l_StreamPosition, sizeof(m_HeadingMin));
|
||||
memcpy(&m_HeadingMax, l_Buffer + l_StreamPosition + sizeof(m_HeadingMin), sizeof(m_HeadingMax));
|
||||
l_StreamPosition += sizeof(m_Heading);
|
||||
INFO_LOG(m_logger) << "Stream -> Azimuth : " << (int) m_Heading;
|
||||
|
||||
memcpy(&m_Temperature, l_Buffer + l_StreamPosition, sizeof(m_Temperature));
|
||||
l_StreamPosition += sizeof(m_Temperature);
|
||||
INFO_LOG(m_logger) << "Stream -> Temperature : " << (int) m_Temperature;
|
||||
|
||||
memcpy(&m_TimeToDetonate, l_Buffer + l_StreamPosition, sizeof(m_TimeToDetonate));
|
||||
l_StreamPosition += sizeof(m_TimeToDetonate);
|
||||
INFO_LOG(m_logger) << "Stream -> TimeToDetonate : " << (int) m_TimeToDetonate;
|
||||
|
||||
UInt8 l_WeaponSpecific = 0;
|
||||
memcpy(&l_WeaponSpecific, l_Buffer + l_StreamPosition, sizeof(l_WeaponSpecific));
|
||||
l_StreamPosition += sizeof(l_WeaponSpecific);
|
||||
INFO_LOG(m_logger) << "Stream -> WeaponSpecific : " << (int) l_WeaponSpecific;
|
||||
|
||||
switch (m_DeviceID)
|
||||
{
|
||||
case PAN_GP_REPORT_MK19:
|
||||
{
|
||||
m_MK19NbrRounds = l_WeaponSpecific;
|
||||
m_Pitch = m_PitchMin;
|
||||
m_Heading = m_HeadingMin;
|
||||
m_UseMinMax = true;
|
||||
INFO_LOG(m_logger) << "--> MK19NbrRounds : " << (int) m_MK19NbrRounds;
|
||||
INFO_LOG(m_logger) << "--> Pitch (avg) : " << (int) m_Pitch;
|
||||
INFO_LOG(m_logger) << "--> PitchMin : " << (int) m_PitchMin;
|
||||
INFO_LOG(m_logger) << "--> PitchMax : " << (int) m_PitchMax;
|
||||
INFO_LOG(m_logger) << "--> Heading (avg) : " << (int) m_Heading;
|
||||
INFO_LOG(m_logger) << "--> HeadingMin : " << (int) m_HeadingMin;
|
||||
INFO_LOG(m_logger) << "--> HeadingMax : " << (int) m_HeadingMax;
|
||||
break;
|
||||
}
|
||||
case PAN_GP_REPORT_IGLA:
|
||||
case PAN_GP_REQUEST_IGLA:
|
||||
{
|
||||
m_IGLAModeAuto = l_WeaponSpecific & PAN_GP_IGLA_MODE_MASK;
|
||||
INFO_LOG(m_logger) << "--> IGLAModeAuto : " << m_IGLAModeAuto;
|
||||
|
||||
m_IGLAChangeOverPressed = l_WeaponSpecific & PAN_GP_IGLA_CHANGEOVER_MASK;
|
||||
INFO_LOG(m_logger) << "--> IGLAChangeOverPressed : " << m_IGLAChangeOverPressed;
|
||||
|
||||
m_IGLARequestNbr = l_WeaponSpecific >> 2;
|
||||
INFO_LOG(m_logger) << "--> IGLARequestNbr : " << (int) m_IGLARequestNbr;
|
||||
break;
|
||||
}
|
||||
case PAN_GP_REPORT_MORTAR:
|
||||
case PAN_GP_REPORT_G5_G6:
|
||||
case PAN_GP_REPORT_M109:
|
||||
break;
|
||||
default:
|
||||
{
|
||||
ERROR_LOG(m_logger) << "--> Weapon with id " << m_DeviceID << " not implemented yet !";
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
UInt8 l_Reserved = 0;
|
||||
memcpy(&l_Reserved, l_Buffer + l_StreamPosition, sizeof(l_Reserved));
|
||||
INFO_LOG(m_logger) << "Stream -> Reserved : " << (int) l_Reserved;
|
||||
//l_StreamPosition += sizeof(l_Reserved);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace N_GeoPairingImpl
|
||||
Executable
+66
@@ -0,0 +1,66 @@
|
||||
// **************************************************************************
|
||||
//
|
||||
// (C) Copyright 2009 Swiss SIMTEC AG
|
||||
//
|
||||
// **************************************************************************
|
||||
//
|
||||
// $HeadURL$
|
||||
// $LastChangedBy$
|
||||
// $LastChangedDate$
|
||||
// $LastChangedRevision$
|
||||
//
|
||||
// **************************************************************************
|
||||
|
||||
#pragma once
|
||||
|
||||
// from stereotyped includes
|
||||
#include "GeoPairingDataBase.hpp"
|
||||
#include "../logger.h"
|
||||
|
||||
#define PAN_GP_IGLA_MODE_MASK 1
|
||||
#define PAN_GP_IGLA_CHANGEOVER_MASK 2
|
||||
|
||||
#define PAN_AMMU_MORTAR_1 1
|
||||
#define PAN_AMMU_MORTAR_2 2
|
||||
|
||||
|
||||
namespace N_GeoPairingImpl
|
||||
{
|
||||
|
||||
/**
|
||||
* @author Daniel.Schmid
|
||||
* @version 1.0
|
||||
* @created 01-Nov-2011 08:36:26
|
||||
*/
|
||||
class GeoPairingDataFireReport : public GeoPairingDataBase
|
||||
{
|
||||
public:
|
||||
|
||||
GeoPairingDataFireReport();
|
||||
|
||||
UInt16 m_TimerTick = 0;
|
||||
SInt32 m_Pitch = 0;
|
||||
SInt16 m_PitchMin = 0;
|
||||
SInt16 m_PitchMax = 0;
|
||||
SInt32 m_Heading = 0;
|
||||
SInt16 m_HeadingMin = 0;
|
||||
SInt16 m_HeadingMax = 0;
|
||||
UInt16 m_TimeToDetonate = 0;
|
||||
SInt8 m_Temperature = 0;
|
||||
UInt8 m_Ammunition = 0;
|
||||
UInt8 m_MK19NbrRounds = 0;
|
||||
UInt8 m_IGLARequestNbr = 0;
|
||||
bool m_IGLAModeAuto = false;
|
||||
bool m_IGLAChangeOverPressed = false;
|
||||
bool m_UseMinMax = false;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @param a_transparentData
|
||||
* @param a_sizeOfTransparentData
|
||||
*/
|
||||
bool parse(const QByteArray& a_transparentData) override;
|
||||
};
|
||||
|
||||
}
|
||||
Executable
+406
@@ -0,0 +1,406 @@
|
||||
// **************************************************************************
|
||||
//
|
||||
// (C) Copyright 2009 Swiss SIMTEC AG
|
||||
//
|
||||
// **************************************************************************
|
||||
//
|
||||
// $HeadURL$
|
||||
// $LastChangedBy$
|
||||
// $LastChangedDate$
|
||||
// $LastChangedRevision$
|
||||
//
|
||||
// **************************************************************************
|
||||
|
||||
// manual class headers
|
||||
#include "GeoPairingImpl.hpp"
|
||||
#include <GBL_ConfigSystem/geoconfig.h>
|
||||
#include <FW_Ballistic/AmmunitionTypes.hpp>
|
||||
#include "../settings.h"
|
||||
|
||||
// from cpp_includes
|
||||
#include <GBL_Types/Radian64.hpp>
|
||||
#include "GeoPairingImplAirTargetCacheData.hpp"
|
||||
|
||||
#include "GeoPairingDataFireReport.hpp"
|
||||
#include <QDateTime>
|
||||
|
||||
#define PAN_AMMU_TIMEPROG(ammunition) (ammunition & 0x01)
|
||||
#define PAN_AMMU_INDEX(ammunition) ((ammunition >> 1) & 0x03)
|
||||
#define PAN_AMMU_CHARGE(ammunition) ((ammunition >> 3) & 0x07)
|
||||
|
||||
#define PAN_AMMU_INDEX_G5_G6(ammunition) (ammunition & 0x0F)
|
||||
#define PAN_AMMU_CHARGE_G5_G6(ammunition) ((ammunition >> 4) & 0x0F)
|
||||
|
||||
namespace N_GeoPairingImpl
|
||||
{
|
||||
|
||||
inline void endian_swap(UInt16 &a_value)
|
||||
{
|
||||
a_value = (a_value >> 8) |
|
||||
(a_value << 8);
|
||||
}
|
||||
inline void endian_swap(UInt32 &a_value)
|
||||
{
|
||||
a_value = (a_value >> 24) |
|
||||
((a_value << 8) & 0x00FF0000) |
|
||||
((a_value >> 8) & 0x0000FF00) |
|
||||
(a_value << 24);
|
||||
}
|
||||
|
||||
GeoPairingImpl::GeoPairingImpl(const char *loggerName)
|
||||
: m_Initialized(false)
|
||||
, m_logger(CesGeoPairing::getLogger(loggerName))
|
||||
{
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
// creates a new air target tracker
|
||||
// ---------------------------------------------------------------
|
||||
GeoPairingImplAirTargetTracker *GeoPairingImpl::createAirTargetTracker()
|
||||
{
|
||||
return new GeoPairingImplAirTargetTracker(&m_ListAirTargets);
|
||||
}
|
||||
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
// creates a new air target updater
|
||||
// ---------------------------------------------------------------
|
||||
GeoPairingImplAirTargetUpdater *GeoPairingImpl::createAirTargetUpdater()
|
||||
{
|
||||
return new GeoPairingImplAirTargetUpdater(&m_ListAirTargets);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
// creates a new air target cache
|
||||
// ---------------------------------------------------------------
|
||||
GeoPairingImplAirTargetCache *GeoPairingImpl::createAirTargetCache(UInt32 a_playerID)
|
||||
{
|
||||
return new GeoPairingImplAirTargetCache(a_playerID, &m_CacheData);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
// Pupulates a SensorData instance according to the given
|
||||
// transparent datastream
|
||||
// ---------------------------------------------------------------
|
||||
SInt32 GeoPairingImpl::createSensorData(GeoPairingImplSensorData *a_sensorData, const QByteArray& a_transparendData, int &isDefault)
|
||||
{
|
||||
INFO_LOG(m_logger) << "createSensorData";
|
||||
if (!m_Initialized)
|
||||
{
|
||||
ERROR_LOG(m_logger) << "Implementation not initialized";
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!a_sensorData)
|
||||
{
|
||||
ERROR_LOG(m_logger) << "SensorData Object argument not valid";
|
||||
return -1;
|
||||
}
|
||||
|
||||
GeoPairingDataFireReport l_Report;
|
||||
if (!l_Report.parse(a_transparendData))
|
||||
{
|
||||
ERROR_LOG(m_logger) << "Couldn't parse FireReport";
|
||||
return -1;
|
||||
}
|
||||
|
||||
N_Types::Radian64 l_Azimuth;
|
||||
l_Azimuth.setDegree(l_Report.m_Heading / 10.0);
|
||||
|
||||
N_Types::Radian64 l_Elevation;
|
||||
l_Elevation.setDegree(l_Report.m_Pitch / 10.0);
|
||||
|
||||
bool l_ConsiderGeoMagneticField = false;
|
||||
Float64 l_GeoMagneticCorrection = 0.0;
|
||||
|
||||
if (l_Report.m_DeviceID == PAN_GP_REPORT_MORTAR ||
|
||||
l_Report.m_DeviceID == PAN_GP_REQUEST_IGLA ||
|
||||
l_Report.m_DeviceID == PAN_GP_REPORT_IGLA)
|
||||
l_ConsiderGeoMagneticField = true;
|
||||
|
||||
if (l_ConsiderGeoMagneticField)
|
||||
{
|
||||
auto l_config = N_ConfigSystem::GeoConfig::getInstance();
|
||||
|
||||
QString geoMagneticFieldStr = QStringLiteral("GeoMagneticField");
|
||||
QString dateStr = QStringLiteral("Date");
|
||||
QString declinationStr = QStringLiteral("Declination");
|
||||
QString changePerYearStr = QStringLiteral("ChangePerYear");
|
||||
|
||||
QString l_DateRecord = l_config->getString(geoMagneticFieldStr, dateStr, QString());
|
||||
Float64 l_Declination = l_config->getFloat(geoMagneticFieldStr, declinationStr, 0.0);
|
||||
Float64 l_ChangePerYear = l_config->getFloat(geoMagneticFieldStr, changePerYearStr, 0.0);
|
||||
|
||||
int l_Year = 0, l_Month = 0, l_Day = 0;
|
||||
//int l_Result = sscanf(l_DateRecord.c_str(), "%d-%d-%d", &l_Year, &l_Month, &l_Day);
|
||||
|
||||
QDate date = QDate::fromString(l_DateRecord, QStringLiteral("yyyy-MM-dd"));
|
||||
l_Year = date.year();
|
||||
l_Month = date.month();
|
||||
l_Day = date.day();
|
||||
|
||||
if (date.isValid())
|
||||
{
|
||||
INFO_LOG(m_logger) << "GeoMagneticField DateRecord = " << l_DateRecord;
|
||||
INFO_LOG(m_logger) << "GeoMagneticField Declination = " << l_Declination;
|
||||
INFO_LOG(m_logger) << "GeoMagneticField ChangePerYear = " << l_ChangePerYear;
|
||||
|
||||
time_t l_TimeNow = time(nullptr);
|
||||
struct tm l_TimeInfo;
|
||||
memset(&l_TimeInfo, 0, sizeof(tm));
|
||||
l_TimeInfo.tm_year = l_Year - 1900;
|
||||
l_TimeInfo.tm_mon = l_Month - 1;
|
||||
l_TimeInfo.tm_mday = l_Day;
|
||||
time_t l_TimeRec = mktime(&l_TimeInfo);
|
||||
|
||||
double l_TimeDiff = difftime(l_TimeNow, l_TimeRec);
|
||||
|
||||
int l_SecondsPerYear = 365 * 24 * 3600;
|
||||
int l_Years = l_TimeDiff / l_SecondsPerYear; // number of years since DateRecords
|
||||
DEBUG_LOG(m_logger) << "GeoMagneticField Years since DateRecord : " << l_Years;
|
||||
|
||||
l_GeoMagneticCorrection = l_Declination + (l_Years * l_ChangePerYear);
|
||||
INFO_LOG(m_logger) << "GeoMagneticField Azimuth correction [degrees]: " << l_GeoMagneticCorrection;
|
||||
l_GeoMagneticCorrection *= N_SST::PI_OVER_180;
|
||||
l_Azimuth += l_GeoMagneticCorrection;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
INFO_LOG(m_logger) << "createSensorData";
|
||||
|
||||
if (l_Report.m_DeviceID == PAN_GP_REPORT_MORTAR)
|
||||
{
|
||||
int l_AmmunitionField = PAN_AMMU_INDEX(l_Report.m_Ammunition);
|
||||
INFO_LOG(m_logger) << "createSensorData PAN_GP_REPORT_MORTAR l_AmmunitionField=" << +l_AmmunitionField
|
||||
<< " l_Report.m_Ammunition=" << +l_Report.m_Ammunition
|
||||
<< " l_Report.m_Ammunition & 0x03=" << +(l_Report.m_Ammunition & 0x03);
|
||||
switch (l_Report.m_Ammunition & 0x03)
|
||||
{
|
||||
case 1:
|
||||
a_sensorData->AmmunitionType = MortarType1;
|
||||
INFO_LOG(m_logger) << "Using Mortar Ammunition 1";
|
||||
break;
|
||||
case 2:
|
||||
a_sensorData->AmmunitionType = MortarType2;
|
||||
INFO_LOG(m_logger) << "Using Mortar Ammunition 2";
|
||||
break;
|
||||
default:
|
||||
a_sensorData->AmmunitionType = MortarType1;
|
||||
ERROR_LOG(m_logger) << "Ammunition value means 'reserved' : "
|
||||
<< l_AmmunitionField;
|
||||
return -1;
|
||||
}
|
||||
a_sensorData->IgnitionType = (l_Report.m_Ammunition >> 3) & 0x07;
|
||||
INFO_LOG(m_logger) << "a_sensorData->IgnitionType= " << a_sensorData->IgnitionType;
|
||||
}
|
||||
else if ((l_Report.m_DeviceID == PAN_GP_REPORT_G5_G6) || (l_Report.m_DeviceID == PAN_GP_REPORT_M109))
|
||||
{
|
||||
int l_AmmunitionField = PAN_AMMU_INDEX_G5_G6(l_Report.m_Ammunition);
|
||||
switch (l_AmmunitionField)
|
||||
{
|
||||
case 1:
|
||||
a_sensorData->AmmunitionType = HE_M1A2;
|
||||
a_sensorData->IgnitionTypeG5G6 = IgnitionTypePercussion;
|
||||
INFO_LOG(m_logger) << "Using HE_M1A2 Percussion";
|
||||
break;
|
||||
case 2:
|
||||
a_sensorData->AmmunitionType = HE_M1A2;
|
||||
a_sensorData->IgnitionTypeG5G6 = IgnitionTypeProximity;
|
||||
INFO_LOG(m_logger) << "Using HE_M1A2 Proximity";
|
||||
break;
|
||||
case 3:
|
||||
a_sensorData->AmmunitionType = VLAP_M9703;
|
||||
a_sensorData->IgnitionTypeG5G6 = IgnitionTypePercussion;
|
||||
INFO_LOG(m_logger) << "Using VLAP_M9703 Percussion";
|
||||
break;
|
||||
case 4:
|
||||
a_sensorData->AmmunitionType = VLAP_M9703;
|
||||
a_sensorData->IgnitionTypeG5G6 = IgnitionTypeProximity;
|
||||
INFO_LOG(m_logger) << "Using VLAP_M9703 Proximity";
|
||||
break;
|
||||
case 5:
|
||||
a_sensorData->AmmunitionType = SMK_BE_M2;
|
||||
a_sensorData->IgnitionTypeG5G6 = IgnitionTypeTime;
|
||||
INFO_LOG(m_logger) << "Using SMK_BE_M2 Time";
|
||||
break;
|
||||
case 6:
|
||||
a_sensorData->AmmunitionType = CLUSTER_HEHC_M9609;
|
||||
a_sensorData->IgnitionTypeG5G6 = IgnitionTypeTime;
|
||||
INFO_LOG(m_logger) << "Using CLUSTER_HEHC_M9609 Time";
|
||||
break;
|
||||
default:
|
||||
a_sensorData->AmmunitionType = HE_M1A2;
|
||||
a_sensorData->IgnitionTypeG5G6 = IgnitionTypePercussion;
|
||||
isDefault = 1;
|
||||
ERROR_LOG(m_logger) << "Ammunition value means 'reserved' : " << l_AmmunitionField;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
else if (l_Report.m_DeviceID == PAN_GP_REPORT_MK19)
|
||||
{
|
||||
|
||||
N_Types::Radian64 l_AzimuthMin;
|
||||
l_AzimuthMin.setDegree(l_Report.m_HeadingMin / 10.0);
|
||||
N_Types::Radian64 l_AzimuthMax;
|
||||
l_AzimuthMax.setDegree(l_Report.m_HeadingMax / 10.0);
|
||||
|
||||
l_AzimuthMin += l_GeoMagneticCorrection;
|
||||
l_AzimuthMax += l_GeoMagneticCorrection;
|
||||
|
||||
N_Types::Radian64 l_ElevationMin;
|
||||
l_ElevationMin.setDegree(l_Report.m_PitchMin / 10.0);
|
||||
N_Types::Radian64 l_ElevationMax;
|
||||
l_ElevationMax.setDegree(l_Report.m_PitchMax / 10.0);
|
||||
|
||||
// we have to negate the sensor heading for SST coordinate system which is ccw
|
||||
a_sensorData->WeaponAzimuthMin = - l_AzimuthMin;
|
||||
a_sensorData->WeaponAzimuthMax = - l_AzimuthMax;
|
||||
|
||||
if (a_sensorData->WeaponAzimuthMin > a_sensorData->WeaponAzimuthMax)
|
||||
{
|
||||
a_sensorData->WeaponAzimuthMin = - l_AzimuthMax;
|
||||
a_sensorData->WeaponAzimuthMax = - l_AzimuthMin;
|
||||
}
|
||||
|
||||
a_sensorData->WeaponElevationMin = l_ElevationMin;
|
||||
a_sensorData->WeaponElevationMax = l_ElevationMax;
|
||||
|
||||
if (a_sensorData->WeaponElevationMin > a_sensorData->WeaponElevationMax)
|
||||
{
|
||||
a_sensorData->WeaponElevationMin = l_ElevationMax;
|
||||
a_sensorData->WeaponElevationMax = l_ElevationMin;
|
||||
}
|
||||
|
||||
int l_AmmunitionField = PAN_AMMU_INDEX(l_Report.m_Ammunition);
|
||||
switch (l_AmmunitionField)
|
||||
{
|
||||
case 1:
|
||||
a_sensorData->AmmunitionType = MK19Type_m385;
|
||||
INFO_LOG(m_logger) << "Using MK19 Ammunition 1 (m385)";
|
||||
break;
|
||||
case 2:
|
||||
a_sensorData->AmmunitionType = MK19Type_m430;
|
||||
INFO_LOG(m_logger) << "Using MK19 Ammunition 2 (m430)";
|
||||
break;
|
||||
default:
|
||||
a_sensorData->AmmunitionType = MK19Type_m385;
|
||||
ERROR_LOG(m_logger) << "Ammunition value means 'reserved' : " << l_AmmunitionField;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
else if (l_Report.m_DeviceID == PAN_GP_REPORT_IGLA ||
|
||||
l_Report.m_DeviceID == PAN_GP_REQUEST_IGLA)
|
||||
{
|
||||
a_sensorData->AmmunitionType = AmmunitionTypeUnknown; // irrelevant
|
||||
INFO_LOG(m_logger) << "Using IGLA Ammunition 1";
|
||||
}
|
||||
else
|
||||
{
|
||||
ERROR_LOG(m_logger) << "Couldn't create sensorData for DeviceID : " << l_Report.m_DeviceID;
|
||||
return -1;
|
||||
}
|
||||
|
||||
a_sensorData->UseMinMax = l_Report.m_UseMinMax;
|
||||
a_sensorData->WeaponAzimuth = - l_Azimuth; // we have to negate the sensor heading for SST coordinate system which is ccw
|
||||
a_sensorData->WeaponElevation = l_Elevation;
|
||||
a_sensorData->WeaponTemperature = l_Report.m_Temperature;
|
||||
|
||||
INFO_LOG(m_logger) << "a_sensorData->ChargeType=" << a_sensorData->ChargeType
|
||||
<< " l_Report.m_Ammunition=" << l_Report.m_Ammunition
|
||||
<< " l_Report.m_DeviceID=" << l_Report.m_DeviceID;
|
||||
|
||||
if (l_Report.m_DeviceID == PAN_GP_REPORT_MORTAR)
|
||||
{
|
||||
|
||||
switch (l_Report.m_Ammunition)
|
||||
{
|
||||
case MortarType1:
|
||||
default:
|
||||
a_sensorData->ChargeType = N_Ballistic::MOERSER;
|
||||
break;
|
||||
case MortarType2:
|
||||
a_sensorData->ChargeType = N_Ballistic::NEBEL;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
// if ( l_Report.m_Ammunition == 2)
|
||||
// a_sensorData->ChargeType = 382;
|
||||
// else
|
||||
// a_sensorData->ChargeType = 385;
|
||||
INFO_LOG(m_logger) << "PAN_GP_REPORT_MORTAR: l_Report.m_Ammunition" << l_Report.m_Ammunition
|
||||
<< " a_sensorData->ChargeType=" << a_sensorData->ChargeType;
|
||||
}
|
||||
else if ((l_Report.m_DeviceID != PAN_GP_REPORT_G5_G6) && (l_Report.m_DeviceID != PAN_GP_REPORT_M109))
|
||||
{
|
||||
a_sensorData->ChargeType = PAN_AMMU_CHARGE(l_Report.m_Ammunition);
|
||||
if (PAN_AMMU_TIMEPROG(l_Report.m_Ammunition))
|
||||
a_sensorData->IgnitionType = l_Report.m_TimeToDetonate;
|
||||
else
|
||||
a_sensorData->IgnitionType = 0;
|
||||
INFO_LOG(m_logger) << "if a_sensorData->ChargeType=" << a_sensorData->ChargeType;
|
||||
}
|
||||
else
|
||||
{
|
||||
INFO_LOG(m_logger) << "else a_sensorData->ChargeType=" << a_sensorData->ChargeType;
|
||||
|
||||
SInt32 ch = PAN_AMMU_CHARGE_G5_G6(l_Report.m_Ammunition);
|
||||
|
||||
if (ch == 1) // M64 Base
|
||||
{
|
||||
a_sensorData->ChargeType = 0;
|
||||
INFO_LOG(m_logger) << "Using Charge M64 Base";
|
||||
}
|
||||
else if (ch == 3) // 3 x M64 Incr
|
||||
{
|
||||
a_sensorData->ChargeType = 1;
|
||||
INFO_LOG(m_logger) << "Using Charge M64 INCR x 3";
|
||||
}
|
||||
else if (ch == 4) // 4 x M64 Incr
|
||||
{
|
||||
a_sensorData->ChargeType = 2;
|
||||
INFO_LOG(m_logger) << "Using Charge M64 INCR x 4";
|
||||
}
|
||||
else if (ch == 5) // 5 x M64 Incr
|
||||
{
|
||||
a_sensorData->ChargeType = 3;
|
||||
INFO_LOG(m_logger) << "Using Charge M64 INCR x 5";
|
||||
}
|
||||
else if (ch == 6) // 5 x M64 Incr + Base Bleed
|
||||
{
|
||||
a_sensorData->ChargeType = 4;
|
||||
INFO_LOG(m_logger) << "Using Charge M64 INCR x 5 + Base Bleed";
|
||||
}
|
||||
else
|
||||
{
|
||||
a_sensorData->ChargeType = 0;
|
||||
isDefault = 1;
|
||||
WARNING_LOG(m_logger) << "Unknown Charge Type. Using Charge M64 Base";
|
||||
}
|
||||
}
|
||||
INFO_LOG(m_logger) << "a_sensorData->ChargeType=" << a_sensorData->ChargeType;
|
||||
return l_Report.m_DeviceID;
|
||||
}
|
||||
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
// Sets global meteo conditions
|
||||
// ---------------------------------------------------------------
|
||||
void GeoPairingImpl::setMeteoData(const GeoPairingImplMeteoData &a_meteoData)
|
||||
{
|
||||
if (!m_Initialized)
|
||||
{
|
||||
ERROR_LOG(m_logger) << "Implementation not initialized";
|
||||
return;
|
||||
}
|
||||
m_MeteoData = a_meteoData;
|
||||
|
||||
INFO_LOG(m_logger) << "---------- Setting Meteo Data ------------";
|
||||
INFO_LOG(m_logger) << "AirPressure : " << m_MeteoData.AirPressure;
|
||||
INFO_LOG(m_logger) << "Temperature : " << m_MeteoData.Temperature;
|
||||
INFO_LOG(m_logger) << "WindDirection : " << m_MeteoData.WindDirection;
|
||||
INFO_LOG(m_logger) << "WindSpeed : " << m_MeteoData.WindSpeed;
|
||||
}
|
||||
|
||||
} // namespace N_GeoPairingImpl
|
||||
Executable
+105
@@ -0,0 +1,105 @@
|
||||
// **************************************************************************
|
||||
//
|
||||
// (C) Copyright 2009 Swiss SIMTEC AG
|
||||
//
|
||||
// **************************************************************************
|
||||
//
|
||||
// $HeadURL$
|
||||
// $LastChangedBy$
|
||||
// $LastChangedDate$
|
||||
// $LastChangedRevision$
|
||||
//
|
||||
// **************************************************************************
|
||||
|
||||
#pragma once
|
||||
|
||||
// from stereotyped includes
|
||||
#include "GeoPairingImplAirTargetCache.hpp"
|
||||
#include "GeoPairingImplMeteoData.hpp"
|
||||
#include "GeoPairingImplAirTargetTracker.hpp"
|
||||
#include "GeoPairingImplFiredBullet.hpp"
|
||||
#include "GeoPairingImplAirTarget.hpp"
|
||||
#include "GeoPairingImplSensorData.hpp"
|
||||
#include "GeoPairingImplAirTargetUpdater.hpp"
|
||||
#include <FW_Ballistic/BallisticService.hpp>
|
||||
#include <memory>
|
||||
|
||||
namespace N_GeoPairingImpl
|
||||
{
|
||||
|
||||
/**
|
||||
* This class is the base implementation of the GeoPairing component. A real
|
||||
* Implemtation must be derived from it.
|
||||
*
|
||||
* @author Daniel.Schmid
|
||||
* @version 1.0
|
||||
* @created 29-Sep-2009 15:16:19
|
||||
*/
|
||||
class GeoPairingImpl
|
||||
{
|
||||
public:
|
||||
|
||||
GeoPairingImpl(const char *loggerName);
|
||||
virtual ~GeoPairingImpl() = default;
|
||||
|
||||
|
||||
/**
|
||||
* creates a new air target tracker
|
||||
*/
|
||||
GeoPairingImplAirTargetTracker *createAirTargetTracker();
|
||||
|
||||
/**
|
||||
* creates a new air target updater
|
||||
*/
|
||||
GeoPairingImplAirTargetUpdater *createAirTargetUpdater();
|
||||
|
||||
/**
|
||||
* creates a new air target cache
|
||||
*
|
||||
* @param a_playerID
|
||||
*/
|
||||
GeoPairingImplAirTargetCache *createAirTargetCache(UInt32 a_playerID);
|
||||
|
||||
/**
|
||||
* Creates a new fired bulled according to the given SensorData
|
||||
*
|
||||
* @param a_sensorData
|
||||
*/
|
||||
virtual GeoPairingImplFiredBullet *createFiredBullet(GeoPairingImplSensorData &a_sensorData) = 0;
|
||||
|
||||
/**
|
||||
* Pupulates a SensorData instance according to the given transparent datastream
|
||||
*
|
||||
* @param a_sensorData
|
||||
* @param a_transparendData
|
||||
* @param a_sizeOfTransparentData
|
||||
*/
|
||||
virtual SInt32 createSensorData(GeoPairingImplSensorData *a_sensorData,
|
||||
const QByteArray& a_transparendData,
|
||||
int &isDefault);
|
||||
/**
|
||||
* Initialize the GeoPairing implementation
|
||||
*
|
||||
* @param a_config
|
||||
*/
|
||||
virtual bool initialize(const QString &a_config) = 0;
|
||||
|
||||
/**
|
||||
* Sets global meteo conditions
|
||||
*
|
||||
* @param a_meteoData
|
||||
*/
|
||||
void setMeteoData(const GeoPairingImplMeteoData &a_meteoData);
|
||||
|
||||
protected:
|
||||
|
||||
bool m_Initialized;
|
||||
std::vector<GeoPairingImplAirTarget *> m_ListAirTargets;
|
||||
|
||||
GeoPairingImplMeteoData m_MeteoData;
|
||||
|
||||
CacheType m_CacheData;
|
||||
NGL::INGLLogger &m_logger;
|
||||
};
|
||||
|
||||
}
|
||||
Executable
+96
@@ -0,0 +1,96 @@
|
||||
|
||||
// **************************************************************************
|
||||
//
|
||||
// (C) Copyright 2009 Swiss SIMTEC AG
|
||||
//
|
||||
// **************************************************************************
|
||||
//
|
||||
// $HeadURL$
|
||||
// $LastChangedBy$
|
||||
// $LastChangedDate$
|
||||
// $LastChangedRevision$
|
||||
//
|
||||
// **************************************************************************
|
||||
|
||||
// manual class headers
|
||||
#include "GeoPairingImplAirTarget.hpp"
|
||||
|
||||
// from cpp_includes
|
||||
#include <GBL_Types/GeoCoord.hpp>
|
||||
|
||||
namespace N_GeoPairingImpl
|
||||
{
|
||||
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
// Constructor
|
||||
// ---------------------------------------------------------------
|
||||
GeoPairingImplAirTarget::GeoPairingImplAirTarget(SInt32 a_playerID)
|
||||
: m_PlayerID(a_playerID),
|
||||
m_logger(CesGeoPairing::getLogger("Plugin.GeoPairing.GeoPairingImplAirTarget"))
|
||||
{
|
||||
INFO_LOG(m_logger) << "Constructor : PlayerID " << m_PlayerID;
|
||||
}
|
||||
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
// updates the position
|
||||
// ---------------------------------------------------------------
|
||||
bool GeoPairingImplAirTarget::updatePosition(Float64 a_positionLat, Float64 a_positionLon, Float64 a_positionAlt, UInt32 a_positionTime)
|
||||
{
|
||||
if (a_positionTime <= m_PositionTime)
|
||||
{
|
||||
INFO_LOG(m_logger) << "No new position info for Player " << m_PlayerID
|
||||
<< ", abandon update. PositionTime = "
|
||||
<< a_positionTime;
|
||||
return false;
|
||||
}
|
||||
|
||||
INFO_LOG(m_logger) << "Set new Position for Player " << m_PlayerID;
|
||||
|
||||
N_Math::GeoCoord l_NewPositionUtm;
|
||||
l_NewPositionUtm.setLlPositionDegree(a_positionLat, a_positionLon, a_positionAlt);
|
||||
|
||||
N_Types::Coord3 l_NewPosition(l_NewPositionUtm.utmEasting(), l_NewPositionUtm.utmNorthing(), l_NewPositionUtm.height());
|
||||
|
||||
if (m_PositionTime > 0)
|
||||
{
|
||||
UInt32 l_TimeDiff = a_positionTime - m_PositionTime;
|
||||
INFO_LOG(m_logger) << "l_TimeDiff [s]: " << l_TimeDiff;
|
||||
|
||||
// when new position time is more current than existing one
|
||||
if (l_TimeDiff > 0)
|
||||
{
|
||||
N_Types::Vec3 l_NewDirection = l_NewPosition - m_Position;
|
||||
Float64 l_Distance = l_NewDirection.magnitude();
|
||||
INFO_LOG(m_logger) << "l_Distance [m]: " << l_Distance;
|
||||
l_NewDirection /= l_Distance;
|
||||
m_Direction = l_NewDirection;
|
||||
INFO_LOG(m_logger) << "m_Direction : " << m_Direction;
|
||||
|
||||
m_Speed = l_Distance / l_TimeDiff;
|
||||
INFO_LOG(m_logger) << "m_Speed [m/s]: " << m_Speed;
|
||||
}
|
||||
}
|
||||
|
||||
m_Position = l_NewPosition;
|
||||
INFO_LOG(m_logger) << "m_Position : " << m_Position;
|
||||
|
||||
m_PositionTime = a_positionTime;
|
||||
INFO_LOG(m_logger) << "m_PositionTime : " << m_PositionTime;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
// updates the air target state
|
||||
// ---------------------------------------------------------------
|
||||
void GeoPairingImplAirTarget::updateState(SInt32 a_state)
|
||||
{
|
||||
INFO_LOG(m_logger) << "Set new State for Player "
|
||||
<< m_PlayerID << " : " << a_state;
|
||||
m_State = a_state;
|
||||
}
|
||||
|
||||
|
||||
} // namespace N_GeoPairingImpl
|
||||
Executable
+77
@@ -0,0 +1,77 @@
|
||||
#pragma once
|
||||
|
||||
// **************************************************************************
|
||||
//
|
||||
// (C) Copyright 2009 Swiss SIMTEC AG
|
||||
//
|
||||
// **************************************************************************
|
||||
//
|
||||
// $HeadURL$
|
||||
// $LastChangedBy$
|
||||
// $LastChangedDate$
|
||||
// $LastChangedRevision$
|
||||
//
|
||||
// **************************************************************************
|
||||
|
||||
#include <GBL_Global/Types.hpp>
|
||||
#include <GBL_Types/Coord3.hpp>
|
||||
#include <GBL_Types/Vec3.hpp>
|
||||
#include "../logger.h"
|
||||
|
||||
|
||||
namespace N_GeoPairingImpl
|
||||
{
|
||||
|
||||
/**
|
||||
* This class holds information about the position and velocity of air targets
|
||||
*
|
||||
* @author Daniel.Schmid
|
||||
* @version 1.0
|
||||
* @created 22-Dez-2011 10:46:54
|
||||
*/
|
||||
class GeoPairingImplAirTarget
|
||||
{
|
||||
public:
|
||||
virtual ~GeoPairingImplAirTarget() = default;
|
||||
|
||||
SInt32 m_PlayerID;
|
||||
N_Types::Coord3 m_Position;
|
||||
N_Types::Vec3 m_Direction;
|
||||
UInt32 m_PositionTime = 0;
|
||||
SInt32 m_State = 0;
|
||||
Float64 m_Speed = 0;
|
||||
bool m_IRJammer = false;
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param a_playerID
|
||||
*/
|
||||
explicit GeoPairingImplAirTarget(SInt32 a_playerID);
|
||||
|
||||
/**
|
||||
* updates the position
|
||||
*
|
||||
* @param a_positionLat
|
||||
* @param a_positionLon
|
||||
* @param a_positionAlt
|
||||
* @param a_positionTime
|
||||
*/
|
||||
bool updatePosition(Float64 a_positionLat, Float64 a_positionLon, Float64 a_positionAlt, UInt32 a_positionTime);
|
||||
|
||||
/**
|
||||
* updates the air target state
|
||||
*
|
||||
* @param a_state
|
||||
*/
|
||||
void updateState(SInt32 a_state);
|
||||
|
||||
protected:
|
||||
|
||||
private:
|
||||
NGL::INGLLogger &m_logger;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
+161
@@ -0,0 +1,161 @@
|
||||
// **************************************************************************
|
||||
//
|
||||
// (C) Copyright 2009 Swiss SIMTEC AG
|
||||
//
|
||||
// **************************************************************************
|
||||
//
|
||||
// $HeadURL$
|
||||
// $LastChangedBy$
|
||||
// $LastChangedDate$
|
||||
// $LastChangedRevision$
|
||||
//
|
||||
// **************************************************************************
|
||||
|
||||
// manual class headers
|
||||
#include "GeoPairingImplAirTargetCache.hpp"
|
||||
#include <GBL_ConfigSystem/geoconfig.h>
|
||||
|
||||
// from cpp_includes
|
||||
#include "GeoPairingImplAirTargetCacheData.hpp"
|
||||
|
||||
namespace N_GeoPairingImpl
|
||||
{
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
// Constructor
|
||||
// ---------------------------------------------------------------
|
||||
GeoPairingImplAirTargetCache::GeoPairingImplAirTargetCache(SInt32 a_player, CacheType *a_cacheData)
|
||||
: m_CacheData(a_cacheData),
|
||||
m_PlayerID(a_player),
|
||||
m_Timeout(0),
|
||||
m_logger(CesGeoPairing::getLogger("Plugin.GeoPairing.GeoPairingImplAirTargetCache"))
|
||||
{
|
||||
auto l_config = N_ConfigSystem::GeoConfig::getInstance();
|
||||
m_Timeout = l_config->getInteger(QStringLiteral("IGLA"), QStringLiteral("CacheTimeout"), 5);
|
||||
}
|
||||
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
// retrieves the last cached tracking state
|
||||
// ---------------------------------------------------------------
|
||||
bool GeoPairingImplAirTargetCache::getLatestTrackState(SInt32 a_targetID) const
|
||||
{
|
||||
GeoPairingImplAirTargetCacheData *l_Cache = getLatestCacheData(a_targetID);
|
||||
if (l_Cache == nullptr)
|
||||
return false;
|
||||
|
||||
return l_Cache->m_TrackState;
|
||||
}
|
||||
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
// retrieves the last cached tracking time
|
||||
// ---------------------------------------------------------------
|
||||
UInt32 GeoPairingImplAirTargetCache::getLatestTrackTime(SInt32 a_targetID) const
|
||||
{
|
||||
GeoPairingImplAirTargetCacheData *l_Cache = getLatestCacheData(a_targetID);
|
||||
if (l_Cache == nullptr)
|
||||
return 0;
|
||||
|
||||
return l_Cache->m_TrackTime;
|
||||
}
|
||||
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
GeoPairingImplAirTargetCacheData *GeoPairingImplAirTargetCache::getLatestCacheData(SInt32 a_targetID) const
|
||||
{
|
||||
if (m_CacheData == nullptr)
|
||||
{
|
||||
ERROR_LOG(m_logger) << "No global Cache pointer present!";
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (m_CacheData->empty())
|
||||
{
|
||||
INFO_LOG(m_logger) << "Global Cache empty";
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
CacheType::iterator it = m_CacheData->find(m_PlayerID);
|
||||
if (it == m_CacheData->end())
|
||||
{
|
||||
INFO_LOG(m_logger) << "No Cache present for Player " << m_PlayerID
|
||||
<< " tracking Target " << a_targetID;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
CacheDataType *l_Cache = (it->second);
|
||||
|
||||
if (l_Cache->empty())
|
||||
{
|
||||
INFO_LOG(m_logger) << "Cache for Player " << m_PlayerID << " is empty";
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
CacheDataType::iterator itC = l_Cache->find(a_targetID);
|
||||
if (itC == l_Cache->end())
|
||||
{
|
||||
INFO_LOG(m_logger) << "Target " << a_targetID
|
||||
<< " not found in Cache of Player "
|
||||
<< m_PlayerID;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return itC->second;
|
||||
}
|
||||
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
// store latest state
|
||||
// ---------------------------------------------------------------
|
||||
bool GeoPairingImplAirTargetCache::storeLatestTrackState(SInt32 a_targetID, UInt32 a_trackingTime, bool a_trackingState)
|
||||
{
|
||||
if (m_CacheData == nullptr)
|
||||
{
|
||||
ERROR_LOG(m_logger) << "No global Cache pointer present!";
|
||||
return false;
|
||||
}
|
||||
|
||||
CacheType::iterator it = m_CacheData->find(m_PlayerID);
|
||||
if (it == m_CacheData->end())
|
||||
{
|
||||
(*m_CacheData)[m_PlayerID] = new CacheDataType();
|
||||
INFO_LOG(m_logger) << "Create new Cache for Player " << m_PlayerID;
|
||||
}
|
||||
|
||||
CacheDataType *l_Cache = (*m_CacheData)[m_PlayerID];
|
||||
|
||||
GeoPairingImplAirTargetCacheData *l_CacheData = nullptr;
|
||||
CacheDataType::iterator itC = l_Cache->find(a_targetID);
|
||||
if (itC == l_Cache->end())
|
||||
{
|
||||
l_CacheData = new GeoPairingImplAirTargetCacheData();
|
||||
(*l_Cache)[a_targetID] = l_CacheData;
|
||||
INFO_LOG(m_logger) << "Create new CacheObject for Target "
|
||||
<< a_targetID << " in Cache of Player "
|
||||
<< m_PlayerID;
|
||||
}
|
||||
else
|
||||
l_CacheData = (*l_Cache)[a_targetID];
|
||||
|
||||
l_CacheData->m_TrackTime = a_trackingTime;
|
||||
l_CacheData->m_TrackState = a_trackingState;
|
||||
|
||||
INFO_LOG(m_logger) << "Stored Tracking Time and State for Target "
|
||||
<< a_targetID << " in Cache of Player "
|
||||
<< m_PlayerID;
|
||||
INFO_LOG(m_logger) << "-> Cached Time : " << a_trackingTime
|
||||
<< " State : " << a_trackingState;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
// get cache timeout
|
||||
// ---------------------------------------------------------------
|
||||
UInt32 GeoPairingImplAirTargetCache::getCacheTimeout() const
|
||||
{
|
||||
return m_Timeout;
|
||||
}
|
||||
|
||||
} // namespace N_GeoPairingImpl;
|
||||
+99
@@ -0,0 +1,99 @@
|
||||
// **************************************************************************
|
||||
//
|
||||
// (C) Copyright 2009 Swiss SIMTEC AG
|
||||
//
|
||||
// **************************************************************************
|
||||
//
|
||||
// $HeadURL$
|
||||
// $LastChangedBy$
|
||||
// $LastChangedDate$
|
||||
// $LastChangedRevision$
|
||||
//
|
||||
// **************************************************************************
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <GBL_Global/Types.hpp>
|
||||
#include "../logger.h"
|
||||
#include <map>
|
||||
|
||||
// forward declarations from stereotyped includes
|
||||
namespace N_GeoPairingImpl
|
||||
{
|
||||
struct GeoPairingImplAirTargetCacheData;
|
||||
}
|
||||
|
||||
// manual class imports
|
||||
|
||||
namespace N_GeoPairingImpl
|
||||
{
|
||||
using CacheDataType = std::map<SInt32, GeoPairingImplAirTargetCacheData *>;
|
||||
using CacheType = std::map<SInt32, CacheDataType *>;
|
||||
|
||||
/**
|
||||
* Cache accessor class
|
||||
*
|
||||
* @author Daniel.Schmid
|
||||
* @version 1.0
|
||||
* @created 30-Aug-2012 14:29:16
|
||||
*/
|
||||
class GeoPairingImplAirTargetCache
|
||||
{
|
||||
public:
|
||||
|
||||
virtual ~GeoPairingImplAirTargetCache() = default;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param a_player
|
||||
* @param a_cacheData
|
||||
*/
|
||||
GeoPairingImplAirTargetCache(SInt32 a_player, CacheType *a_cacheData);
|
||||
|
||||
/**
|
||||
* retrieves the last cached tracking state
|
||||
*
|
||||
* @param a_targetID
|
||||
*/
|
||||
bool getLatestTrackState(SInt32 a_targetID) const;
|
||||
|
||||
/**
|
||||
* retrieves the last cached tracking time
|
||||
*
|
||||
* @param a_targetID
|
||||
*/
|
||||
UInt32 getLatestTrackTime(SInt32 a_targetID) const;
|
||||
|
||||
/**
|
||||
* store latest state
|
||||
*
|
||||
* @param a_targetID
|
||||
* @param a_trackingTime
|
||||
* @param a_trackingState
|
||||
*/
|
||||
bool storeLatestTrackState(SInt32 a_targetID, UInt32 a_trackingTime, bool a_trackingState);
|
||||
|
||||
/**
|
||||
* get cache timeout
|
||||
*/
|
||||
UInt32 getCacheTimeout() const;
|
||||
|
||||
|
||||
private:
|
||||
|
||||
CacheType *m_CacheData;
|
||||
SInt32 m_PlayerID;
|
||||
UInt32 m_Timeout;
|
||||
NGL::INGLLogger &m_logger;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @param a_targetID
|
||||
*/
|
||||
GeoPairingImplAirTargetCacheData *getLatestCacheData(SInt32 a_targetID) const;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
#pragma once
|
||||
// **************************************************************************
|
||||
//
|
||||
// (C) Copyright 2009 Swiss SIMTEC AG
|
||||
//
|
||||
// **************************************************************************
|
||||
//
|
||||
// $HeadURL$
|
||||
// $LastChangedBy$
|
||||
// $LastChangedDate$
|
||||
// $LastChangedRevision$
|
||||
//
|
||||
// **************************************************************************
|
||||
|
||||
#include <GBL_Global/Types.hpp>
|
||||
|
||||
namespace N_GeoPairingImpl
|
||||
{
|
||||
|
||||
/**
|
||||
* air target caching data
|
||||
*
|
||||
* @author Daniel.Schmid
|
||||
* @version 1.0
|
||||
* @created 30-Aug-2012 14:22:34
|
||||
*/
|
||||
struct GeoPairingImplAirTargetCacheData
|
||||
{
|
||||
UInt32 m_TrackTime = -1;
|
||||
bool m_TrackState = false;
|
||||
};
|
||||
|
||||
}
|
||||
+343
@@ -0,0 +1,343 @@
|
||||
|
||||
// **************************************************************************
|
||||
//
|
||||
// (C) Copyright 2009 Swiss SIMTEC AG
|
||||
//
|
||||
// **************************************************************************
|
||||
//
|
||||
// $HeadURL$
|
||||
// $LastChangedBy$
|
||||
// $LastChangedDate$
|
||||
// $LastChangedRevision$
|
||||
//
|
||||
// **************************************************************************
|
||||
|
||||
// manual class headers
|
||||
#include "GeoPairingImplAirTargetTracker.hpp"
|
||||
|
||||
// from cpp_includes
|
||||
#include "../logger.h"
|
||||
#include <GBL_ConfigSystem/geoconfig.h>
|
||||
#include <GBL_Types/GeoCoord.hpp>
|
||||
|
||||
namespace N_GeoPairingImpl
|
||||
{
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
// Constructor
|
||||
// ---------------------------------------------------------------
|
||||
GeoPairingImplAirTargetTracker::GeoPairingImplAirTargetTracker(std::vector<GeoPairingImplAirTarget *> *a_listTargets)
|
||||
: m_List(a_listTargets)
|
||||
, m_logger(CesGeoPairing::getLogger("Plugin.GeoPairing.GeoPairingImplAirTargetTracker"))
|
||||
{
|
||||
INFO_LOG(m_logger) << "Construct Tracker for " << a_listTargets->size()
|
||||
<< " air targets";
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
// sets the current position of the tracker
|
||||
// ---------------------------------------------------------------
|
||||
void GeoPairingImplAirTargetTracker::setPosition(Float64 a_positionLat,
|
||||
Float64 a_positionLon, Float64 a_positionAlt)
|
||||
{
|
||||
N_Math::GeoCoord l_PositionUtm;
|
||||
l_PositionUtm.setLlPositionDegree(a_positionLat, a_positionLon, a_positionAlt);
|
||||
|
||||
N_Types::Coord3 l_Position(l_PositionUtm.utmEasting(), l_PositionUtm.utmNorthing(),
|
||||
l_PositionUtm.height());
|
||||
INFO_LOG(m_logger) << "Tracker position : " << l_Position;
|
||||
m_Position = l_Position;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
// track a air target
|
||||
// ---------------------------------------------------------------
|
||||
bool GeoPairingImplAirTargetTracker::track(Float64 a_azimuth,
|
||||
Float64 a_elevation, int &a_playerId, UInt64 &a_impactTime)
|
||||
{
|
||||
if (m_List->size() == 0)
|
||||
{
|
||||
INFO_LOG(m_logger) << "No air targets to track";
|
||||
return false;
|
||||
}
|
||||
|
||||
// prepare window values
|
||||
// QString FileName = CentralEffectSimulationGeoPairing::Settings::cesGeopairingIniPath() + QLatin1Char('/') + CentralEffectSimulationGeoPairing::Settings::cesGeopairingIniFile();
|
||||
N_ConfigSystem::GeoConfig *l_config = N_ConfigSystem::GeoConfig::getInstance();
|
||||
|
||||
N_Types::Radian64 l_AzimuthWindow;
|
||||
l_AzimuthWindow.setDegree(l_config->getFloat(QStringLiteral("IGLA"), QStringLiteral("AzimuthWindow"), 1.5));
|
||||
N_Types::Radian64 l_ElevationWindow;
|
||||
l_ElevationWindow.setDegree(l_config->getFloat(QStringLiteral("IGLA"), QStringLiteral("ElevationWindow"), 1.5));
|
||||
|
||||
Float64 l_FlightSpeed = l_config->getFloat(QStringLiteral("IGLA"), QStringLiteral("FlightSpeed"), 600.0);
|
||||
Float64 l_TimeRange = l_config->getFloat(QStringLiteral("IGLA"), QStringLiteral("TimeRange"), 17);
|
||||
|
||||
N_Types::Angle3 l_sensorAngle;
|
||||
l_sensorAngle.m_H.setDegree(-a_azimuth);
|
||||
l_sensorAngle.m_P.setDegree(a_elevation);
|
||||
|
||||
INFO_LOG(m_logger) << "Tracking angle : " << l_sensorAngle;
|
||||
|
||||
N_Types::Radian64 l_ClosestAzimuth;
|
||||
N_Types::Radian64 l_ClosestElevation;
|
||||
SInt32 l_ClosestPlayerId = 0;
|
||||
UInt64 l_ClosestPlayerImpactTime = 0;
|
||||
Float64 l_ClosestPlayerDistance = 0;
|
||||
|
||||
INFO_LOG(m_logger) << "Iterating through air targets, Count : "
|
||||
<< m_List->size();
|
||||
for (const auto l_Target : *m_List)
|
||||
{
|
||||
N_Types::Coord3 l_targetPos = l_Target->m_Position;
|
||||
// N_Types::Vec3 l_TargetDir = l_Target->m_Direction;
|
||||
// Float64 l_TargetSpeed = l_Target->m_Speed;
|
||||
UInt64 l_TargetPosTime = l_Target->m_PositionTime;
|
||||
|
||||
INFO_LOG(m_logger) << "Position of air target "
|
||||
<< l_Target->m_PlayerID << " @ "
|
||||
<< l_TargetPosTime << " s : "
|
||||
<< l_targetPos;
|
||||
|
||||
SInt32 l_TimeDiff = m_Time - l_TargetPosTime;
|
||||
|
||||
/* if (l_TimeDiff != 0)
|
||||
{
|
||||
N_Types::Vec3 l_PosDiff = l_TargetDir * (l_TargetSpeed * l_TimeDiff);
|
||||
INFO_LOG(m_logger) << "l_PosDiff = " << l_PosDiff;
|
||||
|
||||
l_targetPos.m_X += l_PosDiff.m_X;
|
||||
l_targetPos.m_Y += l_PosDiff.m_Y;
|
||||
l_targetPos.m_Z += l_PosDiff.m_Z;
|
||||
}
|
||||
*/
|
||||
// instead of position interpolation we checkout the time difference
|
||||
if (abs(l_TimeDiff) > 2)
|
||||
{
|
||||
WARNING_LOG(m_logger) << "l_TimeDiff differs by more that 2 s ! m_Time = "
|
||||
<< m_Time << " l_TargetPosTime = " << l_TargetPosTime
|
||||
;
|
||||
}
|
||||
|
||||
N_Types::Coord3 l_LineVector = l_targetPos - m_Position;
|
||||
N_Types::Polar3 l_LinePolar = l_LineVector.getPolar3();
|
||||
N_Types::Angle3 l_LineAngle(l_LinePolar.m_Azimuth, l_LinePolar.m_Elevation, 0);
|
||||
|
||||
INFO_LOG(m_logger) << "Line of sight angle to air target : " << l_LineAngle;
|
||||
|
||||
N_Types::Radian64 l_AzimuthDiff = fabs(l_sensorAngle.m_H - l_LineAngle.m_H);
|
||||
DEBUG_LOG(m_logger) << "l_AzimuthDiff=" << l_AzimuthDiff
|
||||
<< " l_sensorAngle.m_H=" << l_sensorAngle.m_H
|
||||
<< " l_LineAngle.m_H=" << l_LineAngle.m_H;
|
||||
N_Types::Radian64 l_ElevationDiff = fabs(l_sensorAngle.m_P - l_LineAngle.m_P);
|
||||
|
||||
INFO_LOG(m_logger) << "l_AzimuthDiff : "
|
||||
<< l_AzimuthDiff.getDegree() << " [Grad] "
|
||||
<< l_AzimuthDiff << " [rad] ";
|
||||
INFO_LOG(m_logger) << "l_AzimuthWindow : "
|
||||
<< l_AzimuthWindow.getDegree() << " [Grad] "
|
||||
<< l_AzimuthWindow << " [rad] ";
|
||||
INFO_LOG(m_logger) << "l_ElevationDiff : "
|
||||
<< l_ElevationDiff.getDegree() << " [Grad] "
|
||||
<< l_ElevationDiff << " [rad] ";
|
||||
INFO_LOG(m_logger) << "l_ElevationWindow : "
|
||||
<< l_ElevationWindow.getDegree() << " [Grad] "
|
||||
<< l_ElevationWindow << " [rad] ";
|
||||
|
||||
if (fabs(l_AzimuthDiff) > l_AzimuthWindow || fabs(l_ElevationDiff) > l_ElevationWindow)
|
||||
{
|
||||
INFO_LOG(m_logger) << "-> air target " << l_Target->m_PlayerID
|
||||
<< " is NOT in window"
|
||||
<< " fabs(l_AzimuthDiff)=" << fabs(l_AzimuthDiff)
|
||||
<< " l_AzimuthWindow=" << l_AzimuthWindow
|
||||
<< " fabs(l_ElevationDiff)=" << fabs(l_ElevationDiff)
|
||||
<< " l_ElevationWindow=" << l_ElevationWindow;
|
||||
continue;
|
||||
}
|
||||
|
||||
Float64 l_TargetDistance = l_LineVector.magnitude();
|
||||
Float64 l_TimeOfFlight = l_TargetDistance / l_FlightSpeed;
|
||||
|
||||
if (l_TimeOfFlight > l_TimeRange)
|
||||
{
|
||||
INFO_LOG(m_logger) << "-> Target flight time " << l_TimeOfFlight
|
||||
<< " exceeding max time of " << l_TimeRange
|
||||
;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (l_ClosestPlayerId == 0) // as long as no reference
|
||||
{
|
||||
INFO_LOG(m_logger) << "=> air target " << l_Target->m_PlayerID
|
||||
<< " is in window";
|
||||
l_ClosestAzimuth = l_AzimuthDiff;
|
||||
l_ClosestElevation = l_ElevationDiff;
|
||||
l_ClosestPlayerId = l_Target->m_PlayerID;
|
||||
l_ClosestPlayerImpactTime = m_Time + l_TimeOfFlight;
|
||||
l_ClosestPlayerDistance = l_TargetDistance;
|
||||
}
|
||||
else // compare to saved values
|
||||
{
|
||||
if (fabs(l_AzimuthDiff) < l_ClosestAzimuth && fabs(l_ElevationDiff) < l_ClosestElevation)
|
||||
{
|
||||
if (l_TargetDistance < l_ClosestPlayerDistance)
|
||||
{
|
||||
INFO_LOG(m_logger) << "=> air target " << l_Target->m_PlayerID
|
||||
<< " is in window";
|
||||
l_ClosestAzimuth = l_AzimuthDiff;
|
||||
l_ClosestElevation = l_ElevationDiff;
|
||||
l_ClosestPlayerId = l_Target->m_PlayerID;
|
||||
l_ClosestPlayerImpactTime = m_Time + l_TimeOfFlight;
|
||||
l_ClosestPlayerDistance = l_TargetDistance;
|
||||
}
|
||||
else
|
||||
{
|
||||
INFO_LOG(m_logger) << "=> air target " << l_Target->m_PlayerID
|
||||
<< " is in window, but ID " << l_ClosestPlayerId
|
||||
<< " is closer";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (l_ClosestPlayerId == 0)
|
||||
{
|
||||
INFO_LOG(m_logger) << "No air target was within window...";
|
||||
return false;
|
||||
}
|
||||
|
||||
a_playerId = l_ClosestPlayerId;
|
||||
a_impactTime = l_ClosestPlayerImpactTime;
|
||||
|
||||
INFO_LOG(m_logger) << "a_impactTime = " << a_impactTime;
|
||||
INFO_LOG(m_logger) << "l_TimeOfFlight = " << a_impactTime - m_Time;
|
||||
INFO_LOG(m_logger) << "Closest air target in window: " << a_playerId;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
// calculates the probability of a target beeing hit according
|
||||
// to given conditions
|
||||
// ---------------------------------------------------------------
|
||||
bool GeoPairingImplAirTargetTracker::hitCheck(SInt32 a_targetId,
|
||||
bool a_modeAuto, bool a_changeOverPoint)
|
||||
{
|
||||
if (m_List->size() == 0)
|
||||
{
|
||||
ERROR_LOG(m_logger) << "No air targets to track, strange at this point!";
|
||||
return false;
|
||||
}
|
||||
|
||||
INFO_LOG(m_logger) << "Searching for air target, Count : " << m_List->size();
|
||||
GeoPairingImplAirTarget *l_HitTarget = nullptr;
|
||||
|
||||
for (const auto l_Target : *m_List)
|
||||
{
|
||||
if (l_Target->m_PlayerID == a_targetId)
|
||||
{
|
||||
l_HitTarget = l_Target;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (l_HitTarget == nullptr)
|
||||
{
|
||||
ERROR_LOG(m_logger) << "No air targets found with ID " << a_targetId;
|
||||
return false;
|
||||
}
|
||||
|
||||
N_Types::Coord3 l_targetPos = l_HitTarget->m_Position;
|
||||
N_Types::Vec3 l_TargetDir = l_HitTarget->m_Direction;
|
||||
N_Types::Vec3 l_Line = l_targetPos - m_Position;
|
||||
|
||||
Float64 l_OriginalDistance = l_Line.magnitude();
|
||||
INFO_LOG(m_logger) << "l_OriginalDistance = " << l_OriginalDistance;
|
||||
|
||||
l_Line = (l_TargetDir + l_targetPos) - m_Position;
|
||||
Float64 l_DirectionDistance = l_Line.magnitude();
|
||||
INFO_LOG(m_logger) << "l_DirectionDistance = " << l_DirectionDistance;
|
||||
|
||||
|
||||
const bool l_FliesTowardsMe = l_DirectionDistance < l_OriginalDistance;
|
||||
|
||||
N_ConfigSystem::GeoConfig *l_config = N_ConfigSystem::GeoConfig::getInstance();
|
||||
|
||||
Float64 l_ModeAutoProbability = l_config->getFloat(QStringLiteral("IGLA"), QStringLiteral("ModeAutoProbability"), 1.0);
|
||||
Float64 l_ModeManuProbability = l_config->getFloat(QStringLiteral("IGLA"), QStringLiteral("ModeManuProbability"), 1.0);
|
||||
Float64 l_WrongCOPFactor = l_config->getFloat(QStringLiteral("IGLA"), QStringLiteral("WrongCOPFactor"), 0.5);
|
||||
Float64 l_IRJammerFactor = l_config->getFloat(QStringLiteral("IGLA"), QStringLiteral("IRJammerFactor"), 0.5);
|
||||
|
||||
Float64 l_DistanceRange = l_config->getFloat(QStringLiteral("IGLA"), QStringLiteral("DistRange"), 5200.0);
|
||||
Float64 l_FlightHeightMax = l_config->getFloat(QStringLiteral("IGLA"), QStringLiteral("FlightHeightMax"), 3500.0);
|
||||
|
||||
if (l_OriginalDistance > l_DistanceRange)
|
||||
{
|
||||
INFO_LOG(m_logger) << "--> Target " << a_targetId << " distance "
|
||||
<< l_OriginalDistance << " beyond max distance of "
|
||||
<< l_DistanceRange;
|
||||
return false;
|
||||
}
|
||||
if (l_targetPos.m_Z > l_FlightHeightMax)
|
||||
{
|
||||
INFO_LOG(m_logger) << "--> Target " << a_targetId << " flying on height = "
|
||||
<< l_targetPos.m_Z << ", max Height for IGLA is "
|
||||
<< l_FlightHeightMax;
|
||||
return false;
|
||||
}
|
||||
|
||||
Float64 l_Probability = l_ModeAutoProbability;
|
||||
if (!a_modeAuto)
|
||||
l_Probability = l_ModeManuProbability;
|
||||
INFO_LOG(m_logger) << "Basic Probability = " << l_Probability
|
||||
<< (a_modeAuto ? " (auto)" : " (manual)");
|
||||
|
||||
/* if (l_FliesTowardsMe == a_changeOverPoint)
|
||||
{
|
||||
INFO_LOG(m_logger) << "Wrong COP Factor applied";
|
||||
l_Probability *= l_WrongCOPFactor;
|
||||
}
|
||||
*/
|
||||
|
||||
if (a_changeOverPoint)
|
||||
INFO_LOG(m_logger) << "Depart Button pressed";
|
||||
else
|
||||
INFO_LOG(m_logger) << "Depart Button released";
|
||||
|
||||
INFO_LOG(m_logger) << "l_FliesTowardsMe = " << l_FliesTowardsMe;
|
||||
// Wenn der Depart Button nicht gedrueckt ist, und das Ziel vom Schuetzen wegfliegt.
|
||||
if (!l_FliesTowardsMe && !a_changeOverPoint)
|
||||
{
|
||||
INFO_LOG(m_logger) << "Wrong COP Factor applied";
|
||||
l_Probability *= l_WrongCOPFactor;
|
||||
}
|
||||
|
||||
if (l_HitTarget->m_IRJammer)
|
||||
{
|
||||
INFO_LOG(m_logger) << "IR Jammer Factor applied";
|
||||
l_Probability *= l_IRJammerFactor;
|
||||
}
|
||||
|
||||
Float64 l_Random = (rand() % 100) / 100.0;
|
||||
if (l_Random > l_Probability)
|
||||
{
|
||||
INFO_LOG(m_logger) << "--> Target " << a_targetId << " not hit, Probability = "
|
||||
<< l_Probability << ", Randomizer = " << l_Random;
|
||||
return false;
|
||||
}
|
||||
|
||||
INFO_LOG(m_logger) << "==> Target " << a_targetId << " hit, Probability = "
|
||||
<< l_Probability << ", Randomizer = " << l_Random;
|
||||
return true;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
// sets the time of the tracking moment
|
||||
// ---------------------------------------------------------------
|
||||
void GeoPairingImplAirTargetTracker::setTime(UInt64 a_time)
|
||||
{
|
||||
m_Time = a_time;
|
||||
INFO_LOG(m_logger) << "Set new tracker reference time : " << m_Time;
|
||||
}
|
||||
|
||||
} // namespace N_GeoPairingImpl
|
||||
+93
@@ -0,0 +1,93 @@
|
||||
#pragma once
|
||||
|
||||
// **************************************************************************
|
||||
//
|
||||
// (C) Copyright 2009 Swiss SIMTEC AG
|
||||
//
|
||||
// **************************************************************************
|
||||
//
|
||||
// $HeadURL$
|
||||
// $LastChangedBy$
|
||||
// $LastChangedDate$
|
||||
// $LastChangedRevision$
|
||||
//
|
||||
// **************************************************************************
|
||||
|
||||
#include <GBL_Global/Types.hpp>
|
||||
#include <GBL_Types/Coord3.hpp>
|
||||
#include "GeoPairingImplAirTarget.hpp"
|
||||
#include <vector>
|
||||
|
||||
|
||||
namespace N_GeoPairingImpl
|
||||
{
|
||||
|
||||
/**
|
||||
* This class can be used to verify if a AirTarget is within a certain line of
|
||||
* sight.
|
||||
*
|
||||
* @author Daniel.Schmid
|
||||
* @version 1.0
|
||||
* @created 22-Dez-2011 09:36:21
|
||||
*/
|
||||
class GeoPairingImplAirTargetTracker
|
||||
{
|
||||
public:
|
||||
|
||||
virtual ~GeoPairingImplAirTargetTracker() = default;
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param a_listTargets
|
||||
*/
|
||||
explicit GeoPairingImplAirTargetTracker(std::vector<GeoPairingImplAirTarget *> *a_listTargets);
|
||||
|
||||
/**
|
||||
* sets the current position of the tracker
|
||||
*
|
||||
* @param a_positionLat latidude in degrees
|
||||
* @param a_positionLon longitude in degrees
|
||||
* @param a_positionAlt altitude in meters
|
||||
*/
|
||||
void setPosition(Float64 a_positionLat, Float64 a_positionLon, Float64 a_positionAlt);
|
||||
|
||||
/**
|
||||
* track a air target
|
||||
*
|
||||
* @param a_azimuth azimuth in degrees
|
||||
* @param a_elevation elevation in degrees
|
||||
* @param a_playerId
|
||||
* @param a_impactTime
|
||||
*/
|
||||
bool track(Float64 a_azimuth, Float64 a_elevation, int &a_playerId, UInt64 &a_impactTime);
|
||||
|
||||
/**
|
||||
* calculates the probability of a target beeing hit according to given conditions
|
||||
*
|
||||
* @param a_targetId
|
||||
* @param a_modeAuto
|
||||
* @param a_changeOverPoint
|
||||
*/
|
||||
bool hitCheck(SInt32 a_targetId, bool a_modeAuto, bool a_changeOverPoint);
|
||||
|
||||
/**
|
||||
* sets the time of the tracking moment
|
||||
*
|
||||
* @param a_time
|
||||
*/
|
||||
void setTime(UInt64 a_time);
|
||||
|
||||
protected:
|
||||
|
||||
std::vector<GeoPairingImplAirTarget *> *m_List;
|
||||
N_Types::Coord3 m_Position;
|
||||
UInt64 m_Time = 0;
|
||||
|
||||
private:
|
||||
NGL::INGLLogger &m_logger;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
+73
@@ -0,0 +1,73 @@
|
||||
|
||||
// **************************************************************************
|
||||
//
|
||||
// (C) Copyright 2009 Swiss SIMTEC AG
|
||||
//
|
||||
// **************************************************************************
|
||||
//
|
||||
// $HeadURL$
|
||||
// $LastChangedBy$
|
||||
// $LastChangedDate$
|
||||
// $LastChangedRevision$
|
||||
//
|
||||
// **************************************************************************
|
||||
|
||||
// manual class headers
|
||||
#include "GeoPairingImplAirTargetUpdater.hpp"
|
||||
#include "../logger.h"
|
||||
|
||||
namespace N_GeoPairingImpl
|
||||
{
|
||||
|
||||
GeoPairingImplAirTargetUpdater::~GeoPairingImplAirTargetUpdater()
|
||||
{
|
||||
INFO_LOG(m_logger) << "Number of updated air targets : " << m_UpdateCount;
|
||||
}
|
||||
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
// Constructor
|
||||
// ---------------------------------------------------------------
|
||||
GeoPairingImplAirTargetUpdater::GeoPairingImplAirTargetUpdater(std::vector<GeoPairingImplAirTarget *> *a_listTargets)
|
||||
: m_List(a_listTargets)
|
||||
, m_logger(CesGeoPairing::getLogger("Plugin.GeoPairing.GeoPairingImplAirTargetUpdater"))
|
||||
{
|
||||
INFO_LOG(m_logger) << "Construct Updater for " << a_listTargets->size()
|
||||
<< " air targets";
|
||||
}
|
||||
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
// update position of a particular air target
|
||||
// ---------------------------------------------------------------
|
||||
void GeoPairingImplAirTargetUpdater::update(SInt32 a_playerID, Float64 a_positionLat, Float64 a_positionLon, Float64 a_positionAlt, UInt32 a_positionTime, SInt32 a_state)
|
||||
{
|
||||
GeoPairingImplAirTarget *l_PlayerAirTarget = nullptr;
|
||||
|
||||
// iterate throught list to find if a air target with this player ID exists already
|
||||
for (const auto l_AirTarget : *m_List)
|
||||
{
|
||||
if (l_AirTarget->m_PlayerID == a_playerID)
|
||||
{
|
||||
l_PlayerAirTarget = l_AirTarget;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// create new air target
|
||||
if (l_PlayerAirTarget == nullptr)
|
||||
{
|
||||
INFO_LOG(m_logger) << "Creating a new air target object for Player "
|
||||
<< a_playerID;
|
||||
l_PlayerAirTarget = new GeoPairingImplAirTarget(a_playerID);
|
||||
m_List->push_back(l_PlayerAirTarget);
|
||||
}
|
||||
|
||||
// update the air target
|
||||
if (l_PlayerAirTarget->updatePosition(a_positionLat, a_positionLon, a_positionAlt, a_positionTime))
|
||||
m_UpdateCount++;
|
||||
l_PlayerAirTarget->updateState(a_state);
|
||||
}
|
||||
|
||||
|
||||
} // namespace N_GeoPairingImpl
|
||||
+69
@@ -0,0 +1,69 @@
|
||||
|
||||
// **************************************************************************
|
||||
//
|
||||
// (C) Copyright 2009 Swiss SIMTEC AG
|
||||
//
|
||||
// **************************************************************************
|
||||
//
|
||||
// $HeadURL$
|
||||
// $LastChangedBy$
|
||||
// $LastChangedDate$
|
||||
// $LastChangedRevision$
|
||||
//
|
||||
// **************************************************************************
|
||||
|
||||
#pragma once
|
||||
|
||||
// from stereotyped includes
|
||||
#include "GeoPairingImplAirTarget.hpp"
|
||||
#include <vector>
|
||||
|
||||
namespace N_GeoPairingImpl
|
||||
{
|
||||
|
||||
/**
|
||||
* This class can be used to update the position of AirTargets
|
||||
*
|
||||
* @author Daniel.Schmid
|
||||
* @version 1.0
|
||||
* @created 22-Dez-2011 10:49:53
|
||||
*/
|
||||
class GeoPairingImplAirTargetUpdater
|
||||
{
|
||||
public:
|
||||
|
||||
virtual ~GeoPairingImplAirTargetUpdater();
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param a_listTargets
|
||||
*/
|
||||
explicit GeoPairingImplAirTargetUpdater(std::vector<GeoPairingImplAirTarget *> *a_listTargets);
|
||||
|
||||
/**
|
||||
* update position of a particular air target
|
||||
*
|
||||
* @param a_playerID
|
||||
* @param a_positionLat
|
||||
* @param a_positionLon
|
||||
* @param a_positionAlt
|
||||
* @param a_positionTime
|
||||
* @param a_state
|
||||
*/
|
||||
void update(SInt32 a_playerID, Float64 a_positionLat, Float64 a_positionLon, Float64 a_positionAlt, UInt32 a_positionTime, SInt32 a_state);
|
||||
|
||||
protected:
|
||||
|
||||
std::vector<GeoPairingImplAirTarget *> *m_List;
|
||||
|
||||
private:
|
||||
|
||||
SInt32 m_UpdateCount = 0;
|
||||
NGL::INGLLogger &m_logger;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
Executable
+48
@@ -0,0 +1,48 @@
|
||||
|
||||
// **************************************************************************
|
||||
//
|
||||
// (C) Copyright 2009 Swiss SIMTEC AG
|
||||
//
|
||||
// **************************************************************************
|
||||
//
|
||||
// $HeadURL$
|
||||
// $LastChangedBy$
|
||||
// $LastChangedDate$
|
||||
// $LastChangedRevision$
|
||||
//
|
||||
// **************************************************************************
|
||||
|
||||
#include "GeoPairingImplBalistic.hpp"
|
||||
#include "GeoPairingImplFiredBulletBalistic.hpp"
|
||||
|
||||
namespace N_GeoPairingImpl
|
||||
{
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
GeoPairingImplBalistic::GeoPairingImplBalistic(const char *loggerName)
|
||||
: GeoPairingImpl(loggerName ? loggerName : "GeoPairingImplBalistic")
|
||||
{}
|
||||
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
// Creates a new fired bulled according to the given SensorData
|
||||
// ---------------------------------------------------------------
|
||||
GeoPairingImplFiredBullet *GeoPairingImplBalistic::createFiredBullet(GeoPairingImplSensorData &a_sensorData)
|
||||
{
|
||||
GeoPairingImplFiredBulletBalistic *p_firedBullet = new GeoPairingImplFiredBulletBalistic(a_sensorData);
|
||||
p_firedBullet->setMeteoData(m_MeteoData);
|
||||
return p_firedBullet;
|
||||
}
|
||||
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
// Initialize the GeoPairing implementation
|
||||
// ---------------------------------------------------------------
|
||||
bool GeoPairingImplBalistic::initialize(const QString &a_config)
|
||||
{
|
||||
Q_UNUSED(a_config)
|
||||
m_Initialized = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace N_GeoPairingImpl
|
||||
Executable
+32
@@ -0,0 +1,32 @@
|
||||
#pragma once
|
||||
// **************************************************************************
|
||||
//
|
||||
// (C) Copyright 2009 Swiss SIMTEC AG
|
||||
//
|
||||
// **************************************************************************
|
||||
//
|
||||
// $HeadURL$
|
||||
// $LastChangedBy$
|
||||
// $LastChangedDate$
|
||||
// $LastChangedRevision$
|
||||
//
|
||||
// **************************************************************************
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "GeoPairingImpl.hpp"
|
||||
|
||||
namespace N_GeoPairingImpl
|
||||
{
|
||||
|
||||
class GeoPairingImplBalistic : public GeoPairingImpl
|
||||
{
|
||||
public:
|
||||
GeoPairingImplBalistic(const char *loggerName = nullptr);
|
||||
|
||||
GeoPairingImplFiredBullet *createFiredBullet(GeoPairingImplSensorData &a_sensorData) override;
|
||||
|
||||
bool initialize(const QString &a_config) override;
|
||||
};
|
||||
|
||||
}
|
||||
Executable
+70
@@ -0,0 +1,70 @@
|
||||
|
||||
// **************************************************************************
|
||||
//
|
||||
// (C) Copyright 2009 Swiss SIMTEC AG
|
||||
//
|
||||
// **************************************************************************
|
||||
//
|
||||
// $HeadURL$
|
||||
// $LastChangedBy$
|
||||
// $LastChangedDate$
|
||||
// $LastChangedRevision$
|
||||
//
|
||||
// **************************************************************************
|
||||
|
||||
// manual class headers
|
||||
#include "GeoPairingImplDted.hpp"
|
||||
#include "GeoPairingImplFiredBulletDted.hpp"
|
||||
|
||||
namespace N_GeoPairingImpl
|
||||
{
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
GeoPairingImplDted::GeoPairingImplDted()
|
||||
: GeoPairingImplBalistic("GeoPairingImplDted")
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
// Creates a new fired bulled according to the given SensorData
|
||||
// ---------------------------------------------------------------
|
||||
GeoPairingImplFiredBullet *GeoPairingImplDted::createFiredBullet(GeoPairingImplSensorData &a_sensorData)
|
||||
{
|
||||
GeoPairingImplFiredBulletDted *p_firedBullet = new GeoPairingImplFiredBulletDted(a_sensorData);
|
||||
p_firedBullet->setMeteoData(m_MeteoData);
|
||||
return p_firedBullet;
|
||||
}
|
||||
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
// Initialize the GeoPairing implementation
|
||||
// ---------------------------------------------------------------
|
||||
bool GeoPairingImplDted::initialize(const QString &filePath)
|
||||
{
|
||||
GeoPairingImplBalistic::initialize(filePath);
|
||||
|
||||
if (!GeoPairingImplFiredBulletDted::initStatic())
|
||||
{
|
||||
ERROR_LOG(m_logger) << "Couldn't initialize DTED Version";
|
||||
return false;
|
||||
}
|
||||
|
||||
std::cout << "initialized" << std::endl;
|
||||
|
||||
m_Initialized = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
// Pupulates a SensorData instance according to the given
|
||||
// transparent datastream
|
||||
// ---------------------------------------------------------------
|
||||
SInt32 GeoPairingImplDted::createSensorData(GeoPairingImplSensorData *a_sensorData, const QByteArray& a_transparendData)
|
||||
{
|
||||
int isDefault;
|
||||
return GeoPairingImpl::createSensorData(a_sensorData, a_transparendData, isDefault);
|
||||
}
|
||||
|
||||
} // namespace N_GeoPairingImpl
|
||||
Executable
+52
@@ -0,0 +1,52 @@
|
||||
#pragma once
|
||||
|
||||
// **************************************************************************
|
||||
//
|
||||
// (C) Copyright 2009 Swiss SIMTEC AG
|
||||
//
|
||||
// **************************************************************************
|
||||
//
|
||||
// $HeadURL$
|
||||
// $LastChangedBy$
|
||||
// $LastChangedDate$
|
||||
// $LastChangedRevision$
|
||||
//
|
||||
// **************************************************************************
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "GeoPairingImplBalistic.hpp"
|
||||
|
||||
namespace N_GeoPairingImpl
|
||||
{
|
||||
|
||||
/**
|
||||
* @author Daniel.Schmid
|
||||
* @version 1.0
|
||||
* @created 29-Sep-2009 15:51:26
|
||||
*/
|
||||
class GeoPairingImplDted : public GeoPairingImplBalistic
|
||||
{
|
||||
public:
|
||||
GeoPairingImplDted();
|
||||
|
||||
/**
|
||||
* Creates a new fired bulled according to the given SensorData
|
||||
*
|
||||
* @param a_sensorData
|
||||
*/
|
||||
GeoPairingImplFiredBullet *createFiredBullet(GeoPairingImplSensorData &a_sensorData) override;
|
||||
|
||||
|
||||
// TODO: check if this shouldn't be an override ...
|
||||
virtual SInt32 createSensorData(GeoPairingImplSensorData *a_sensorData, const QByteArray& a_transparendData);
|
||||
|
||||
/**
|
||||
* Initialize the GeoPairing implementation
|
||||
*
|
||||
* @param a_config
|
||||
*/
|
||||
bool initialize(const QString &filePath) override;
|
||||
};
|
||||
|
||||
}
|
||||
Executable
+47
@@ -0,0 +1,47 @@
|
||||
|
||||
// **************************************************************************
|
||||
//
|
||||
// (C) Copyright 2009 Swiss SIMTEC AG
|
||||
//
|
||||
// **************************************************************************
|
||||
//
|
||||
// $HeadURL$
|
||||
// $LastChangedBy$
|
||||
// $LastChangedDate$
|
||||
// $LastChangedRevision$
|
||||
//
|
||||
// **************************************************************************
|
||||
|
||||
// manual class headers
|
||||
#include "GeoPairingImplDummy.hpp"
|
||||
|
||||
namespace N_GeoPairingImpl
|
||||
{
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
GeoPairingImplDummy::GeoPairingImplDummy()
|
||||
: GeoPairingImpl("GeoPairingImplDummy")
|
||||
{}
|
||||
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
// Creates a new fired bulled according to the given SensorData
|
||||
// ---------------------------------------------------------------
|
||||
GeoPairingImplFiredBullet *GeoPairingImplDummy::createFiredBullet(GeoPairingImplSensorData &a_sensorData)
|
||||
{
|
||||
return new GeoPairingImplFiredBullet(a_sensorData);
|
||||
}
|
||||
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
// Initialize the GeoPairing implementation
|
||||
// ---------------------------------------------------------------
|
||||
bool GeoPairingImplDummy::initialize(const QString &a_config)
|
||||
{
|
||||
Q_UNUSED(a_config)
|
||||
INFO_LOG(m_logger) << "Dummy initialization...";
|
||||
m_Initialized = true;
|
||||
return m_Initialized;
|
||||
}
|
||||
|
||||
} // namespace N_GeoPairingImpl
|
||||
Executable
+32
@@ -0,0 +1,32 @@
|
||||
#pragma once
|
||||
|
||||
// **************************************************************************
|
||||
//
|
||||
// (C) Copyright 2009 Swiss SIMTEC AG
|
||||
//
|
||||
// **************************************************************************
|
||||
//
|
||||
// $HeadURL$
|
||||
// $LastChangedBy$
|
||||
// $LastChangedDate$
|
||||
// $LastChangedRevision$
|
||||
//
|
||||
// **************************************************************************
|
||||
|
||||
#include "GeoPairingImpl.hpp"
|
||||
|
||||
|
||||
namespace N_GeoPairingImpl
|
||||
{
|
||||
|
||||
class GeoPairingImplDummy : public GeoPairingImpl
|
||||
{
|
||||
public:
|
||||
GeoPairingImplDummy();
|
||||
|
||||
GeoPairingImplFiredBullet *createFiredBullet(GeoPairingImplSensorData &a_sensorData) override;
|
||||
|
||||
bool initialize(const QString &a_config) override;
|
||||
};
|
||||
|
||||
}
|
||||
Executable
+124
@@ -0,0 +1,124 @@
|
||||
|
||||
// **************************************************************************
|
||||
//
|
||||
// (C) Copyright 2009 Swiss SIMTEC AG
|
||||
//
|
||||
// **************************************************************************
|
||||
//
|
||||
// $HeadURL$
|
||||
// $LastChangedBy$
|
||||
// $LastChangedDate$
|
||||
// $LastChangedRevision$
|
||||
//
|
||||
// **************************************************************************
|
||||
|
||||
// manual class headers
|
||||
#include "GeoPairingImplFactory.hpp"
|
||||
#include "GeoPairingImplDummy.hpp"
|
||||
|
||||
using N_GeoPairingImpl::GeoPairingImplFactory;
|
||||
|
||||
namespace N_GeoPairingImpl
|
||||
{
|
||||
|
||||
// static member initialization
|
||||
GeoPairingImpl *GeoPairingImplFactory::m_Impl = nullptr;
|
||||
|
||||
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
// Creates a new air target tracker
|
||||
// ---------------------------------------------------------------
|
||||
GeoPairingImplAirTargetTracker *GeoPairingImplFactory::createAirTargetTracker()
|
||||
{
|
||||
return getImpl()->createAirTargetTracker();
|
||||
}
|
||||
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
// Creates a new air target updater
|
||||
// ---------------------------------------------------------------
|
||||
GeoPairingImplAirTargetUpdater *GeoPairingImplFactory::createAirTargetUpdater()
|
||||
{
|
||||
return getImpl()->createAirTargetUpdater();
|
||||
}
|
||||
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
// Creates a new air target cache
|
||||
// ---------------------------------------------------------------
|
||||
GeoPairingImplAirTargetCache *GeoPairingImplFactory::createAirTargetCache(SInt32 a_playerID)
|
||||
{
|
||||
return getImpl()->createAirTargetCache(a_playerID);
|
||||
}
|
||||
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
// Creates a new fired bulled according to the given SensorData
|
||||
// ---------------------------------------------------------------
|
||||
GeoPairingImplFiredBullet *GeoPairingImplFactory::createFiredBullet(GeoPairingImplSensorData &a_sensorData)
|
||||
{
|
||||
return getImpl()->createFiredBullet(a_sensorData);
|
||||
}
|
||||
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
// Populates a SensorData instance according to the given
|
||||
// transparent datastream
|
||||
// ---------------------------------------------------------------
|
||||
SInt32 GeoPairingImplFactory::createSensorData(GeoPairingImplSensorData *a_sensorData, const QByteArray& a_transparentData, int &isDefault)
|
||||
{
|
||||
return getImpl()->createSensorData(a_sensorData, a_transparentData, isDefault);
|
||||
}
|
||||
|
||||
SInt32 GeoPairingImplFactory::createSensorData(GeoPairingImplSensorData *a_sensorData, const QByteArray& a_transparentData)
|
||||
{
|
||||
int isDefault;
|
||||
return getImpl()->createSensorData(a_sensorData, a_transparentData, isDefault);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
// retrieves the implementation object pointer
|
||||
// ---------------------------------------------------------------
|
||||
GeoPairingImpl *GeoPairingImplFactory::getImpl()
|
||||
{
|
||||
if (m_Impl == nullptr)
|
||||
m_Impl = new GeoPairingImplDummy;
|
||||
return m_Impl;
|
||||
}
|
||||
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
// Initialize the GeoPairing component
|
||||
// ---------------------------------------------------------------
|
||||
bool GeoPairingImplFactory::initialize(const QString &filePath)
|
||||
{
|
||||
return getImpl()->initialize(filePath);
|
||||
}
|
||||
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
// installs an implementation
|
||||
// ---------------------------------------------------------------
|
||||
void GeoPairingImplFactory::setImpl(GeoPairingImpl *a_impl)
|
||||
{
|
||||
NGL::INGLLogger &l = (CesGeoPairing::getLogger("Plugin.GeoPairing.GeoPairingImplFactory"));
|
||||
if (m_Impl != nullptr)
|
||||
{
|
||||
INFO_LOG(l) << "Destroying existing instance of Implementation first";
|
||||
delete m_Impl;
|
||||
}
|
||||
m_Impl = a_impl;
|
||||
INFO_LOG(l) << "New Implementation installed";
|
||||
}
|
||||
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
// Sets global meteo conditions
|
||||
// ---------------------------------------------------------------
|
||||
void GeoPairingImplFactory::setMeteoData(const GeoPairingImplMeteoData &a_meteoData)
|
||||
{
|
||||
getImpl()->setMeteoData(a_meteoData);
|
||||
}
|
||||
|
||||
} // namespace N_GeoPairingImpl
|
||||
Executable
+105
@@ -0,0 +1,105 @@
|
||||
#pragma once
|
||||
|
||||
// **************************************************************************
|
||||
//
|
||||
// (C) Copyright 2009 Swiss SIMTEC AG
|
||||
//
|
||||
// **************************************************************************
|
||||
//
|
||||
// $HeadURL$
|
||||
// $LastChangedBy$
|
||||
// $LastChangedDate$
|
||||
// $LastChangedRevision$
|
||||
//
|
||||
// **************************************************************************
|
||||
|
||||
|
||||
#include <GBL_Global/Types.hpp>
|
||||
#include "GeoPairingImpl.hpp"
|
||||
|
||||
namespace N_GeoPairingImpl
|
||||
{
|
||||
|
||||
/**
|
||||
* This class serves is the entry point to the GeoPairing Software. It must be
|
||||
* initialized before use.
|
||||
*
|
||||
* @author Daniel.Schmid
|
||||
* @version 1.0
|
||||
* @created 17-Jul-2009 14:27:37
|
||||
*/
|
||||
class GeoPairingImplFactory
|
||||
{
|
||||
public:
|
||||
|
||||
/**
|
||||
* Creates a new air target tracker
|
||||
*/
|
||||
static GeoPairingImplAirTargetTracker *createAirTargetTracker();
|
||||
|
||||
/**
|
||||
* Creates a new air target updater
|
||||
*/
|
||||
static GeoPairingImplAirTargetUpdater *createAirTargetUpdater();
|
||||
|
||||
/**
|
||||
* Creates a new air target cache
|
||||
*
|
||||
* @param a_playerID
|
||||
*/
|
||||
static GeoPairingImplAirTargetCache *createAirTargetCache(SInt32 a_playerID);
|
||||
|
||||
/**
|
||||
* Creates a new fired bulled according to the given SensorData
|
||||
*
|
||||
* @param a_sensorData
|
||||
*/
|
||||
static GeoPairingImplFiredBullet *createFiredBullet(GeoPairingImplSensorData &a_sensorData);
|
||||
|
||||
/**
|
||||
* Populates a SensorData instance according to the given transparent datastream
|
||||
*
|
||||
* @param a_sensorData
|
||||
* @param a_transparentData
|
||||
* @param a_sizeOfTransparentData
|
||||
*/
|
||||
static SInt32 createSensorData(GeoPairingImplSensorData *a_sensorData, const QByteArray& a_transparentData, int &isDefault);
|
||||
static SInt32 createSensorData(GeoPairingImplSensorData *a_sensorData, const QByteArray& a_transparentData);
|
||||
|
||||
/**
|
||||
* Initialize the GeoPairing component
|
||||
*
|
||||
* @param a_config
|
||||
*/
|
||||
static bool initialize(const QString &filePath);
|
||||
|
||||
/**
|
||||
* installs an implementation
|
||||
*
|
||||
* @param a_impl
|
||||
*/
|
||||
static void setImpl(GeoPairingImpl *a_impl);
|
||||
|
||||
/**
|
||||
* Sets global meteo conditions
|
||||
*
|
||||
* @param a_meteoData
|
||||
*/
|
||||
static void setMeteoData(const GeoPairingImplMeteoData &a_meteoData);
|
||||
|
||||
protected:
|
||||
|
||||
private:
|
||||
|
||||
static GeoPairingImpl *m_Impl;
|
||||
|
||||
|
||||
/**
|
||||
* retrieves the implementation object pointer
|
||||
*/
|
||||
static GeoPairingImpl *getImpl();
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
Lts/Services/CentralEffectSimulation/Plugins/GeoPairing/GeoPairingImpl/GeoPairingImplFiredBullet.cpp
Executable
+458
@@ -0,0 +1,458 @@
|
||||
|
||||
// **************************************************************************
|
||||
//
|
||||
// (C) Copyright 2009 Swiss SIMTEC AG
|
||||
//
|
||||
// **************************************************************************
|
||||
//
|
||||
// $HeadURL$
|
||||
// $LastChangedBy$
|
||||
// $LastChangedDate$
|
||||
// $LastChangedRevision$
|
||||
//
|
||||
// **************************************************************************
|
||||
|
||||
// manual class headers
|
||||
#include "GeoPairingImplFiredBullet.hpp"
|
||||
|
||||
// from cpp_includes
|
||||
#include <GBL_Types/Angle3.hpp>
|
||||
#include <GBL_Types/Coord3.hpp>
|
||||
#include <GBL_Types/GeoCoord.hpp>
|
||||
#include <GBL_ConfigSystem/geoconfig.h>
|
||||
#include <limits>
|
||||
#include <LtsCoordTrans/lts_coord_trans.h>
|
||||
#include <QPointF>
|
||||
|
||||
#ifdef WIN32
|
||||
#define RAND48_SEED_0 (0x330e)
|
||||
#define RAND48_SEED_1 (0xabcd)
|
||||
#define RAND48_SEED_2 (0x1234)
|
||||
#define RAND48_MULT_0 (0xe66d)
|
||||
#define RAND48_MULT_1 (0xdeec)
|
||||
#define RAND48_MULT_2 (0x0005)
|
||||
#define RAND48_ADD (0x000b)
|
||||
|
||||
unsigned short _rand48_seed[3] = {
|
||||
RAND48_SEED_0,
|
||||
RAND48_SEED_1,
|
||||
RAND48_SEED_2
|
||||
};
|
||||
unsigned short _rand48_mult[3] = {
|
||||
RAND48_MULT_0,
|
||||
RAND48_MULT_1,
|
||||
RAND48_MULT_2
|
||||
};
|
||||
unsigned short _rand48_add = RAND48_ADD;
|
||||
|
||||
void
|
||||
_dorand48(unsigned short xseed[3])
|
||||
{
|
||||
unsigned long accu;
|
||||
unsigned short temp[2];
|
||||
|
||||
accu = (unsigned long)_rand48_mult[0] * (unsigned long)xseed[0] +
|
||||
(unsigned long)_rand48_add;
|
||||
temp[0] = (unsigned short)accu; /* lower 16 bits */
|
||||
accu >>= sizeof(unsigned short) * 8;
|
||||
accu += (unsigned long)_rand48_mult[0] * (unsigned long)xseed[1] +
|
||||
(unsigned long)_rand48_mult[1] * (unsigned long)xseed[0];
|
||||
temp[1] = (unsigned short)accu; /* middle 16 bits */
|
||||
accu >>= sizeof(unsigned short) * 8;
|
||||
accu += _rand48_mult[0] * xseed[2] + _rand48_mult[1] * xseed[1] + _rand48_mult[2] * xseed[0];
|
||||
xseed[0] = temp[0];
|
||||
xseed[1] = temp[1];
|
||||
xseed[2] = (unsigned short)accu;
|
||||
}
|
||||
|
||||
double erand48(unsigned short xseed[3])
|
||||
{
|
||||
_dorand48(xseed);
|
||||
return ldexp((double)xseed[0], -48) +
|
||||
ldexp((double)xseed[1], -32) +
|
||||
ldexp((double)xseed[2], -16);
|
||||
}
|
||||
|
||||
double drand48() {
|
||||
return erand48(_rand48_seed);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
namespace N_GeoPairingImpl
|
||||
{
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
// Constructur taking the SensorData as input values
|
||||
// ---------------------------------------------------------------
|
||||
GeoPairingImplFiredBullet::GeoPairingImplFiredBullet(const GeoPairingImplSensorData &a_sensorData,
|
||||
const char *loggerName)
|
||||
: m_SensorData(a_sensorData)
|
||||
, m_logger(CesGeoPairing::getLogger(loggerName ? loggerName : "Plugin.GeoPairing.GeoPairingImplFiredBullet"))
|
||||
{
|
||||
INFO_LOG(m_logger) << "---------- Setting Sensor Data ------------";
|
||||
INFO_LOG(m_logger) << "WeaponPositionLat : " << m_SensorData.WeaponPositionLat;
|
||||
INFO_LOG(m_logger) << "WeaponPositionLong : " << m_SensorData.WeaponPositionLong;
|
||||
INFO_LOG(m_logger) << "WeaponPositionHeight : " << m_SensorData.WeaponPositionHeight;
|
||||
INFO_LOG(m_logger) << "WeaponAzimuth : " << m_SensorData.WeaponAzimuth << " (" << m_SensorData.WeaponAzimuth.getDegree() << ")" ;
|
||||
INFO_LOG(m_logger) << "WeaponAzimuthMin : " << m_SensorData.WeaponAzimuthMin << " (" << m_SensorData.WeaponAzimuthMin.getDegree() << ")" ;
|
||||
INFO_LOG(m_logger) << "WeaponAzimuthMax : " << m_SensorData.WeaponAzimuthMax << " (" << m_SensorData.WeaponAzimuthMax.getDegree() << ")" ;
|
||||
INFO_LOG(m_logger) << "WeaponElevation : " << m_SensorData.WeaponElevation << " (" << m_SensorData.WeaponElevation.getDegree() << ")" ;
|
||||
INFO_LOG(m_logger) << "WeaponElevationMin : " << m_SensorData.WeaponElevationMin << " (" << m_SensorData.WeaponElevationMin.getDegree() << ")" ;
|
||||
INFO_LOG(m_logger) << "WeaponElevationMax : " << m_SensorData.WeaponElevationMax << " (" << m_SensorData.WeaponElevationMax.getDegree() << ")" ;
|
||||
INFO_LOG(m_logger) << "WeaponTemperature : " << m_SensorData.WeaponTemperature;
|
||||
INFO_LOG(m_logger) << "AmmunitionType : " << m_SensorData.AmmunitionType;
|
||||
INFO_LOG(m_logger) << "ChargeType : " << m_SensorData.ChargeType;
|
||||
INFO_LOG(m_logger) << "IgnitionType : " << m_SensorData.IgnitionType;
|
||||
INFO_LOG(m_logger) << "FireTime : " << m_SensorData.FireTime;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
// Performs the calculation of the trajectory and also returns
|
||||
// the result of calculation
|
||||
// ---------------------------------------------------------------
|
||||
GeoPairingImplFiredBullet::E_CalcResult GeoPairingImplFiredBullet::calculate(const std::shared_ptr<N_Ballistic::BallisticService> &ballisticService)
|
||||
{
|
||||
Q_UNUSED(ballisticService) // why?
|
||||
|
||||
INFO_LOG(m_logger) << "----------- Calculating Impact -----------";
|
||||
|
||||
N_Math::GeoCoord o_sensorUtm;
|
||||
|
||||
o_sensorUtm.setLlPositionDegree(m_SensorData.WeaponPositionLat,
|
||||
m_SensorData.WeaponPositionLong,
|
||||
m_SensorData.WeaponPositionHeight);
|
||||
|
||||
N_Types::Coord3 o_sensorPos(o_sensorUtm.utmEasting(),
|
||||
o_sensorUtm.utmNorthing(),
|
||||
o_sensorUtm.height());
|
||||
INFO_LOG(m_logger) << "o_sensorPos : " << o_sensorPos;
|
||||
|
||||
GeoPairingImplTrajectoryData::TrajectoryPoint tpSensor;
|
||||
tpSensor.m_X = o_sensorPos.m_X;
|
||||
tpSensor.m_Y = o_sensorPos.m_Y;
|
||||
tpSensor.m_Z = o_sensorPos.m_Z;
|
||||
tpSensor.m_H = 0;
|
||||
m_TrajectoryData.m_Points.push_back(tpSensor);
|
||||
|
||||
N_Types::Angle3 o_sensorAngle(m_SensorData.WeaponAzimuth,
|
||||
m_SensorData.WeaponElevation,
|
||||
0);
|
||||
INFO_LOG(m_logger) << "o_sensorAngle : " << o_sensorAngle;
|
||||
|
||||
// calculate a faked shot
|
||||
Float64 d_shootingDistance = 500.0 + (m_SensorData.AmmunitionType * 200) ;
|
||||
INFO_LOG(m_logger) << "d_shootingDistance : " << d_shootingDistance;
|
||||
|
||||
N_Types::Coord3 o_shot(0, d_shootingDistance, 0);
|
||||
INFO_LOG(m_logger) << "o_shot : " << o_shot;
|
||||
o_shot = o_shot.rotate(o_sensorAngle);
|
||||
o_sensorPos += o_shot;
|
||||
INFO_LOG(m_logger) << "o_shot : " << o_shot;
|
||||
INFO_LOG(m_logger) << "impact : " << o_sensorPos;
|
||||
|
||||
N_Math::GeoCoord o_impactUtm;
|
||||
o_impactUtm.setTotalUtmPosition(o_sensorPos.m_X, o_sensorPos.m_Y, o_sensorPos.m_Z,
|
||||
o_sensorUtm.utmZone(), o_sensorUtm.northP());
|
||||
|
||||
GeoPairingImplTrajectoryData::TrajectoryPoint tpImpact;
|
||||
tpImpact.m_X = o_sensorPos.m_X;
|
||||
tpImpact.m_Y = o_sensorPos.m_Y;
|
||||
tpImpact.m_Z = o_sensorPos.m_Z;
|
||||
tpImpact.m_H = 0;
|
||||
m_TrajectoryData.m_Points.push_back(tpImpact);
|
||||
|
||||
if (m_logger.isInfoEnabled())
|
||||
{
|
||||
for (const auto &tp : m_TrajectoryData.m_Points)
|
||||
INFO_LOG(m_logger) << tp.m_X << " " << tp.m_Y << " " << tp.m_Z << " " << tp.m_H;
|
||||
}
|
||||
|
||||
m_ImpactData.AmmunitionType = m_SensorData.AmmunitionType;
|
||||
m_ImpactData.ImpactTime = m_SensorData.FireTime + 3;
|
||||
m_ImpactData.ImpactPositionLat = o_impactUtm.latDeg();
|
||||
m_ImpactData.ImpactPositionLong = o_impactUtm.lonDeg();
|
||||
m_ImpactData.ImpactPositionHeight = o_impactUtm.height();
|
||||
|
||||
return e_OK;
|
||||
}
|
||||
|
||||
GeoPairingImplFiredBullet::E_CalcResult GeoPairingImplFiredBullet::calculateG5G6(double entfernung,
|
||||
double drift,
|
||||
double flugzeit)
|
||||
{
|
||||
INFO_LOG(m_logger) << "----------- Calculating Impact -----------";
|
||||
|
||||
|
||||
Float64 xOutMgrs = 0.0;
|
||||
Float64 yOutMgrs = 0.0;
|
||||
Float64 xOutLon = 0.0;
|
||||
Float64 yOutLat = 0.0;
|
||||
Float64 zOutAlt = 0.0;
|
||||
|
||||
//LtsCoordTrans::LonLat2MGRS(m_SensorData.WeaponPositionLong / 180 * M_PI,
|
||||
// m_SensorData.WeaponPositionLat / 180 * M_PI,
|
||||
// xOutMgrs,
|
||||
// yOutMgrs);
|
||||
const int zoneToUse = -1;
|
||||
auto utm = LtsCoordTrans::UtmCoordinate::fromGeographic(m_SensorData.WeaponPositionLong / 180 * M_PI,// TODO ueberpruefen!!!
|
||||
m_SensorData.WeaponPositionLat / 180 * M_PI, zoneToUse);
|
||||
xOutMgrs = utm.x;
|
||||
yOutMgrs = utm.y;
|
||||
|
||||
Float64 x_mem = entfernung;
|
||||
Float64 xOut = x_mem * cos(m_SensorData.WeaponAzimuth.getItsValue() + M_PI_2 - drift);
|
||||
Float64 yOut = x_mem * sin(m_SensorData.WeaponAzimuth.getItsValue() + M_PI_2 - drift);
|
||||
|
||||
xOutMgrs += xOut;
|
||||
yOutMgrs += yOut;
|
||||
LtsCoordTrans::UtmCoordinate tm2(utm.zone, xOutMgrs, yOutMgrs );
|
||||
INFO_LOG(m_logger) << "NEW POS " << tm2.geographic().x() << " " << tm2.geographic().y() ;
|
||||
|
||||
//LtsCoordTrans::MGRS2LonLat(xOutMgrs, yOutMgrs, xOutLon, yOutLat);
|
||||
LtsCoordTrans::geocentric2LonLatAlt(xOutMgrs, yOutMgrs, 0.0, xOutLon, yOutLat, zOutAlt);
|
||||
|
||||
m_ImpactData.AmmunitionType = m_SensorData.AmmunitionType;
|
||||
m_ImpactData.ImpactTime = m_SensorData.FireTime + lrint(flugzeit);
|
||||
m_ImpactData.ImpactPositionLat = tm2.geographic().y() * (180 / M_PI);
|
||||
m_ImpactData.ImpactPositionLong = tm2.geographic().x() * (180 / M_PI);
|
||||
m_ImpactData.ImpactPositionHeight = 0;
|
||||
|
||||
INFO_LOG(m_logger) << "m_SensorData.WeaponPositionLong=" << m_SensorData.WeaponPositionLong
|
||||
<< " m_SensorData.WeaponPositionLat=" << m_SensorData.WeaponPositionLat
|
||||
<< "\n entfernung=" << entfernung
|
||||
<< "\n utm.x=" << utm.x
|
||||
<< " utm.y=" << utm.y
|
||||
<< "\n xOut=" << xOut
|
||||
<< " yOut=" << yOut
|
||||
<< "\n xOutMgrs=" << xOutMgrs
|
||||
<< " yOutMgrs=" << yOutMgrs
|
||||
<< "\n xOutLon=" << xOutLon
|
||||
<< " yOutLat=" << yOutLat
|
||||
<< "\n ImpactPositionLat=" << m_ImpactData.ImpactPositionLat
|
||||
<< " ImpactPositionLong=" << m_ImpactData.ImpactPositionLong;
|
||||
|
||||
return e_OK;
|
||||
}
|
||||
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
// Performs the calculation of multiple trajectories and also
|
||||
// returns the result of calculation
|
||||
// ---------------------------------------------------------------
|
||||
GeoPairingImplFiredBullet::E_CalcResult GeoPairingImplFiredBullet::calculateSalve(const std::shared_ptr<N_Ballistic::BallisticService> &ballisticService,
|
||||
int a_nbrRounds, double &a_widthField,
|
||||
double &a_lengthField, double &a_duration,
|
||||
double &a_heading)
|
||||
{
|
||||
INFO_LOG(m_logger) << "----------- Calculating Salve -----------";
|
||||
|
||||
if (a_nbrRounds < 1)
|
||||
return GeoPairingImplFiredBullet::e_OUTOFRANGE;
|
||||
|
||||
N_Math::GeoCoord l_sensorUtm;
|
||||
|
||||
l_sensorUtm.setLlPositionDegree(m_SensorData.WeaponPositionLat,
|
||||
m_SensorData.WeaponPositionLong,
|
||||
m_SensorData.WeaponPositionHeight);
|
||||
|
||||
N_Types::Coord3 l_sensorPos(l_sensorUtm.utmEasting(),
|
||||
l_sensorUtm.utmNorthing(),
|
||||
l_sensorUtm.height());
|
||||
INFO_LOG(m_logger) << "l_sensorPos : " << l_sensorPos;
|
||||
|
||||
Float64 l_TopPos = 0, l_BottomPos = 0, l_LeftPos = 0, l_RightPos = 0, l_BelowPos = 0, l_AbovePos = 0;
|
||||
|
||||
N_Types::Coord3 l_avgImpactPos;
|
||||
int l_avgImpactCount = 0;
|
||||
|
||||
Float64 l_avgImpactTime = 0.0;
|
||||
|
||||
Float64 l_AzimuthReferenceAngle = m_SensorData.WeaponAzimuth;
|
||||
|
||||
for (int i = 0; i < a_nbrRounds; i++)
|
||||
{
|
||||
INFO_LOG(m_logger) << "========== Calculating Round " << i + 1 << " of " << a_nbrRounds << " =============";
|
||||
prepareSensorData();
|
||||
|
||||
if (calculate( ballisticService) != e_OK)
|
||||
continue;
|
||||
|
||||
N_Math::GeoCoord l_impactUtm;
|
||||
l_impactUtm.setLlPositionDegree(m_ImpactData.ImpactPositionLat,
|
||||
m_ImpactData.ImpactPositionLong,
|
||||
m_ImpactData.ImpactPositionHeight);
|
||||
|
||||
N_Types::Coord3 l_impactPos(l_impactUtm.utmEasting(),
|
||||
l_impactUtm.utmNorthing(),
|
||||
l_impactUtm.height());
|
||||
|
||||
INFO_LOG(m_logger) << "l_impactPos : " << l_impactPos;
|
||||
|
||||
l_avgImpactPos += l_impactPos;
|
||||
l_avgImpactCount++;
|
||||
|
||||
l_avgImpactTime += m_ImpactData.ImpactTime;
|
||||
|
||||
N_Types::Coord3 l_RotImpactPos = l_impactPos - l_sensorPos;
|
||||
|
||||
l_RotImpactPos = l_RotImpactPos.rotateZ(-l_AzimuthReferenceAngle); // rotate back to north position
|
||||
if (i == 0)
|
||||
{
|
||||
l_TopPos = l_BottomPos = l_RotImpactPos.m_Y;
|
||||
l_LeftPos = l_RightPos = l_RotImpactPos.m_X;
|
||||
l_BelowPos = l_AbovePos = l_RotImpactPos.m_Z;
|
||||
}
|
||||
else
|
||||
{
|
||||
l_TopPos = std::max(l_RotImpactPos.m_Y, l_TopPos);
|
||||
l_BottomPos = std::min(l_RotImpactPos.m_Y, l_BottomPos);
|
||||
l_RightPos = std::max(l_RotImpactPos.m_X, l_RightPos);
|
||||
l_LeftPos = std::min(l_RotImpactPos.m_X, l_LeftPos);
|
||||
l_AbovePos = std::max(l_RotImpactPos.m_Z, l_AbovePos);
|
||||
l_BelowPos = std::min(l_RotImpactPos.m_Z, l_BelowPos);
|
||||
}
|
||||
}
|
||||
|
||||
INFO_LOG(m_logger) << "========== Summarize Impact Data ==========";
|
||||
|
||||
a_widthField = l_RightPos - l_LeftPos;
|
||||
a_lengthField = l_TopPos - l_BottomPos;
|
||||
|
||||
INFO_LOG(m_logger) << "a_widthField = " << a_widthField;
|
||||
INFO_LOG(m_logger) << "a_lengthField = " << a_lengthField;
|
||||
|
||||
// calculate average impact pos for this salve
|
||||
N_Types::Coord3 l_ImpactPos = l_avgImpactPos / std::max(1, l_avgImpactCount);
|
||||
|
||||
INFO_LOG(m_logger) << "l_ImpactPos (Avg) : " << l_ImpactPos;
|
||||
|
||||
N_Math::GeoCoord l_impactUtm;
|
||||
l_impactUtm.setTotalUtmPosition(l_ImpactPos.m_X, l_ImpactPos.m_Y, l_ImpactPos.m_Z,
|
||||
l_sensorUtm.utmZone(), l_sensorUtm.northP());
|
||||
|
||||
m_ImpactData.ImpactPositionLat = l_impactUtm.latDeg();
|
||||
m_ImpactData.ImpactPositionLong = l_impactUtm.lonDeg();
|
||||
m_ImpactData.ImpactPositionHeight = l_impactUtm.height();
|
||||
|
||||
m_ImpactData.ImpactTime = ceil(l_avgImpactTime / std::max(1, l_avgImpactCount));
|
||||
|
||||
auto l_config = N_ConfigSystem::GeoConfig::getInstance();
|
||||
|
||||
QString s_MK19 = QStringLiteral("MK19");
|
||||
QString s_RoundsPerMinute = QStringLiteral("RoundsPerMinute");
|
||||
Float64 l_RoundsPerMinute = l_config->getFloat(s_MK19, s_RoundsPerMinute, 350);
|
||||
|
||||
a_duration = 60 * a_nbrRounds / l_RoundsPerMinute;
|
||||
INFO_LOG(m_logger) << "a_duration = " << a_duration;
|
||||
|
||||
Float64 l_Distance = l_ImpactPos.length(l_sensorPos);
|
||||
INFO_LOG(m_logger) << "l_Distance = " << l_Distance;
|
||||
|
||||
N_Types::Radian64 l_AvgHeading = m_SensorData.WeaponAzimuthMax - m_SensorData.WeaponAzimuthMin;
|
||||
l_AvgHeading /= 2.0;
|
||||
l_AvgHeading += m_SensorData.WeaponAzimuthMin;
|
||||
l_AvgHeading += M_PI_2; // rotate 90deg from east
|
||||
|
||||
a_heading = l_AvgHeading.getZeroTo360();
|
||||
INFO_LOG(m_logger) << "a_heading [deg ] = " << a_heading;
|
||||
|
||||
|
||||
return e_OK;
|
||||
}
|
||||
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
// retrieves the Impact Data
|
||||
// ---------------------------------------------------------------
|
||||
GeoPairingImplImpactData *GeoPairingImplFiredBullet::getImpactData()
|
||||
{
|
||||
if (m_ImpactData.ImpactTime == 0)
|
||||
{
|
||||
ERROR_LOG(m_logger) << "Impact Data not yet calculated";
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
INFO_LOG(m_logger) << "---------- Getting Impact Data ------------";
|
||||
INFO_LOG(m_logger) << "ImpactPositionLat : " << m_ImpactData.ImpactPositionLat;
|
||||
INFO_LOG(m_logger) << "ImpactPositionLong : " << m_ImpactData.ImpactPositionLong;
|
||||
INFO_LOG(m_logger) << "ImpactPositionHeight : " << m_ImpactData.ImpactPositionHeight;
|
||||
INFO_LOG(m_logger) << "ImpactTime : " << m_ImpactData.ImpactTime;
|
||||
INFO_LOG(m_logger) << "AmmunitionType : " << m_ImpactData.AmmunitionType;
|
||||
|
||||
return &m_ImpactData;
|
||||
}
|
||||
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
// retrieves the Trajectory Data
|
||||
// ---------------------------------------------------------------
|
||||
GeoPairingImplTrajectoryData *GeoPairingImplFiredBullet::getTrajectoryData()
|
||||
{
|
||||
if (m_ImpactData.ImpactTime == 0)
|
||||
{
|
||||
ERROR_LOG(m_logger) << "Impact Data not yet calculated";
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return &m_TrajectoryData;
|
||||
}
|
||||
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
// Sets the meteo data that are considered for this bullet
|
||||
// ---------------------------------------------------------------
|
||||
void GeoPairingImplFiredBullet::setMeteoData(const GeoPairingImplMeteoData &a_meteoData)
|
||||
{
|
||||
m_MeteoData = a_meteoData;
|
||||
|
||||
INFO_LOG(m_logger) << "---------- Setting Meteo Data ------------";
|
||||
INFO_LOG(m_logger) << "AirPressure : " << m_MeteoData.AirPressure;
|
||||
INFO_LOG(m_logger) << "Temperature : " << m_MeteoData.Temperature;
|
||||
INFO_LOG(m_logger) << "WindDirection : " << m_MeteoData.WindDirection;
|
||||
INFO_LOG(m_logger) << "WindSpeed : " << m_MeteoData.WindSpeed;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
// spreads the sensor heading and pitch in the min/max field,
|
||||
// using random values
|
||||
// ---------------------------------------------------------------
|
||||
void GeoPairingImplFiredBullet::prepareSensorData()
|
||||
{
|
||||
if (!m_SensorData.UseMinMax)
|
||||
return;
|
||||
|
||||
INFO_LOG(m_logger) << "----------- Prepare Sensor Angles -----------";
|
||||
|
||||
N_Types::Radian64 l_AzimuthMin = m_SensorData.WeaponAzimuthMin;
|
||||
N_Types::Radian64 l_AzimuthMax = m_SensorData.WeaponAzimuthMax;
|
||||
|
||||
INFO_LOG(m_logger) << "WeaponAzimuthMin [deg] = " << m_SensorData.WeaponAzimuthMin.getDegree();
|
||||
INFO_LOG(m_logger) << "WeaponAzimuthMax [deg] = " << m_SensorData.WeaponAzimuthMax.getDegree();
|
||||
INFO_LOG(m_logger) << "WeaponElevationMin [deg] = " << m_SensorData.WeaponElevationMin.getDegree();
|
||||
INFO_LOG(m_logger) << "WeaponElevationMax [deg] = " << m_SensorData.WeaponElevationMax.getDegree();
|
||||
|
||||
N_Types::Radian64 l_AzimuthDelta = fabs(l_AzimuthMax - l_AzimuthMin);
|
||||
|
||||
// test the +/- 180 deg limit case
|
||||
if (l_AzimuthDelta > M_PI)
|
||||
{
|
||||
INFO_LOG(m_logger) << "Take short circle path";
|
||||
l_AzimuthDelta -= M_PI;
|
||||
}
|
||||
|
||||
N_Types::Radian64 l_DeltaElevation = m_SensorData.WeaponElevationMax - m_SensorData.WeaponElevationMin;
|
||||
N_Types::Radian64 l_DeltaAzimuth = l_AzimuthDelta;
|
||||
|
||||
m_SensorData.WeaponElevation = m_SensorData.WeaponElevationMin + (drand48() * l_DeltaElevation);
|
||||
m_SensorData.WeaponAzimuth = m_SensorData.WeaponAzimuthMin + (drand48() * l_DeltaAzimuth);
|
||||
|
||||
INFO_LOG(m_logger) << "l_DeltaElevation : " << l_DeltaElevation << " (" << l_DeltaElevation.getDegree() << ")";
|
||||
INFO_LOG(m_logger) << "l_DeltaAzimuth : " << l_DeltaAzimuth << " (" << l_DeltaAzimuth.getDegree() << ")";
|
||||
INFO_LOG(m_logger) << "WeaponElevation : " << m_SensorData.WeaponElevation << " (" << m_SensorData.WeaponElevation.getDegree() << ")" ;
|
||||
INFO_LOG(m_logger) << "WeaponAzimuth : " << m_SensorData.WeaponAzimuth << " (" << m_SensorData.WeaponAzimuth.getDegree() << ")";
|
||||
|
||||
}
|
||||
|
||||
|
||||
} // namespace N_GeoPairingImpl
|
||||
Lts/Services/CentralEffectSimulation/Plugins/GeoPairing/GeoPairingImpl/GeoPairingImplFiredBullet.hpp
Executable
+130
@@ -0,0 +1,130 @@
|
||||
#pragma once
|
||||
|
||||
// **************************************************************************
|
||||
//
|
||||
// (C) Copyright 2009 Swiss SIMTEC AG
|
||||
//
|
||||
// **************************************************************************
|
||||
//
|
||||
// $HeadURL$
|
||||
// $LastChangedBy$
|
||||
// $LastChangedDate$
|
||||
// $LastChangedRevision$
|
||||
//
|
||||
// **************************************************************************
|
||||
|
||||
// from stereotyped includes
|
||||
#include "GeoPairingImplSensorData.hpp"
|
||||
#include "GeoPairingImplMeteoData.hpp"
|
||||
#include "GeoPairingImplTrajectoryData.hpp"
|
||||
#include "GeoPairingImplImpactData.hpp"
|
||||
#include <FW_Ballistic/BallisticService.hpp>
|
||||
#include "../logger.h"
|
||||
#include <iostream>
|
||||
#include <memory>
|
||||
|
||||
namespace N_GeoPairingImpl
|
||||
{
|
||||
|
||||
/**
|
||||
* This class represents the virtual bullet that was shot.
|
||||
*
|
||||
* @author Daniel.Schmid
|
||||
* @version 1.0
|
||||
* @created 29-Sep-2009 16:15:05
|
||||
*/
|
||||
class GeoPairingImplFiredBullet
|
||||
{
|
||||
public:
|
||||
|
||||
/**
|
||||
* This is the result of the calculation. The calculation has either not been done
|
||||
* (e_NONE), processed correctly (e_OK), out of the terrain range (e_OUTOFRANGE),
|
||||
* or took too long (e_TIMEOUT)
|
||||
*
|
||||
* @author Daniel.Schmid
|
||||
* @version 1.0
|
||||
* @created 11-Feb-2010 08:51:23
|
||||
*/
|
||||
enum E_CalcResult
|
||||
{
|
||||
e_NONE = 0,
|
||||
e_OK,
|
||||
e_OUTOFRANGE,
|
||||
e_TIMEOUT
|
||||
};
|
||||
GeoPairingImplTrajectoryData m_TrajectoryData;
|
||||
|
||||
|
||||
/**
|
||||
* Constructur taking the SensorData as input values
|
||||
*
|
||||
* @param a_sensorData
|
||||
*/
|
||||
explicit GeoPairingImplFiredBullet(const GeoPairingImplSensorData &a_sensorData,
|
||||
const char *loggerName = nullptr);
|
||||
|
||||
/**
|
||||
* destructor
|
||||
*/
|
||||
virtual ~GeoPairingImplFiredBullet() = default;
|
||||
|
||||
/**
|
||||
* Performs the calculation of the trajectory and also returns the result of
|
||||
* calculation
|
||||
*/
|
||||
virtual GeoPairingImplFiredBullet::E_CalcResult calculate(const std::shared_ptr<N_Ballistic::BallisticService> &ballisticService);
|
||||
|
||||
virtual GeoPairingImplFiredBullet::E_CalcResult calculateG5G6(double entfernung, double drift, double flugzeit);
|
||||
|
||||
/**
|
||||
* Performs the calculation of multiple trajectories and also returns the result
|
||||
* of calculation
|
||||
*
|
||||
* @param a_nbrRounds
|
||||
* @param a_widthField
|
||||
* @param a_lengthField
|
||||
* @param a_duration
|
||||
* @param a_heading
|
||||
*/
|
||||
virtual GeoPairingImplFiredBullet::E_CalcResult calculateSalve(const std::shared_ptr<N_Ballistic::BallisticService> &ballisticService,
|
||||
int a_nbrRounds, double &a_widthField,
|
||||
double &a_lengthField, double &a_duration,
|
||||
double &a_heading);
|
||||
/**
|
||||
* retrieves the Impact Data
|
||||
*/
|
||||
GeoPairingImplImpactData *getImpactData();
|
||||
|
||||
/**
|
||||
* retrieves the Trajectory Data
|
||||
*/
|
||||
GeoPairingImplTrajectoryData *getTrajectoryData();
|
||||
|
||||
/**
|
||||
* Sets the meteo data that are considered for this bullet
|
||||
*
|
||||
* @param a_meteoData
|
||||
*/
|
||||
void setMeteoData(const GeoPairingImplMeteoData &a_meteoData);
|
||||
|
||||
/**
|
||||
* spreads the sensor heading and pitch in the min/max field, using random values
|
||||
*/
|
||||
void prepareSensorData();
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
GeoPairingImplSensorData m_SensorData;
|
||||
|
||||
GeoPairingImplMeteoData m_MeteoData;
|
||||
|
||||
GeoPairingImplImpactData m_ImpactData;
|
||||
|
||||
NGL::INGLLogger &m_logger;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
+269
@@ -0,0 +1,269 @@
|
||||
|
||||
// **************************************************************************
|
||||
//
|
||||
// (C) Copyright 2009 Swiss SIMTEC AG
|
||||
//
|
||||
// **************************************************************************
|
||||
//
|
||||
// $HeadURL$
|
||||
// $LastChangedBy$
|
||||
// $LastChangedDate$
|
||||
// $LastChangedRevision$
|
||||
//
|
||||
// **************************************************************************
|
||||
|
||||
// manual class headers
|
||||
#include "GeoPairingImplFiredBulletBalistic.hpp"
|
||||
#include <GBL_ConfigSystem/geoconfig.h>
|
||||
|
||||
// from cpp_includes
|
||||
#include <FW_Ballistic/ITrajectory.hpp>
|
||||
#include <FW_Ballistic/IFireControl.hpp>
|
||||
#include <FW_Ballistic/BallisticService.hpp>
|
||||
#include <GBL_Types/Angle3.hpp>
|
||||
#include "geo_settings.h"
|
||||
|
||||
namespace N_GeoPairingImpl
|
||||
{
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
// Constructur taking the SensorData as input values
|
||||
// ---------------------------------------------------------------
|
||||
GeoPairingImplFiredBulletBalistic::GeoPairingImplFiredBulletBalistic(const GeoPairingImplSensorData &a_sensorData, const char *loggerName)
|
||||
: GeoPairingImplFiredBullet(a_sensorData, loggerName ? loggerName : "GeoPairingImplFiredBulletBalistic")
|
||||
{
|
||||
m_UtmSensor.setLlPositionDegree(m_SensorData.WeaponPositionLat,
|
||||
m_SensorData.WeaponPositionLong,
|
||||
m_SensorData.WeaponPositionHeight);
|
||||
m_ballisticService = std::make_shared<N_Ballistic::BallisticService>();
|
||||
|
||||
m_ballisticService->init(N_GeoPairingImpl::Settings::cesGeopairingIniPath(),
|
||||
N_GeoPairingImpl::Settings::cesGeopairingIniFile(),
|
||||
N_GeoPairingImpl::Settings::cesAmmunitionIniFile());
|
||||
m_SensorData.IgnitionType = a_sensorData.IgnitionType;
|
||||
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
// Performs the calculation of the trajectory and also returns
|
||||
// the result of calculation
|
||||
// ---------------------------------------------------------------
|
||||
GeoPairingImplFiredBullet::E_CalcResult GeoPairingImplFiredBulletBalistic::calculate(const std::shared_ptr<N_Ballistic::BallisticService> &ballisticService)
|
||||
{
|
||||
m_ballisticService = ballisticService;
|
||||
E_CalcResult l_cr = e_NONE;
|
||||
N_ConfigSystem::GeoConfig *l_config = N_ConfigSystem::GeoConfig::getInstance();
|
||||
|
||||
QMap<int, QString> ammuMap = l_config->getAmmuMap();
|
||||
QMap<int, QVector<double> > chargeMap = l_config->getChargeMap();
|
||||
|
||||
INFO_LOG(m_logger) << "----------- Calculating Impact -----------";
|
||||
|
||||
N_Types::Coord3 l_sensorPos(m_UtmSensor.utmEasting(),
|
||||
m_UtmSensor.utmNorthing(),
|
||||
m_UtmSensor.height());
|
||||
INFO_LOG(m_logger) << "l_sensorPos : " << l_sensorPos;
|
||||
|
||||
N_Math::GeoCoord l_checkUtm;
|
||||
l_checkUtm.setTotalUtmPosition(l_sensorPos.m_X, l_sensorPos.m_Y, l_sensorPos.m_Z,
|
||||
m_UtmSensor.utmZone(), m_UtmSensor.northP());
|
||||
|
||||
N_Types::Coord3 l_checkPos(l_checkUtm.latDeg(), l_checkUtm.lonDeg(), l_checkUtm.height());
|
||||
INFO_LOG(m_logger) << "o_checkPos : " << l_checkPos;
|
||||
INFO_LOG(m_logger) << "m_SensorData.AmmunitionType : " << m_SensorData.AmmunitionType;
|
||||
QString l_ammunition = ammuMap[m_SensorData.AmmunitionType];
|
||||
INFO_LOG(m_logger) << "l_ammunition=" << l_ammunition;
|
||||
|
||||
|
||||
// ---------------- Preparing Calculation
|
||||
N_Ballistic::IFireControl *lp_fireControl = nullptr;
|
||||
if (!m_ballisticService)
|
||||
{
|
||||
ERROR_LOG(m_logger) << "!m_ballisticService";
|
||||
return l_cr;
|
||||
}
|
||||
bool ok = m_ballisticService->createInterfaceOf((N_Ballistic::IUnknown **)&lp_fireControl, N_Ballistic::BallisticService::e_IFireControl, l_ammunition);
|
||||
if (!ok)
|
||||
{
|
||||
ERROR_LOG(m_logger) << "couldn't create interface ";
|
||||
return l_cr;
|
||||
}
|
||||
if (!lp_fireControl)
|
||||
{
|
||||
ERROR_LOG(m_logger) << "couldn't initialize fireControl for " << l_ammunition;
|
||||
return l_cr;
|
||||
}
|
||||
|
||||
double l_density = lp_fireControl->getAirDensity(m_MeteoData.AirPressure, m_MeteoData.Temperature);
|
||||
INFO_LOG(m_logger) << "l_density = " << l_density;
|
||||
|
||||
INFO_LOG ( m_logger) << "getInitialAmmuVelocity=" << m_SensorData.WeaponTemperature;
|
||||
double l_initialspeed = lp_fireControl->getInitialAmmuVelocity(m_SensorData.WeaponTemperature);
|
||||
INFO_LOG ( m_logger) << "l_initialspeed=" << l_initialspeed;
|
||||
|
||||
|
||||
QMap<int, QVector<double> >::iterator chargeIt = chargeMap.find(m_SensorData.AmmunitionType);
|
||||
if (chargeIt != chargeMap.end())
|
||||
{
|
||||
QVector<double> l_charges = chargeMap[m_SensorData.AmmunitionType];
|
||||
if (m_SensorData.ChargeType >= 0 && m_SensorData.ChargeType < l_charges.size())
|
||||
{
|
||||
l_initialspeed = l_charges[m_SensorData.ChargeType];
|
||||
INFO_LOG(m_logger) << "Charge chosen for " << l_ammunition << " : " << l_initialspeed;
|
||||
}
|
||||
}
|
||||
else
|
||||
INFO_LOG(m_logger) << "l_initialspeed = " << l_initialspeed;
|
||||
|
||||
GeoPairingImplTrajectoryData::TrajectoryPoint tpSensor;
|
||||
tpSensor.m_H = l_sensorPos.m_Z;
|
||||
tpSensor.m_Vel = l_initialspeed;
|
||||
tpSensor.m_Rho = l_density;
|
||||
m_TrajectoryData.m_Points.push_back(tpSensor);
|
||||
|
||||
N_Types::Radian64 l_windDir;
|
||||
l_windDir.setDegree(m_MeteoData.WindDirection);
|
||||
N_Types::Coord3 l_windAngle(0, m_MeteoData.WindSpeed, 0);
|
||||
l_windAngle = l_windAngle.rotateZ(l_windDir);
|
||||
INFO_LOG(m_logger) << "o_windAngle = " << l_windAngle;
|
||||
double l_crossWind = l_windAngle.rotateZ(-m_SensorData.WeaponAzimuth).getX();
|
||||
INFO_LOG(m_logger) << "l_crossWind = " << l_crossWind;
|
||||
|
||||
// ------------------ Prepare Trajectory
|
||||
N_Ballistic::ITrajectory *lp_trajectory = nullptr;
|
||||
//if (!BallisticService::createInterfaceOf((IUnknown **)&lp_trajectory, BallisticService::e_ITrajectory, l_ammunition))
|
||||
//m_ballisticService->createInterfaceOf((IUnknown **)&lp_fireControl, BallisticService::e_IFireControl, l_ammunition);
|
||||
m_ballisticService->createInterfaceOf((N_Ballistic::IUnknown **)&lp_trajectory, N_Ballistic::BallisticService::e_ITrajectory, l_ammunition);
|
||||
|
||||
if (!lp_trajectory)
|
||||
{
|
||||
ERROR_LOG(m_logger) << "Couldn't create Trajectory object for " << l_ammunition;
|
||||
return l_cr;
|
||||
}
|
||||
|
||||
N_Types::Angle3 l_sensorAngle(m_SensorData.WeaponAzimuth,
|
||||
m_SensorData.WeaponElevation,
|
||||
0);
|
||||
INFO_LOG(m_logger) << "o_sensorAngle : " << l_sensorAngle;
|
||||
|
||||
if (!lp_trajectory->init(l_sensorPos, l_sensorAngle, l_crossWind, l_density, l_initialspeed))
|
||||
{
|
||||
lp_trajectory->release();
|
||||
ERROR_LOG(m_logger) << "Couldn't initialize Trajectory";
|
||||
return l_cr;
|
||||
}
|
||||
|
||||
|
||||
// ------------------- Loop Trajectory
|
||||
double l_time = 0;
|
||||
QString s_Precision = QStringLiteral("Precision");
|
||||
QString s_DeltaTime = QStringLiteral("DeltaTime");
|
||||
|
||||
double l_timeDelta = l_config->getFloat(s_Precision, s_DeltaTime, 0.05);
|
||||
INFO_LOG(m_logger) << "Used Precision DeltaTime = " << l_timeDelta;
|
||||
|
||||
N_Types::Coord3 l_pos;
|
||||
|
||||
while (lp_trajectory->isActive())
|
||||
{
|
||||
l_time += l_timeDelta;
|
||||
lp_trajectory->move(l_timeDelta);
|
||||
|
||||
if (m_SensorData.IgnitionType == 0 && !lp_trajectory->isActive())
|
||||
{
|
||||
INFO_LOG(m_logger) << "Timeout of Bullet! IgnitionType=" << m_SensorData.IgnitionType;
|
||||
l_cr = e_TIMEOUT;
|
||||
break;
|
||||
}
|
||||
|
||||
l_pos = lp_trajectory->getPosition();
|
||||
|
||||
N_Math::GeoCoord l_checkUtmShadow;
|
||||
l_checkUtmShadow.setTotalUtmPosition(l_pos.m_X, l_pos.m_Y, l_pos.m_Z,
|
||||
m_UtmSensor.utmZone(), m_UtmSensor.northP());
|
||||
|
||||
N_Types::Coord3 l_checkPosShadow(l_checkUtmShadow.lonDeg(), l_checkUtmShadow.latDeg(), l_checkUtmShadow.height());
|
||||
|
||||
INFO_LOG(m_logger) << "l_pos "
|
||||
<< " X=" << l_pos.getX()
|
||||
<< " Y=" << l_pos.getY()
|
||||
<< " Z=" << l_pos.getZ()
|
||||
<< " m_X=" << l_pos.m_X
|
||||
<< " m_Y=" << l_pos.m_Y
|
||||
<< " m_Z=" << l_pos.m_Z
|
||||
<< " l_checkUtm.height=" << l_checkUtmShadow.height()
|
||||
<< " l_checkPos.z=" << l_checkPosShadow.getZ();
|
||||
|
||||
double l_height = 0;
|
||||
if (checkTerrainHit(l_checkPosShadow, l_height))
|
||||
{
|
||||
INFO_LOG(m_logger) << "deactivate";
|
||||
lp_trajectory->deactivate();
|
||||
l_cr = e_OK;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (m_SensorData.IgnitionType > 0 && l_time > m_SensorData.IgnitionType)
|
||||
{
|
||||
INFO_LOG(m_logger) << "deactivate";
|
||||
lp_trajectory->deactivate();
|
||||
l_cr = e_OK;
|
||||
INFO_LOG(m_logger) << "Detonation by Timer : " << m_SensorData.IgnitionType;
|
||||
}
|
||||
}
|
||||
|
||||
GeoPairingImplTrajectoryData::TrajectoryPoint tpImpact;
|
||||
tpImpact.m_X = l_pos.m_X - l_sensorPos.m_X;
|
||||
tpImpact.m_Y = l_pos.m_Y - l_sensorPos.m_Y;
|
||||
tpImpact.m_Z = l_pos.m_Z - l_sensorPos.m_Z;
|
||||
tpImpact.m_H = l_height;
|
||||
tpImpact.m_Vel = lp_trajectory->getVelocity().magnitude();
|
||||
tpImpact.m_Time = l_time;
|
||||
m_TrajectoryData.m_Points.push_back(tpImpact);
|
||||
|
||||
}
|
||||
|
||||
l_pos = lp_trajectory->getPosition();
|
||||
|
||||
// INFO_LOG(m_logger) << "Total Distance = " << l_pos.length(l_sensorPos);
|
||||
INFO_LOG(m_logger) << "Total Time = " << l_time;
|
||||
|
||||
lp_trajectory->release();
|
||||
lp_fireControl->release();
|
||||
|
||||
INFO_LOG(m_logger) << "l_pos : " << l_pos;
|
||||
|
||||
double l_Distance = l_pos.length(l_sensorPos);
|
||||
INFO_LOG(m_logger) << "l_Distance = " << l_Distance;
|
||||
|
||||
N_Math::GeoCoord l_impactUtm;
|
||||
l_impactUtm.setTotalUtmPosition(l_pos.m_X, l_pos.m_Y, l_pos.m_Z,
|
||||
m_UtmSensor.utmZone(), m_UtmSensor.northP());
|
||||
|
||||
INFO_LOG(m_logger) << "l_impactUtm (lat/lon/h) : " << l_impactUtm.latDeg()
|
||||
<< "/" << l_impactUtm.lonDeg() << "/" << l_impactUtm.height()
|
||||
<< " zone=" << m_UtmSensor.utmZone()
|
||||
<< " northP=" << m_UtmSensor.northP();
|
||||
|
||||
|
||||
m_ImpactData.AmmunitionType = m_SensorData.AmmunitionType;
|
||||
m_ImpactData.ImpactTime = m_SensorData.FireTime + l_time;
|
||||
m_ImpactData.ImpactPositionLat = l_impactUtm.latDeg();
|
||||
m_ImpactData.ImpactPositionLong = l_impactUtm.lonDeg();
|
||||
m_ImpactData.ImpactPositionHeight = l_impactUtm.height();
|
||||
|
||||
return l_cr;
|
||||
}
|
||||
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
bool GeoPairingImplFiredBulletBalistic::checkTerrainHit(const N_Types::Coord3 &a_pos, double &a_height)
|
||||
{
|
||||
a_height = 0;
|
||||
INFO_LOG(m_logger) << "checkTerrainHit"
|
||||
<< " a_pos.m_Z=" << a_pos.m_Z
|
||||
<< " m_UtmSensor.height()=" << m_UtmSensor.height();
|
||||
return a_pos.m_Z < m_UtmSensor.height();
|
||||
}
|
||||
|
||||
} // namespace N_GeoPairingImpl
|
||||
+48
@@ -0,0 +1,48 @@
|
||||
#pragma once
|
||||
|
||||
// **************************************************************************
|
||||
//
|
||||
// (C) Copyright 2009 Swiss SIMTEC AG
|
||||
//
|
||||
// **************************************************************************
|
||||
//
|
||||
// $HeadURL$
|
||||
// $LastChangedBy$
|
||||
// $LastChangedDate$
|
||||
// $LastChangedRevision$
|
||||
//
|
||||
// **************************************************************************
|
||||
|
||||
// from stereotyped includes
|
||||
#include <GBL_Types/Coord3.hpp>
|
||||
#include <GBL_Types/GeoCoord.hpp>
|
||||
#include "GeoPairingImplFiredBullet.hpp"
|
||||
#include <FW_Ballistic/BallisticService.hpp>
|
||||
#include <memory>
|
||||
// manual class imports
|
||||
|
||||
namespace N_GeoPairingImpl
|
||||
{
|
||||
|
||||
class GeoPairingImplFiredBulletBalistic : public GeoPairingImplFiredBullet
|
||||
{
|
||||
public:
|
||||
explicit GeoPairingImplFiredBulletBalistic(const GeoPairingImplSensorData &a_sensorData,
|
||||
const char *loggerName = nullptr);
|
||||
|
||||
|
||||
GeoPairingImplFiredBullet::E_CalcResult calculate(const std::shared_ptr<N_Ballistic::BallisticService> &ballisticService) override;
|
||||
|
||||
protected:
|
||||
|
||||
N_Math::GeoCoord m_UtmSensor;
|
||||
|
||||
virtual bool checkTerrainHit(const N_Types::Coord3 &a_pos, double &a_height);
|
||||
|
||||
private:
|
||||
std::shared_ptr<N_Ballistic::BallisticService> m_ballisticService; ///< Pointer Ballistic Service
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
+96
@@ -0,0 +1,96 @@
|
||||
|
||||
// **************************************************************************
|
||||
//
|
||||
// (C) Copyright 2009 Swiss SIMTEC AG
|
||||
//
|
||||
// **************************************************************************
|
||||
//
|
||||
// $HeadURL$
|
||||
// $LastChangedBy$
|
||||
// $LastChangedDate$
|
||||
// $LastChangedRevision$
|
||||
//
|
||||
// **************************************************************************
|
||||
|
||||
// manual class headers
|
||||
#include "GeoPairingImplFiredBulletDted.hpp"
|
||||
#include <GBL_ConfigSystem/geoconfig.h>
|
||||
|
||||
namespace N_GeoPairingImpl
|
||||
{
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
GeoPairingImplFiredBulletDted::GeoPairingImplFiredBulletDted(GeoPairingImplSensorData &a_sensorData)
|
||||
: GeoPairingImplFiredBulletBalistic(a_sensorData/*, m_ballisticService*/)
|
||||
{
|
||||
N_Types::Radian64 l_weaponLat;
|
||||
l_weaponLat.setDegree(m_SensorData.WeaponPositionLat);
|
||||
N_Types::Radian64 l_weaponLong;
|
||||
l_weaponLong.setDegree(m_SensorData.WeaponPositionLong);
|
||||
|
||||
Float64 l_elevationInitial = getElevation(l_weaponLong, l_weaponLat);
|
||||
|
||||
if (l_elevationInitial > m_SensorData.WeaponPositionHeight)
|
||||
{
|
||||
INFO_LOG(m_logger) << "Use effective Terrain Elevation: " << l_elevationInitial;
|
||||
m_SensorData.WeaponPositionHeight = l_elevationInitial;
|
||||
a_sensorData.WeaponPositionHeight = l_elevationInitial;
|
||||
}
|
||||
|
||||
m_UtmSensor.setLlPositionDegree(m_SensorData.WeaponPositionLat,
|
||||
m_SensorData.WeaponPositionLong,
|
||||
m_SensorData.WeaponPositionHeight);
|
||||
|
||||
}
|
||||
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
bool GeoPairingImplFiredBulletDted::checkTerrainHit(const N_Types::Coord3 &a_pos, Float64 &a_height)
|
||||
{
|
||||
N_Types::Radian64 l_posLat;
|
||||
l_posLat.setDegree(a_pos.m_Y);
|
||||
N_Types::Radian64 l_posLong;
|
||||
l_posLong.setDegree(a_pos.m_X);
|
||||
|
||||
Float64 l_elevation = getElevation(l_posLong, l_posLat);
|
||||
/*
|
||||
if (l_elevation == ZWLA::Elevation::OUT_OF_MAP)
|
||||
{
|
||||
ERROR_LOG(m_logger) << "OUT_OF_MAP : a_pos=" << a_pos;
|
||||
}
|
||||
else if (l_elevation == ZWLA::Elevation::ILLEGAL_ELEVATION)
|
||||
{
|
||||
ERROR_LOG(m_logger) << "ILLEGAL_ELEVATION : a_pos=" << a_pos;
|
||||
}
|
||||
else if (l_elevation == ZWLA::Elevation::UNDEFINED_ELEVATION)
|
||||
{
|
||||
ERROR_LOG(m_logger) << "UNDEFINED_ELEVATION : a_pos=" << a_pos;
|
||||
}*/
|
||||
/* else
|
||||
{
|
||||
INFO_LOG(m_logger) << "a_pos = " << a_pos << " : << l_elevation = " << l_elevation;
|
||||
}*/
|
||||
|
||||
a_height = l_elevation;
|
||||
return l_elevation > a_pos.m_Z;
|
||||
}
|
||||
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
bool GeoPairingImplFiredBulletDted::initStatic()
|
||||
{
|
||||
bool l_Success = true;
|
||||
return l_Success;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
void GeoPairingImplFiredBulletDted::deinitStatic()
|
||||
{
|
||||
}
|
||||
|
||||
double GeoPairingImplFiredBulletDted::getElevation(double lon, double lat)
|
||||
{
|
||||
return N_ConfigSystem::GeoConfig::getInstance()->getElevation(lon, lat);
|
||||
}
|
||||
|
||||
} // namespace N_GeoPairingImpl
|
||||
+57
@@ -0,0 +1,57 @@
|
||||
#pragma once
|
||||
|
||||
// **************************************************************************
|
||||
//
|
||||
// (C) Copyright 2009 Swiss SIMTEC AG
|
||||
//
|
||||
// **************************************************************************
|
||||
//
|
||||
// $HeadURL$
|
||||
// $LastChangedBy$
|
||||
// $LastChangedDate$
|
||||
// $LastChangedRevision$
|
||||
//
|
||||
// **************************************************************************
|
||||
|
||||
// from stereotyped includes
|
||||
#include "GeoPairingImplFiredBulletBalistic.hpp"
|
||||
|
||||
namespace N_GeoPairingImpl
|
||||
{
|
||||
|
||||
/**
|
||||
* @author Daniel.Schmid
|
||||
* @version 1.0
|
||||
* @created 11-Nov-2009 16:05:20
|
||||
*/
|
||||
class GeoPairingImplFiredBulletDted : public GeoPairingImplFiredBulletBalistic
|
||||
{
|
||||
public:
|
||||
|
||||
/**
|
||||
*
|
||||
* @param a_sensorData
|
||||
*/
|
||||
explicit GeoPairingImplFiredBulletDted(GeoPairingImplSensorData &a_sensorData);
|
||||
|
||||
static bool initStatic();
|
||||
|
||||
static void deinitStatic();
|
||||
|
||||
protected:
|
||||
|
||||
/**
|
||||
*
|
||||
* @param a_pos
|
||||
* @param a_height
|
||||
*/
|
||||
bool checkTerrainHit(const N_Types::Coord3 &a_pos, Float64 &a_height) override;
|
||||
|
||||
private:
|
||||
|
||||
static double getElevation(double lon, double lat);
|
||||
std::shared_ptr<N_Ballistic::BallisticService> m_ballisticService; ///< Pointer Ballistic Service
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
Executable
+32
@@ -0,0 +1,32 @@
|
||||
// **************************************************************************
|
||||
//
|
||||
// (C) Copyright 2009 Swiss SIMTEC AG
|
||||
//
|
||||
// **************************************************************************
|
||||
//
|
||||
// $HeadURL$
|
||||
// $LastChangedBy$
|
||||
// $LastChangedDate$
|
||||
// $LastChangedRevision$
|
||||
//
|
||||
// **************************************************************************
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <GBL_Global/Types.hpp>
|
||||
|
||||
namespace N_GeoPairingImpl
|
||||
{
|
||||
/**
|
||||
* The Impact Data class is the resulting data of the GeoPairing SW.
|
||||
*/
|
||||
struct GeoPairingImplImpactData
|
||||
{
|
||||
SInt32 AmmunitionType = 0;
|
||||
Float64 ImpactPositionHeight = 0.0;
|
||||
Float64 ImpactPositionLat = 0.0;
|
||||
Float64 ImpactPositionLong = 0.0;
|
||||
SInt64 ImpactTime = 0;
|
||||
};
|
||||
|
||||
}
|
||||
Executable
+37
@@ -0,0 +1,37 @@
|
||||
#pragma once
|
||||
|
||||
// **************************************************************************
|
||||
//
|
||||
// (C) Copyright 2009 Swiss SIMTEC AG
|
||||
//
|
||||
// **************************************************************************
|
||||
//
|
||||
// $HeadURL$
|
||||
// $LastChangedBy$
|
||||
// $LastChangedDate$
|
||||
// $LastChangedRevision$
|
||||
//
|
||||
// **************************************************************************
|
||||
|
||||
#include <GBL_Global/Types.hpp>
|
||||
|
||||
// manual class imports
|
||||
|
||||
|
||||
namespace N_GeoPairingImpl
|
||||
{
|
||||
|
||||
/**
|
||||
* This class holds information about meteorological conditions that can influence
|
||||
* the trajectory calculation.
|
||||
*/
|
||||
struct GeoPairingImplMeteoData
|
||||
{
|
||||
Float64 AirPressure = 1013.0;
|
||||
Float64 Temperature = 21.0;
|
||||
Float64 WindDirection = 0.0;
|
||||
Float64 WindSpeed = 0.0;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
Executable
+51
@@ -0,0 +1,51 @@
|
||||
#pragma once
|
||||
|
||||
// **************************************************************************
|
||||
//
|
||||
// (C) Copyright 2009 Swiss SIMTEC AG
|
||||
//
|
||||
// **************************************************************************
|
||||
//
|
||||
// $HeadURL$
|
||||
// $LastChangedBy$
|
||||
// $LastChangedDate$
|
||||
// $LastChangedRevision$
|
||||
//
|
||||
// **************************************************************************
|
||||
|
||||
#pragma once
|
||||
#include <GBL_Global/Types.hpp>
|
||||
#include <GBL_Types/Radian64.hpp>
|
||||
#include "GeoPairingDataBase.hpp"
|
||||
|
||||
namespace N_GeoPairingImpl
|
||||
{
|
||||
|
||||
/**
|
||||
* This class represents the data that is received via TETRA network from the
|
||||
* Sensors.
|
||||
*/
|
||||
struct GeoPairingImplSensorData
|
||||
{
|
||||
Float64 WeaponPositionLat = 0.0;
|
||||
Float64 WeaponPositionLong = 0.0;
|
||||
Float64 WeaponPositionHeight = 0.0;
|
||||
N_Types::Radian64 WeaponAzimuth;
|
||||
N_Types::Radian64 WeaponAzimuthMin;
|
||||
N_Types::Radian64 WeaponAzimuthMax;
|
||||
N_Types::Radian64 WeaponElevation;
|
||||
N_Types::Radian64 WeaponElevationMin;
|
||||
N_Types::Radian64 WeaponElevationMax;
|
||||
Float64 WeaponTemperature = 21.0;
|
||||
e_AmmunitionType AmmunitionType = AmmunitionTypeUnknown;
|
||||
SInt32 ChargeType = 0;
|
||||
SInt32 IgnitionType = 0;
|
||||
e_IgnitionTypeG5G6 IgnitionTypeG5G6 = IgnitionTypeUnknown;
|
||||
|
||||
SInt64 FireTime = 0;
|
||||
bool UseMinMax = false;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
+54
@@ -0,0 +1,54 @@
|
||||
#pragma once
|
||||
|
||||
// **************************************************************************
|
||||
//
|
||||
// (C) Copyright 2009 Swiss SIMTEC AG
|
||||
//
|
||||
// **************************************************************************
|
||||
//
|
||||
// $HeadURL$
|
||||
// $LastChangedBy$
|
||||
// $LastChangedDate$
|
||||
// $LastChangedRevision$
|
||||
//
|
||||
// **************************************************************************
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <GBL_Global/Types.hpp>
|
||||
#include <vector>
|
||||
|
||||
namespace N_GeoPairingImpl
|
||||
{
|
||||
|
||||
/**
|
||||
* This class holds the trajectory points
|
||||
*
|
||||
* @author Daniel.Schmid
|
||||
* @version 1.0
|
||||
* @created 01-Mrz-2010 14:56:36
|
||||
*/
|
||||
struct GeoPairingImplTrajectoryData
|
||||
{
|
||||
/**
|
||||
* @author Daniel.Schmid
|
||||
* @version 1.0
|
||||
* @created 01-Mrz-2010 14:59:30
|
||||
*/
|
||||
struct TrajectoryPoint
|
||||
{
|
||||
Float64 m_X = 0.0;
|
||||
Float64 m_Y = 0.0;
|
||||
Float64 m_Z = 0.0;
|
||||
Float64 m_H = 0.0;
|
||||
|
||||
Float64 m_Vel = 0.0;
|
||||
Float64 m_Time = 0.0;
|
||||
Float64 m_Rho = 0.0;
|
||||
};
|
||||
|
||||
|
||||
std::vector<TrajectoryPoint> m_Points;
|
||||
};
|
||||
|
||||
}
|
||||
+121
@@ -0,0 +1,121 @@
|
||||
/**
|
||||
* Settings for CentralEffectSimulation
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
*/
|
||||
|
||||
#include "geo_settings.h"
|
||||
|
||||
#include <QtCore/QSettings>
|
||||
#include <QtCore/QVariant>
|
||||
#include <nglsettings/nglsettings_settings.h>
|
||||
#include <ngltools/ngltools_filesystem.h>
|
||||
|
||||
namespace N_GeoPairingImpl
|
||||
{
|
||||
class NGLSettingsClass : public NGL::Settings
|
||||
{
|
||||
public:
|
||||
NGLSettingsClass()
|
||||
: NGL::Settings(s_iniFile.isEmpty() ? NGL::findProjectConfigFile() : s_iniFile)
|
||||
{}
|
||||
static void setIniFile(const QString &fn)
|
||||
{
|
||||
s_iniFile = fn;
|
||||
}
|
||||
static QString s_iniFile;
|
||||
};
|
||||
QString NGLSettingsClass::s_iniFile;
|
||||
Q_GLOBAL_STATIC(NGLSettingsClass, s)
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
NGL::Settings *Settings::settings()
|
||||
{
|
||||
return s();
|
||||
}
|
||||
//-----------------------------------------------------------------------------
|
||||
void Settings::setIniFile(const QString &ini)
|
||||
{
|
||||
NGLSettingsClass::setIniFile(ini);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
Settings::CalculateCentralAes Settings::calculateCentralAes()
|
||||
{
|
||||
Settings::CalculateCentralAes value = static_cast<Settings::CalculateCentralAes>(s()->settings()->value(QStringLiteral("CES/calculateCentralAes"), 0).toInt());
|
||||
return value;
|
||||
}
|
||||
|
||||
QString Settings::cesGeopairingIniPath()
|
||||
{
|
||||
return s()->settings()->value(QStringLiteral("CES/geopairingIniPath"), QStringLiteral("/shd/CTC/TOOLS/TDS/TDS-build/bin/GeoPairing/firingTables")).toString();
|
||||
}
|
||||
|
||||
QString Settings::cesGeopairingIniFile()
|
||||
{
|
||||
return s()->settings()->value(QStringLiteral("CES/geopairingIniFile"), QStringLiteral("GeoPairing.ini")).toString();
|
||||
}
|
||||
|
||||
QString Settings::cesAmmunitionIniFile()
|
||||
{
|
||||
return s()->settings()->value(QStringLiteral("CES/ammunitionIniFile"), QStringLiteral("Ammunition.ini")).toString();
|
||||
}
|
||||
|
||||
int Settings::cesCheatingDistanceVehicle()
|
||||
{
|
||||
return s()->settings()->value(QStringLiteral("CES/cesCheatingDistanceVehicle"), 20).toInt();
|
||||
}
|
||||
|
||||
int Settings::cesCheatingDistanceSoldier()
|
||||
{
|
||||
return s()->settings()->value(QStringLiteral("CES/cesCheatingDistanceSoldier"), 5).toInt();
|
||||
}
|
||||
|
||||
// Artillerie-Sounds:
|
||||
bool Settings::cesPlayArtillerieSounds()
|
||||
{
|
||||
return s()->settings()->value(QStringLiteral("CES/playArtillerieSounds"), false).toBool();
|
||||
}
|
||||
|
||||
QString Settings::cesUser()
|
||||
{
|
||||
return s()->settings()->value(QStringLiteral("CES/user"), QStringLiteral("katar")).toString();
|
||||
}
|
||||
|
||||
QString Settings::cesPasswd()
|
||||
{
|
||||
return s()->settings()->value(QStringLiteral("CES/passwd"), QStringLiteral("mout11de")).toString();
|
||||
}
|
||||
|
||||
qreal Settings::cesDistanceThreshold()
|
||||
{
|
||||
return s()->settings()->value(QStringLiteral("CES/distanceThreshold"), 1.415).toReal();
|
||||
}
|
||||
|
||||
qreal Settings::cesFactor()
|
||||
{
|
||||
return s()->settings()->value(QStringLiteral("CES/factor"), 15.05).toReal();
|
||||
}
|
||||
|
||||
int Settings::cesSoundId()
|
||||
{
|
||||
return s()->settings()->value(QStringLiteral("CES/soundId"), 1).toInt();
|
||||
}
|
||||
|
||||
qreal Settings::cesReduceFactor()
|
||||
{
|
||||
return s()->settings()->value(QStringLiteral("CES/reduceFactor"), 1.0).toReal();
|
||||
}
|
||||
|
||||
bool Settings::cesHandleBlockedAreas()
|
||||
{
|
||||
return s()->settings()->value(QStringLiteral("CES/handleBlockedAreas"), false).toBool();
|
||||
}
|
||||
|
||||
bool Settings::cesHandleBuildingOwnership()
|
||||
{
|
||||
return s()->settings()->value(QStringLiteral("CES/handleBuildingOwnership"), true).toBool();
|
||||
}
|
||||
|
||||
} // namespace CesGeoPairingImplImpl
|
||||
+45
@@ -0,0 +1,45 @@
|
||||
/**
|
||||
* Settings for CentralEffectSimulation
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include <QString>
|
||||
|
||||
namespace NGL
|
||||
{
|
||||
class Settings;
|
||||
}
|
||||
|
||||
namespace N_GeoPairingImpl
|
||||
{
|
||||
namespace Settings
|
||||
{
|
||||
enum CalculateCentralAes {
|
||||
NO_AES_CALCUALTION,
|
||||
AES_CALCUALTION,
|
||||
AES_CALCUALTION_ONLY_IN_WLS_AREA };
|
||||
|
||||
NGL::Settings *settings();
|
||||
void setIniFile(const QString &ini);
|
||||
CalculateCentralAes calculateCentralAes();
|
||||
QString cesGeopairingIniPath();
|
||||
QString cesGeopairingIniFile();
|
||||
QString cesAmmunitionIniFile();
|
||||
int cesCheatingDistanceVehicle();
|
||||
int cesCheatingDistanceSoldier();
|
||||
// Artillerie-Sounds:
|
||||
bool cesPlayArtillerieSounds();
|
||||
QString cesUser();
|
||||
QString cesPasswd();
|
||||
qreal cesDistanceThreshold();
|
||||
qreal cesFactor();
|
||||
int cesSoundId();
|
||||
qreal cesReduceFactor();
|
||||
bool cesHandleBlockedAreas();
|
||||
bool cesHandleBuildingOwnership();
|
||||
}
|
||||
|
||||
} // namespace N_GeoPairingImpl
|
||||
Reference in new issue
Block a user