From fe50367773e65ef4f55670cf64a908cafb8d05b9 Mon Sep 17 00:00:00 2001 From: Evgeny Gagua Date: Mon, 9 Oct 2023 20:40:39 -0700 Subject: [PATCH] Before ATP of MER Group (preluminary) --- Projects/la_mojo/build | 2 +- lib/App/common/deviceNode2D.cpp | 14 ++++-- lib/App/mojo/mojoKernel.cpp | 2 +- lib/components/object/objectSystemAnchor.cpp | 45 ++++++++++++-------- 4 files changed, 39 insertions(+), 24 deletions(-) diff --git a/Projects/la_mojo/build b/Projects/la_mojo/build index 59699e61..e30c9046 100755 --- a/Projects/la_mojo/build +++ b/Projects/la_mojo/build @@ -4,7 +4,7 @@ #make clean -e "CFG=Debug" #make -e "CFG=Debug" -j6 -make clean -e "CFG=Debug86" +#make clean -e "CFG=Debug86" make -e "CFG=Debug86" -j4 #make clean -e "CFG=Release86" diff --git a/lib/App/common/deviceNode2D.cpp b/lib/App/common/deviceNode2D.cpp index 810b44c1..72d3a59c 100644 --- a/lib/App/common/deviceNode2D.cpp +++ b/lib/App/common/deviceNode2D.cpp @@ -3138,10 +3138,16 @@ TARGET_DATA *device2DSensor::prepareTargetData( uint16_t AZ, uint16_t RANGE, uin // system - C3D_DECART // global - C3D_WGS84_LOC tSystem->convertToSystem( &m_oPosition, tVal->local_target, tVal->system_target ); - //ToDo: Fix Convert! - tSystem->convertToGlobal( &m_oPosition, tVal->local_target, tVal->global_target ); - //tSystem->convertToGlobal( &m_oPosition, tVal->system_target, tVal->global_target ); -#ifdef DEBUG_EXTRA + if ( tSystem->beLocal() ) { + tVal->global_target.lat = tVal->system_target.y; + tVal->global_target.lon = tVal->system_target.x; + tVal->global_target.alt = tVal->system_target.z; + } else { + //ToDo: Fix Convert! + tSystem->convertToGlobal(&m_oPosition, tVal->local_target, tVal->global_target); + //tSystem->convertToGlobal( &m_oPosition, tVal->system_target, tVal->global_target ); + }; +#ifdef DEBUG char tB[128]; sprintf(tB, "tCords Local: %0.3f %0.3f %0.3f", tVal->local_target.r, tVal->local_target.fi, tVal->local_target.tetta ); LOG( tB ); diff --git a/lib/App/mojo/mojoKernel.cpp b/lib/App/mojo/mojoKernel.cpp index d96278b3..376fe4be 100644 --- a/lib/App/mojo/mojoKernel.cpp +++ b/lib/App/mojo/mojoKernel.cpp @@ -155,7 +155,7 @@ bool mojoKernel::create(){ t.lat = tSiteData->lat; t.lon = tSiteData->lon; t.alt = tSiteData->alt; - m_pSystemAnchor = systemAnchor::getInstance( tSiteData->SH, &t, false );//tSiteData->local_binding ); + m_pSystemAnchor = systemAnchor::getInstance( tSiteData->SH, &t, tSiteData->local_binding ); free( tSiteData ); } else { LOG_ERROR("Error Loading Site DATA!"); diff --git a/lib/components/object/objectSystemAnchor.cpp b/lib/components/object/objectSystemAnchor.cpp index 99299ada..59e06ca5 100644 --- a/lib/components/object/objectSystemAnchor.cpp +++ b/lib/components/object/objectSystemAnchor.cpp @@ -93,17 +93,23 @@ systemAnchor::systemAnchor( bool SOUTH, C3D_WGS84_LOC *ptr, bool beJustLocal ): basicSettingsProvider::getInstance()->validate(); }; } else { - lat = ptr->lat; - lon = ptr->lon; - z = ptr->alt; + if ( m_bUseJustLocalDiffCoords ) { + y = lat = ptr->lat; + x = lon = ptr->lon; + z = ptr->alt; + } else { + lat = ptr->lat; + lon = ptr->lon; + z = ptr->alt; #ifdef FLOAT_64 - double A, B; - utmZone = CC.LatLonToUTMXY( lat, lon, 0 , A, B ); - x = A; - y = B; + double A, B; + utmZone = CC.LatLonToUTMXY( lat, lon, 0 , A, B ); + x = A; + y = B; #else - utmZone = m_SCC.LatLonToUTMXY(lat, lon, m_bSouthHemisphere, x, y); + utmZone = m_SCC.LatLonToUTMXY(lat, lon, m_bSouthHemisphere, x, y); #endif + }; }; #ifdef DEBUG char tBuff[256]; @@ -315,28 +321,31 @@ bool systemAnchor::convertToSystem(basicPosition *SP, C3D_SPH_DEGREES POS, C3D_D A[0] = tDec.x; A[1] = tDec.y; A[2] = tDec.z; -#ifdef DEBUG_EXTRA +#ifdef DEBUG char tB[256]; LOG("C2S Sph.(deg) -> Dec."); sprintf( tB, "Local Decart: %.3f %.3f %.3f", A[0], A[1], A[2] ); LOG( tB ); #endif pTF->get_vector_world( A, B ); -#ifdef DEBUG_EXTRA +#ifdef DEBUG sprintf( tB, "World Decart: %.3f %.3f %.3f", B[0], B[1], B[2] ); LOG( tB ); #endif -#ifdef DEBUG_EXTRA +#ifdef DEBUG sprintf( tB, "Systen Anchor Decart: %.3f %.3f %.3f", getX(), getY(), getZ() ); LOG( tB ); #endif - LOC.x = B[0] - getX(); - //LOC.x = B[0] + SP->getX() - getX(); - LOC.y = B[1] - getY(); - //LOC.y = B[1] + SP->getY() - getY(); - LOC.z = B[2] - getZ(); - //LOC.z = B[2] + SP->getZ() - getZ(); -#ifdef DEBUG_EXTRA + if ( m_bUseJustLocalDiffCoords ) { + LOC.x = B[0]; + LOC.y = B[1]; + LOC.z = B[2]; + } else { + LOC.x = B[0] - getX(); + LOC.y = B[1] - getY(); + LOC.z = B[2] - getZ(); + }; +#ifdef DEBUG sprintf( tB, "Final System Decart: %.3f %.3f %.3f", LOC.x, LOC.y, LOC.z ); LOG( tB ); #endif