Migrates residual Lts sources to generated rtiddsgen API
Adds NmeaManagement tests, fixes codegen includes and Qt6 SerialPort CMake target.
This commit is contained in:
1 parent
5485a90385
commit
881d44f4dd
512 files changed
+6887
-6426
No files matched your search
@@ -4,6 +4,7 @@
|
||||
#include "position_handler.h"
|
||||
#include "exm_handler.h"
|
||||
#include "logger.h"
|
||||
#include <NGLLogger/NGLLoggerBootstrap.h>
|
||||
#include <AssetManagement/asm_dtc.h>
|
||||
|
||||
using namespace TrainingAreaBase;
|
||||
@@ -28,7 +29,7 @@ bool PositionHandler::initCoordinateConversion() const
|
||||
|
||||
constexpr int ddsTimeout = 10 * 1000;
|
||||
const auto ex = m_mainHandler->exmHandler()->exercise(m_mainHandler->exerciseId());
|
||||
if (ex.id() <= 0)
|
||||
if (ex.id <= 0)
|
||||
{
|
||||
ERROR_LOG(m_logger) << "Can not retrieve exercise information for id " << m_mainHandler->exerciseId();
|
||||
return false;
|
||||
@@ -38,18 +39,18 @@ bool PositionHandler::initCoordinateConversion() const
|
||||
ERROR_LOG(m_logger) << "Error initializing AssetManagement DTC";
|
||||
return false;
|
||||
}
|
||||
const auto ta = m_dtcAsm->trainingArea(ex.trainingAreaId());
|
||||
if (ta.id() <= 0)
|
||||
const auto ta = m_dtcAsm->trainingArea(ex.trainingAreaId);
|
||||
if (ta.id <= 0)
|
||||
{
|
||||
ERROR_LOG(m_logger) << "Can not retrieve training are information for id " << ex.trainingAreaId();
|
||||
ERROR_LOG(m_logger) << "Can not retrieve training are information for id " << ex.trainingAreaId;
|
||||
return false;
|
||||
}
|
||||
|
||||
m_dtcAsm.reset();
|
||||
|
||||
|
||||
const LtsCoordTrans::UtmCoordinate bottomLeft(LtsCoordTrans::UtmCoordinate::fromGeographic(ta.bottomLeft().lon(), ta.bottomLeft().lat()));
|
||||
const QPointF mid(bottomLeft.geographic(ta.width() / 2, ta.height() / 2));
|
||||
const LtsCoordTrans::UtmCoordinate bottomLeft(LtsCoordTrans::UtmCoordinate::fromGeographic(ta.bottomLeft.lon, ta.bottomLeft.lat));
|
||||
const QPointF mid(bottomLeft.geographic(ta.width / 2, ta.height / 2));
|
||||
|
||||
|
||||
|
||||
@@ -60,8 +61,8 @@ bool PositionHandler::initCoordinateConversion() const
|
||||
m_utm2Geographic = LtsCoordTrans::UtmCoordinate::fromMgrs(mgrs);
|
||||
|
||||
LtsCoordTrans::UtmCoordinate topRight(bottomLeft);
|
||||
topRight.x += ta.width();
|
||||
topRight.y += ta.height();
|
||||
topRight.x += ta.width;
|
||||
topRight.y += ta.height;
|
||||
|
||||
m_relPosBottomLeft = bottomLeft.relativeTo(m_utm2Geographic);
|
||||
m_relPosTopRight = topRight.relativeTo(m_utm2Geographic);
|
||||
@@ -69,8 +70,8 @@ bool PositionHandler::initCoordinateConversion() const
|
||||
NOTICE_LOG(m_logger) << "Training area bottomLeft: " << m_relPosBottomLeft.x() << "," << m_relPosBottomLeft.y()
|
||||
<< ", topRight: " << m_relPosTopRight.x() << "," << m_relPosTopRight.y()
|
||||
<< ", base point: " << mgrs
|
||||
<< ", width:" << ta.width()
|
||||
<< ", height: " << ta.height();
|
||||
<< ", width:" << ta.width
|
||||
<< ", height: " << ta.height;
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -84,13 +85,13 @@ Core::GeoPosition2D PositionHandler::relativeToGeographic2D(const TetraIcd::Rela
|
||||
{
|
||||
|
||||
const QPointF point(m_utm2Geographic.geographic(p.offsetX, p.offsetY));
|
||||
ret.lon(point.x());
|
||||
ret.lat(point.y());
|
||||
ret.lon = point.x();
|
||||
ret.lat = point.y();
|
||||
}
|
||||
else
|
||||
{
|
||||
ret.lon(nan(""));
|
||||
ret.lat(nan(""));
|
||||
ret.lon = nan("");
|
||||
ret.lat = nan("");
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
@@ -99,17 +100,17 @@ Core::GeoPosition PositionHandler::relativeToGeographic(const TetraIcd::Relative
|
||||
{
|
||||
const Core::GeoPosition2D pos2d(relativeToGeographic2D(p));
|
||||
Core::GeoPosition ret;
|
||||
ret.lon(pos2d.lon());
|
||||
ret.lat(pos2d.lat());
|
||||
ret.z(p.offsetZ);
|
||||
ret.lon = pos2d.lon;
|
||||
ret.lat = pos2d.lat;
|
||||
ret.z = p.offsetZ;
|
||||
DEBUG_LOG(m_logger) << "x/y -> lon/lat: " << p.offsetX << "," << p.offsetY
|
||||
<< " -> " << ret.lon() * LtsCoordTrans::rad2deg() << "," << ret.lat() * LtsCoordTrans::rad2deg();
|
||||
<< " -> " << ret.lon * LtsCoordTrans::rad2deg() << "," << ret.lat * LtsCoordTrans::rad2deg();
|
||||
return ret;
|
||||
}
|
||||
|
||||
QPointF PositionHandler::geographicToRelativePointF(const Core::GeoPosition2D &p) const
|
||||
{
|
||||
return geographicToRelativePointF(Core::GeoPosition(p.lon(), p.lat(), 0));
|
||||
return geographicToRelativePointF(Core::GeoPosition(p.lon, p.lat, 0));
|
||||
}
|
||||
|
||||
QPointF PositionHandler::geographicToRelativePointF(const Core::GeoPosition &p) const
|
||||
@@ -117,21 +118,21 @@ QPointF PositionHandler::geographicToRelativePointF(const Core::GeoPosition &p)
|
||||
initCoordinateConversion();
|
||||
|
||||
|
||||
const LtsCoordTrans::UtmCoordinate point(LtsCoordTrans::UtmCoordinate::fromGeographic(p.lon(), p.lat(), m_utm2Geographic.zone));
|
||||
const LtsCoordTrans::UtmCoordinate point(LtsCoordTrans::UtmCoordinate::fromGeographic(p.lon, p.lat, m_utm2Geographic.zone));
|
||||
|
||||
return QPointF(point.x - m_utm2Geographic.x, point.y - m_utm2Geographic.y);
|
||||
}
|
||||
|
||||
TetraIcd::RelativePosition PositionHandler::geographicToRelative(const Core::GeoPosition2D &p, double z) const
|
||||
{
|
||||
return geographicToRelative(Core::GeoPosition(p.lon(), p.lat(), z));
|
||||
return geographicToRelative(Core::GeoPosition(p.lon, p.lat, z));
|
||||
}
|
||||
|
||||
TetraIcd::RelativePosition PositionHandler::geographicToRelative(const Core::GeoPosition &p) const
|
||||
{
|
||||
const QPointF rel(geographicToRelativePointF(p));
|
||||
const TetraIcd::RelativePosition ret(qRound(rel.x()), qRound(rel.y()), p.z());
|
||||
DEBUG_LOG(m_logger) << "lon/lat -> x/y: " << p.lon() * LtsCoordTrans::rad2deg() << "," << p.lat() * LtsCoordTrans::rad2deg()
|
||||
const TetraIcd::RelativePosition ret(qRound(rel.x()), qRound(rel.y()), p.z);
|
||||
DEBUG_LOG(m_logger) << "lon/lat -> x/y: " << p.lon * LtsCoordTrans::rad2deg() << "," << p.lat * LtsCoordTrans::rad2deg()
|
||||
<< " -> " << ret.offsetX << "," << ret.offsetY;
|
||||
return ret;
|
||||
}
|
||||
@@ -153,7 +154,7 @@ double PositionHandler::speed (const TetraIcd::RelativePosition &relPos, const i
|
||||
if (deltaTime == 0)
|
||||
return 0.0;
|
||||
|
||||
TetraIcd::RelativePosition lastRelPosition = geographicToRelative(lastParticipantPosition.pos.position());
|
||||
TetraIcd::RelativePosition lastRelPosition = geographicToRelative(lastParticipantPosition.pos.position);
|
||||
|
||||
QLineF line(QPointF(lastRelPosition.offsetX, lastRelPosition.offsetY),
|
||||
QPointF(relPos.offsetX, relPos.offsetY));
|
||||
@@ -191,7 +192,7 @@ TrainingAreaBase::TabPosition PositionHandler::lastPosition(int equipNo) const
|
||||
lastPos = m_lastPosition.value(equipNo);
|
||||
return lastPos.pos;
|
||||
}
|
||||
ret.position(Core::GeoPosition(nan(""), nan(""), nan("")));
|
||||
ret.position = Core::GeoPosition(nan(""), nan(""), nan(""));
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user