Adds immediate migration results in progress
This commit is contained in:
2102 files changed
+17482
-15071
No files matched your search
+1
-1
@@ -31,7 +31,7 @@ void Dispatcher::ReportCBitStatus(const std::string &KeyId, const M_BuiltInTest:
|
||||
{
|
||||
if (IsRemoved)
|
||||
{
|
||||
DEBUG_LOG() << "isRemoved";
|
||||
DEBUG_LOG(m_logger) << "isRemoved";
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
+1
@@ -25,6 +25,7 @@ public:
|
||||
Dispatcher();
|
||||
void ReportCBitStatus(const std::string &KeyId, const M_BuiltInTest::BitStatusType &status, bool IsRemoved) override;
|
||||
private:
|
||||
NGL::INGLLogger &m_logger;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
+5
-5
@@ -37,23 +37,23 @@ Dispatcher::Dispatcher()
|
||||
|
||||
void Dispatcher::ReportDeviceStatus(M_Device::DeviceStatusType const& status, bool IsRemoved)
|
||||
{
|
||||
DEBUG_LOG() << "start";
|
||||
DEBUG_LOG(m_logger) << "start";
|
||||
|
||||
if (IsRemoved)
|
||||
{
|
||||
DEBUG_LOG() << "isRemoved";
|
||||
DEBUG_LOG(m_logger) << "isRemoved";
|
||||
return;
|
||||
}
|
||||
|
||||
if (status.OperationStatus.Mode.empty())
|
||||
{
|
||||
DEBUG_LOG() << "no mode!";
|
||||
DEBUG_LOG(m_logger) << "no mode!";
|
||||
return;
|
||||
}
|
||||
|
||||
if (status.OperationStatus.Mode.front().EnumeratedValue.empty())
|
||||
{
|
||||
DEBUG_LOG() << "no enum value in mode!";
|
||||
DEBUG_LOG(m_logger) << "no enum value in mode!";
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -62,7 +62,7 @@ void Dispatcher::ReportDeviceStatus(M_Device::DeviceStatusType const& status, bo
|
||||
Message msg;
|
||||
msg.Status = operationModeStateKindFromTms(val);
|
||||
|
||||
DEBUG_LOG() << "dispatch!";
|
||||
DEBUG_LOG(m_logger) << "dispatch!";
|
||||
|
||||
dispatch(msg);
|
||||
}
|
||||
|
||||
+1
@@ -26,6 +26,7 @@ public:
|
||||
Dispatcher();
|
||||
void ReportDeviceStatus(M_Device::DeviceStatusType const& status, bool IsRemoved) override;
|
||||
private:
|
||||
NGL::INGLLogger &m_logger;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
+5
-5
@@ -47,19 +47,19 @@ void Dispatcher::ReportMissionStatus(M_MissionCtrl::MissionStatusType const& Mis
|
||||
{
|
||||
if (IsRemoved)
|
||||
{
|
||||
DEBUG_LOG() << "isRemoved";
|
||||
DEBUG_LOG(m_logger) << "isRemoved";
|
||||
return;
|
||||
}
|
||||
|
||||
if (MissionStatus.CurrentAction.CurrentTask.EnumeratedValue.empty())
|
||||
{
|
||||
DEBUG_LOG() << "MissionStatus.CurrentAction.CurrentTask.EnumeratedValue empty";
|
||||
DEBUG_LOG(m_logger) << "MissionStatus.CurrentAction.CurrentTask.EnumeratedValue empty";
|
||||
return;
|
||||
}
|
||||
|
||||
if (!MissionStatus.CurrentAction.CurrentTask.TextualValue.empty())
|
||||
{
|
||||
DEBUG_LOG() << "text: " << QString::fromStdString(MissionStatus.CurrentAction.CurrentTask.TextualValue.front());
|
||||
DEBUG_LOG(m_logger) << "text: " << QString::fromStdString(MissionStatus.CurrentAction.CurrentTask.TextualValue.front());
|
||||
}
|
||||
const Task currentTask = taskFromTms(MissionStatus.CurrentAction.CurrentTask.EnumeratedValue.front());
|
||||
|
||||
@@ -81,7 +81,7 @@ void Dispatcher::ReportMissionStatus(M_MissionCtrl::MissionStatusType const& Mis
|
||||
}
|
||||
|
||||
std::string missionName = MissionStatus.CurrentMissionName;
|
||||
DEBUG_LOG() << "missionName before: " << missionName;
|
||||
DEBUG_LOG(m_logger) << "missionName before: " << missionName;
|
||||
if (missionName.empty())
|
||||
{
|
||||
for (const auto &additionalInfo : std::as_const(MissionStatus.CurrentAction.CurrentTask.AdditionalInfo))
|
||||
@@ -93,7 +93,7 @@ void Dispatcher::ReportMissionStatus(M_MissionCtrl::MissionStatusType const& Mis
|
||||
}
|
||||
}
|
||||
}
|
||||
DEBUG_LOG() << "missionName after: " << missionName;
|
||||
DEBUG_LOG(m_logger) << "missionName after: " << missionName;
|
||||
|
||||
dispatch({ missionName, currentTask, currentlyAllowedTasks, {} });
|
||||
}
|
||||
|
||||
+1
@@ -24,6 +24,7 @@ public:
|
||||
Dispatcher();
|
||||
void ReportMissionStatus(M_MissionCtrl::MissionStatusType const& MissionStatus, bool IsRemoved) override;
|
||||
private:
|
||||
NGL::INGLLogger &m_logger;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
+3
-3
@@ -17,7 +17,7 @@ Dispatcher::Dispatcher()
|
||||
|
||||
void Dispatcher::ReportPoint(const M_Common::ObjectIdType &KeyId, const M_ObjectManager::PointObjectType &, bool IsRemoved)
|
||||
{
|
||||
DEBUG_LOG() << "start";
|
||||
DEBUG_LOG(m_logger) << "start";
|
||||
|
||||
Message msg;
|
||||
|
||||
@@ -25,13 +25,13 @@ void Dispatcher::ReportPoint(const M_Common::ObjectIdType &KeyId, const M_Object
|
||||
msg.uasId = std::stoi(KeyId);
|
||||
}catch(...)
|
||||
{
|
||||
ERROR_LOG() << "KeyId not an int !";
|
||||
ERROR_LOG(m_logger) << "KeyId not an int !";
|
||||
return;
|
||||
}
|
||||
|
||||
msg.isRemoved = IsRemoved;
|
||||
|
||||
DEBUG_LOG() << "dispatch!";
|
||||
DEBUG_LOG(m_logger) << "dispatch!";
|
||||
|
||||
dispatch(msg);
|
||||
}
|
||||
|
||||
+1
@@ -23,6 +23,7 @@ public:
|
||||
Dispatcher();
|
||||
void ReportPoint(const M_Common::ObjectIdType &KeyId, const M_ObjectManager::PointObjectType &Obj, bool IsRemoved) override;
|
||||
private:
|
||||
NGL::INGLLogger &m_logger;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
+6
-6
@@ -19,14 +19,14 @@ void Dispatcher::ReportPositions(const std::string &KeyId, const M_Common::Posit
|
||||
{
|
||||
if (IsRemoved)
|
||||
{
|
||||
DEBUG_LOG() << "isRemoved";
|
||||
DEBUG_LOG(m_logger) << "isRemoved";
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (KeyId != "UTM_GLOBAL_POSITION" && KeyId != "CURRENT_AIRFRAME_RAW" && KeyId != "CURRENT_AIRFRAME")
|
||||
{
|
||||
DEBUG_LOG() << "KeyId unwanted (is '" << QString::fromStdString(KeyId) << "')";
|
||||
DEBUG_LOG(m_logger) << "KeyId unwanted (is '" << QString::fromStdString(KeyId) << "')";
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ void Dispatcher::ReportPositions(const std::string &KeyId, const M_Common::Posit
|
||||
|
||||
if (PositionList.empty())
|
||||
{
|
||||
DEBUG_LOG() << "PositionList is empty";
|
||||
DEBUG_LOG(m_logger) << "PositionList is empty";
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ void Dispatcher::ReportPositions(const std::string &KeyId, const M_Common::Posit
|
||||
|
||||
if (pos.Ellipsoidal.empty())
|
||||
{
|
||||
DEBUG_LOG() << "PositionList.Ellipsoidal is empty";
|
||||
DEBUG_LOG(m_logger) << "PositionList.Ellipsoidal is empty";
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ void Dispatcher::ReportPositions(const std::string &KeyId, const M_Common::Posit
|
||||
|
||||
if (elip.Altitude.empty())
|
||||
{
|
||||
DEBUG_LOG() << "PositionList.Ellipsoidal.Altitude is empty";
|
||||
DEBUG_LOG(m_logger) << "PositionList.Ellipsoidal.Altitude is empty";
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@ void Dispatcher::ReportPositions(const std::string &KeyId, const M_Common::Posit
|
||||
|
||||
if (pos.Timestamp.empty())
|
||||
{
|
||||
DEBUG_LOG() << "PositionList[0].Timestamp is empty";
|
||||
DEBUG_LOG(m_logger) << "PositionList[0].Timestamp is empty";
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
+1
@@ -23,6 +23,7 @@ public:
|
||||
Dispatcher();
|
||||
void ReportPositions(const std::string &KeyId, const M_Common::PositionListType &PositionList, bool IsRemoved) override;
|
||||
private:
|
||||
NGL::INGLLogger &m_logger;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -34,13 +34,13 @@ void Dispatcher::ReportRadioConnectionStatus(const std::string &, const M_Teleop
|
||||
{
|
||||
if (IsRemoved)
|
||||
{
|
||||
DEBUG_LOG() << "isRemoved";
|
||||
DEBUG_LOG(m_logger) << "isRemoved";
|
||||
return;
|
||||
}
|
||||
|
||||
if (RadioConnectionStatus.LinkConnectionState == M_Teleoperation::RadioLinkConnectionState::Undefined)
|
||||
{
|
||||
DEBUG_LOG() << "MissionStatus.CurrentAction.CurrentTask.EnumeratedValue empty";
|
||||
DEBUG_LOG(m_logger) << "MissionStatus.CurrentAction.CurrentTask.EnumeratedValue empty";
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
+1
@@ -25,6 +25,7 @@ public:
|
||||
Dispatcher();
|
||||
void ReportRadioConnectionStatus(std::string const& KeyId, M_Teleoperation::RadioConnectionStatusType const& RadioConnectionStatus, bool IsRemoved) override;
|
||||
private:
|
||||
NGL::INGLLogger &m_logger;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
+5
-5
@@ -67,7 +67,7 @@ public:
|
||||
, m_reader(m_master.dispatcher())
|
||||
, m_writer(m_master.client())
|
||||
{
|
||||
ERROR_LOG() << "ctor";
|
||||
ERROR_LOG(m_logger) << "ctor";
|
||||
|
||||
connect(m_reader.readerSignal(), &ReaderSignal::dataReady, this, &InterfaceAdapterInitializer::updatePoint);
|
||||
|
||||
@@ -77,7 +77,7 @@ public:
|
||||
{
|
||||
if (m_activeUas.empty())
|
||||
{
|
||||
ERROR_LOG() << "trying to stop active uas - DONE!";
|
||||
ERROR_LOG(m_logger) << "trying to stop active uas - DONE!";
|
||||
|
||||
t->stop();
|
||||
m_parent->setReady();
|
||||
@@ -85,7 +85,7 @@ public:
|
||||
return;
|
||||
}
|
||||
|
||||
ERROR_LOG() << "trying to stop active uas:" << m_activeUas.size();
|
||||
ERROR_LOG(m_logger) << "trying to stop active uas:" << m_activeUas.size();
|
||||
|
||||
for (const int activeUas : m_activeUas)
|
||||
{
|
||||
@@ -137,7 +137,7 @@ private:
|
||||
TmsIfAdapterImpl::TmsIfAdapterImpl()
|
||||
: m_iai(new InterfaceAdapterInitializer(this))
|
||||
{
|
||||
ERROR_LOG() << "TmsIfAdapter running!";
|
||||
ERROR_LOG(m_logger) << "TmsIfAdapter running!";
|
||||
}
|
||||
|
||||
|
||||
@@ -145,7 +145,7 @@ TmsIfAdapterImpl::~TmsIfAdapterImpl()
|
||||
{
|
||||
delete m_iai;
|
||||
delete m_guard;
|
||||
ERROR_LOG() << "!!! TmsIfAdapterImpl DTOR!";
|
||||
ERROR_LOG(m_logger) << "!!! TmsIfAdapterImpl DTOR!";
|
||||
}
|
||||
|
||||
|
||||
|
||||
+60
-61
@@ -15,9 +15,8 @@ using namespace LtsUtils;
|
||||
|
||||
namespace UAS
|
||||
{
|
||||
Resolver::Resolver(QObject *parent)
|
||||
: QObject(parent)
|
||||
{
|
||||
Resolver::Resolver(QObject *parent) : QObject(parent),
|
||||
m_logger(NGL::NGLLoggerBootstrap::getLogger()) {
|
||||
connect(this, &Resolver::resolve, this, &QObject::deleteLater);
|
||||
connect(this, &Resolver::reject, this, [this](){deleteLater();});
|
||||
}
|
||||
@@ -33,7 +32,7 @@ UAVCommanderImpl::UAVCommanderImpl(int domainId, int uasId, QObject *parent)
|
||||
, m_Device(std::string("UAV_Device_") + std::to_string(uasId), domainId)
|
||||
, m_CoordinateFrame(std::string("UAV_CoordinateFrame_") + std::to_string(uasId), domainId)
|
||||
{
|
||||
ERROR_LOG() << "ctor: " << (quintptr)this;
|
||||
ERROR_LOG(m_logger) << "ctor: " << (quintptr)this;
|
||||
|
||||
connect(m_MissionCtrl.reader.readerSignal(), &ReaderSignal::dataReady, this, &UAVCommanderImpl::updateMissionStatus);
|
||||
connect(m_TeleOperation.reader.readerSignal(), &ReaderSignal::dataReady, this, &UAVCommanderImpl::updateOperationalState);
|
||||
@@ -81,7 +80,7 @@ UAVCommanderImpl::MissionCtrlContainer::MissionCtrlContainer(const std::string &
|
||||
|
||||
UAVCommanderImpl::~UAVCommanderImpl()
|
||||
{
|
||||
ERROR_LOG() << "dtor: " << (quintptr)this;
|
||||
ERROR_LOG(m_logger) << "dtor: " << (quintptr)this;
|
||||
|
||||
if (m_createInterfaceAdapterInstance)
|
||||
{
|
||||
@@ -108,13 +107,13 @@ void UAVCommanderImpl::updateMissionStatus()
|
||||
|
||||
const auto oldTask = m_MissionCtrl.currentTask;
|
||||
m_MissionCtrl.currentTask = msg.currentTask;
|
||||
ERROR_LOG() << "currentTask = " << (int)m_MissionCtrl.currentTask;
|
||||
ERROR_LOG(m_logger) << "currentTask = " << (int)m_MissionCtrl.currentTask;
|
||||
|
||||
const auto oldMission = m_MissionCtrl.currentMission;
|
||||
m_MissionCtrl.currentMission = QString::fromStdString(msg.currentMissionName);
|
||||
ERROR_LOG() << "oldTask = " << (int)oldTask;
|
||||
ERROR_LOG(m_logger) << "oldTask = " << (int)oldTask;
|
||||
|
||||
ERROR_LOG() << "currentMission = " << QString::fromStdString(msg.currentMissionName);
|
||||
ERROR_LOG(m_logger) << "currentMission = " << QString::fromStdString(msg.currentMissionName);
|
||||
|
||||
m_MissionCtrl.currentlyAllowedTasks.swap(msg.currentlyAllowedTasks);
|
||||
|
||||
@@ -122,7 +121,7 @@ void UAVCommanderImpl::updateMissionStatus()
|
||||
{
|
||||
|
||||
|
||||
ERROR_LOG() << "Old Task" << oldTask << "new task " << m_MissionCtrl.currentTask ;
|
||||
ERROR_LOG(m_logger) << "Old Task" << oldTask << "new task " << m_MissionCtrl.currentTask ;
|
||||
if (oldTask != m_MissionCtrl.currentTask)
|
||||
{
|
||||
if (!oldMission.isEmpty() && m_MissionCtrl.currentMission.isEmpty())
|
||||
@@ -131,11 +130,11 @@ void UAVCommanderImpl::updateMissionStatus()
|
||||
}
|
||||
|
||||
m_MissionCtrl.ReportMissionStatus_Callback(msg);
|
||||
ERROR_LOG() << "################################# sending " << (int)m_MissionCtrl.currentTask << " " << (quintptr)this;
|
||||
ERROR_LOG(m_logger) << "################################# sending " << (int)m_MissionCtrl.currentTask << " " << (quintptr)this;
|
||||
}
|
||||
else
|
||||
{
|
||||
ERROR_LOG() << "################################# VERWERFING ! " << (int)m_MissionCtrl.currentTask << " " << (quintptr)this;
|
||||
ERROR_LOG(m_logger) << "################################# VERWERFING ! " << (int)m_MissionCtrl.currentTask << " " << (quintptr)this;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -151,7 +150,7 @@ void UAVCommanderImpl::updateMissionStatus()
|
||||
case MissionCtrl::Shutdown:
|
||||
{
|
||||
m_isReady = false;
|
||||
ERROR_LOG() << "UAV not ready yet! currentTask: " << (int)m_MissionCtrl.currentTask;
|
||||
ERROR_LOG(m_logger) << "UAV not ready yet! currentTask: " << (int)m_MissionCtrl.currentTask;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -166,7 +165,7 @@ void UAVCommanderImpl::updateMissionStatus()
|
||||
{
|
||||
m_isReady_Callback();
|
||||
}
|
||||
ERROR_LOG() << "UAV now ready!";
|
||||
ERROR_LOG(m_logger) << "UAV now ready!";
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -253,7 +252,7 @@ void UAVCommanderImpl::updateCBitStaus()
|
||||
|
||||
void UAVCommanderImpl::updateDeviceModeState()
|
||||
{
|
||||
ERROR_LOG() << "start";
|
||||
ERROR_LOG(m_logger) << "start";
|
||||
|
||||
while (true)
|
||||
{
|
||||
@@ -264,10 +263,10 @@ void UAVCommanderImpl::updateDeviceModeState()
|
||||
m_Device.currentMessage.clear();
|
||||
m_Device.currentMessage.emplace_back(msg);
|
||||
|
||||
ERROR_LOG() << "before callback";
|
||||
ERROR_LOG(m_logger) << "before callback";
|
||||
if (m_Device.ReportDeviceStatus_Callback)
|
||||
{
|
||||
ERROR_LOG() << "callback!";
|
||||
ERROR_LOG(m_logger) << "callback!";
|
||||
m_Device.ReportDeviceStatus_Callback(msg);
|
||||
}
|
||||
}
|
||||
@@ -281,11 +280,11 @@ void UAVCommanderImpl::updateDeviceModeState()
|
||||
|
||||
void UAVCommanderImpl::prepareMission(Resolver *resolver)
|
||||
{
|
||||
ERROR_LOG() << "resolver = " << (quintptr)resolver;
|
||||
ERROR_LOG(m_logger) << "resolver = " << (quintptr)resolver;
|
||||
|
||||
if (isTaskAllowed(MissionCtrl::Task::Observe) || m_MissionCtrl.currentTask == MissionCtrl::Task::Connect )
|
||||
{
|
||||
ERROR_LOG() << "DONE! resolving " << (quintptr)resolver;
|
||||
ERROR_LOG(m_logger) << "DONE! resolving " << (quintptr)resolver;
|
||||
emit resolver->resolve();
|
||||
return;
|
||||
}
|
||||
@@ -294,7 +293,7 @@ void UAVCommanderImpl::prepareMission(Resolver *resolver)
|
||||
connect(r, &Resolver::reject, resolver, &Resolver::reject);
|
||||
connect(r, &Resolver::resolve, resolver, [this, resolver]()
|
||||
{
|
||||
ERROR_LOG() << "r ("<<(quintptr)resolver<<")! resolving!";
|
||||
ERROR_LOG(m_logger) << "r ("<<(quintptr)resolver<<")! resolving!";
|
||||
Resolver *r2 = new Resolver(this);
|
||||
connect(r2, &Resolver::reject, resolver, &Resolver::reject);
|
||||
connect(r2, &Resolver::resolve, resolver, &Resolver::resolve);
|
||||
@@ -303,7 +302,7 @@ void UAVCommanderImpl::prepareMission(Resolver *resolver)
|
||||
|
||||
if (!m_MissionCtrl.currentMission.isEmpty())
|
||||
{
|
||||
ERROR_LOG() << " > mission '"<< m_MissionCtrl.currentMission << "' currently active - aborting mission and waiting for loitering";
|
||||
ERROR_LOG(m_logger) << " > mission '"<< m_MissionCtrl.currentMission << "' currently active - aborting mission and waiting for loitering";
|
||||
sendCommand(r, {QStringLiteral("mission:abort (%1)").arg(m_MissionCtrl.currentMission), MissionCtrl::Task::Connect, [this]() { _abortMission(m_MissionCtrl.currentMission); }});
|
||||
return;
|
||||
}
|
||||
@@ -312,28 +311,28 @@ void UAVCommanderImpl::prepareMission(Resolver *resolver)
|
||||
{
|
||||
case MissionCtrl::Task::Disarm:
|
||||
{
|
||||
ERROR_LOG() << " > arm";
|
||||
ERROR_LOG(m_logger) << " > arm";
|
||||
arm(r);
|
||||
break;
|
||||
}
|
||||
|
||||
case MissionCtrl::Task::Arm:
|
||||
{
|
||||
ERROR_LOG() << " > takeoff";
|
||||
ERROR_LOG(m_logger) << " > takeoff";
|
||||
takeoff(r);
|
||||
break;
|
||||
}
|
||||
|
||||
case MissionCtrl::Task::Takeoff:
|
||||
{
|
||||
ERROR_LOG() << " > waiting for Loiter ...";
|
||||
ERROR_LOG(m_logger) << " > waiting for Loiter ...";
|
||||
sendCommand(r, {QStringLiteral("loiter"), MissionCtrl::Task::Loiter, nullptr});
|
||||
break;
|
||||
}
|
||||
|
||||
case MissionCtrl::Task::Loiter:
|
||||
{
|
||||
ERROR_LOG() << " >WE loiter start to resolve";
|
||||
ERROR_LOG(m_logger) << " >WE loiter start to resolve";
|
||||
emit resolver->resolve();
|
||||
break;
|
||||
}
|
||||
@@ -342,7 +341,7 @@ void UAVCommanderImpl::prepareMission(Resolver *resolver)
|
||||
|
||||
default:
|
||||
{
|
||||
ERROR_LOG() << "help, I don't know what to do with "<<(int)m_MissionCtrl.currentTask<<" :(";
|
||||
ERROR_LOG(m_logger) << "help, I don't know what to do with "<<(int)m_MissionCtrl.currentTask<<" :(";
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -353,7 +352,7 @@ void UAVCommanderImpl::sendMission(double lat, double lon, double alt, const QSt
|
||||
{
|
||||
if (!m_isReady)
|
||||
{
|
||||
ERROR_LOG() << "not ready";
|
||||
ERROR_LOG(m_logger) << "not ready";
|
||||
throw std::runtime_error("UAV not ready");
|
||||
}
|
||||
|
||||
@@ -373,21 +372,21 @@ void UAVCommanderImpl::sendMission(double lat, double lon, double alt, const QSt
|
||||
}
|
||||
|
||||
Resolver *r = new Resolver(this);
|
||||
connect(r, &Resolver::reject, this, [this](const QString &msg) { ERROR_LOG() << "rejected: " << msg; });
|
||||
connect(r, &Resolver::reject, this, [this](const QString &msg) { ERROR_LOG(m_logger) << "rejected: " << msg; });
|
||||
connect(r, &Resolver::resolve, [this, lat, lon, alt, missionName]()
|
||||
{
|
||||
ERROR_LOG() << "!!!!!!!!!!!!!!!!!!!!!! going to observe now!!";
|
||||
ERROR_LOG(m_logger) << "!!!!!!!!!!!!!!!!!!!!!! going to observe now!!";
|
||||
|
||||
|
||||
Resolver *r2 = new Resolver(this);
|
||||
connect(r2, &Resolver::reject, [this](const QString &msg) { ERROR_LOG() << "################ failed to start mission :( " << msg; });
|
||||
connect(r2, &Resolver::reject, [this](const QString &msg) { ERROR_LOG(m_logger) << "################ failed to start mission :( " << msg; });
|
||||
connect(r2, &Resolver::resolve, [this, missionName]()
|
||||
{
|
||||
Resolver *r3 = new Resolver(this);
|
||||
connect(r3, &Resolver::reject, [this](const QString &msg) { ERROR_LOG() << "################ failed to wait for loiter :( " << msg; });
|
||||
connect(r3, &Resolver::reject, [this](const QString &msg) { ERROR_LOG(m_logger) << "################ failed to wait for loiter :( " << msg; });
|
||||
connect(r3, &Resolver::resolve, [this, missionName]()
|
||||
{
|
||||
ERROR_LOG() << "################ mission done" << missionName << " " << this << " ";
|
||||
ERROR_LOG(m_logger) << "################ mission done" << missionName << " " << this << " ";
|
||||
|
||||
|
||||
|
||||
@@ -395,7 +394,7 @@ void UAVCommanderImpl::sendMission(double lat, double lon, double alt, const QSt
|
||||
|
||||
});
|
||||
sendCommand(r3, {QStringLiteral("wait for mission to end (Loiter)"), MissionCtrl::Task::Loiter, nullptr}, -1);
|
||||
ERROR_LOG() << "################ successfully started mission :)";
|
||||
ERROR_LOG(m_logger) << "################ successfully started mission :)";
|
||||
});
|
||||
sendCommand(r2, { QStringLiteral("mission:observe"), MissionCtrl::Task::Observe, [this, lat, lon, alt, missionName]() { _sendMission(lat, lon, alt, missionName); } });
|
||||
});
|
||||
@@ -419,18 +418,18 @@ void UAVCommanderImpl::_abortMission(const QString &missionName)
|
||||
|
||||
void UAVCommanderImpl::_sendMission(double lat, double lon, double alt, const QString &missionName)
|
||||
{
|
||||
ERROR_LOG() << "lat = " << lat << ", lon = " << lon << ", alt = " << alt << ", missionName = " << missionName;
|
||||
ERROR_LOG(m_logger) << "lat = " << lat << ", lon = " << lon << ", alt = " << alt << ", missionName = " << missionName;
|
||||
|
||||
M_Common::EllipsoidalPositionType pos;
|
||||
|
||||
if (alt <= 0.1)
|
||||
{
|
||||
ERROR_LOG() << "alt very low (<= 0.1) !";
|
||||
ERROR_LOG(m_logger) << "alt very low (<= 0.1) !";
|
||||
}
|
||||
|
||||
pos.Latitude = lat / LtsCoordTrans::deg2rad();
|
||||
pos.Longitude = lon / LtsCoordTrans::deg2rad();
|
||||
ERROR_LOG() << "DEG lat = " << pos.Latitude << ", lon = " << pos.Longitude << ", alt = " << alt << ", missionName = " << missionName;
|
||||
ERROR_LOG(m_logger) << "DEG lat = " << pos.Latitude << ", lon = " << pos.Longitude << ", alt = " << alt << ", missionName = " << missionName;
|
||||
|
||||
pos.Altitude.push_back(alt);
|
||||
|
||||
@@ -447,8 +446,8 @@ void UAVCommanderImpl::_sendMission(double lat, double lon, double alt, const QS
|
||||
void UAVCommanderImpl::returnToHome()
|
||||
{
|
||||
Resolver *r = new Resolver(this);
|
||||
connect(r, &Resolver::reject, this, [this](const QString &error) { ERROR_LOG() << "returnToHome failed: " << error; });
|
||||
connect(r, &Resolver::resolve, this, [this]() { ERROR_LOG() << "returnToHome done :)"; });
|
||||
connect(r, &Resolver::reject, this, [this](const QString &error) { ERROR_LOG(m_logger) << "returnToHome failed: " << error; });
|
||||
connect(r, &Resolver::resolve, this, [this]() { ERROR_LOG(m_logger) << "returnToHome done :)"; });
|
||||
sendCommand(r, { QStringLiteral("return"), MissionCtrl::Task::Return, [this]() { _returnToHome(); } }, -1 );
|
||||
}
|
||||
|
||||
@@ -467,12 +466,12 @@ void UAVCommanderImpl::sendCommand(Resolver *resolver, const Command &cmd, int t
|
||||
|
||||
if (m_tried != 0)
|
||||
{
|
||||
ERROR_LOG() << commandName << ": another request already running - replacing ("<<m_tried__ACTIVE<<")";
|
||||
ERROR_LOG(m_logger) << commandName << ": another request already running - replacing ("<<m_tried__ACTIVE<<")";
|
||||
}
|
||||
|
||||
if (m_MissionCtrl.currentTask == type)
|
||||
{
|
||||
ERROR_LOG() << commandName << ": current task already matches new task '"<< commandName <<"' - replacing anyways";
|
||||
ERROR_LOG(m_logger) << commandName << ": current task already matches new task '"<< commandName <<"' - replacing anyways";
|
||||
}
|
||||
|
||||
if (m_currentResolver)
|
||||
@@ -481,7 +480,7 @@ void UAVCommanderImpl::sendCommand(Resolver *resolver, const Command &cmd, int t
|
||||
}
|
||||
m_currentResolver = resolver;
|
||||
|
||||
ERROR_LOG() << commandName << ": sending '" << commandName <<"' command ...";
|
||||
ERROR_LOG(m_logger) << commandName << ": sending '" << commandName <<"' command ...";
|
||||
m_tried = 1;
|
||||
m_tried__ACTIVE = cmd.name;
|
||||
|
||||
@@ -494,14 +493,14 @@ void UAVCommanderImpl::sendCommand(Resolver *resolver, const Command &cmd, int t
|
||||
{
|
||||
if (commandFn)
|
||||
{
|
||||
ERROR_LOG() << commandName << ": sending '"<< commandName <<"' command failed - timeout, trying again !";
|
||||
ERROR_LOG(m_logger) << commandName << ": sending '"<< commandName <<"' command failed - timeout, trying again !";
|
||||
try
|
||||
{
|
||||
commandFn();
|
||||
}
|
||||
catch(const std::exception &ex)
|
||||
{
|
||||
ERROR_LOG() << commandName << ": sending '"<< commandName <<"' command failed:" << ex.what();
|
||||
ERROR_LOG(m_logger) << commandName << ": sending '"<< commandName <<"' command failed:" << ex.what();
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -521,7 +520,7 @@ void UAVCommanderImpl::sendCommand(Resolver *resolver, const Command &cmd, int t
|
||||
{
|
||||
timeout->stop();
|
||||
guard->deleteLater();
|
||||
ERROR_LOG() << commandName << ": sending '"<< commandName <<"' command failed - max tries reached, giving up !";
|
||||
ERROR_LOG(m_logger) << commandName << ": sending '"<< commandName <<"' command failed - max tries reached, giving up !";
|
||||
m_tried = 0;
|
||||
m_currentResolver.clear();
|
||||
emit resolver->reject(QStringLiteral("Sending %1 command timed out!").arg(commandName));
|
||||
@@ -540,7 +539,7 @@ void UAVCommanderImpl::sendCommand(Resolver *resolver, const Command &cmd, int t
|
||||
connect(reader->readerSignal(), &ReaderSignal::dataReady,
|
||||
this, [this, reader, guard, timeout, commandName, type, resolver]()
|
||||
{
|
||||
ERROR_LOG() << commandName << ": reader signal for '"<< commandName <<"' !";
|
||||
ERROR_LOG(m_logger) << commandName << ": reader signal for '"<< commandName <<"' !";
|
||||
|
||||
while(true)
|
||||
{
|
||||
@@ -548,14 +547,14 @@ void UAVCommanderImpl::sendCommand(Resolver *resolver, const Command &cmd, int t
|
||||
{
|
||||
const auto msg = reader->getNext();
|
||||
|
||||
ERROR_LOG() << "########## READER SIGNAL (should: " << (int)type << ", is: " << (int)msg.currentTask << ")";
|
||||
ERROR_LOG(m_logger) << "########## READER SIGNAL (should: " << (int)type << ", is: " << (int)msg.currentTask << ")";
|
||||
|
||||
if (msg.currentTask == type
|
||||
|
||||
|| (type == MissionCtrl::Task::Takeoff && msg.currentTask == MissionCtrl::Task::Connect)
|
||||
|| (type == MissionCtrl::Task::Return && (msg.currentTask == MissionCtrl::Task::Disarm || msg.currentTask == MissionCtrl::Task::Land)))
|
||||
{
|
||||
ERROR_LOG() << commandName << ": successfully set new task '"<< commandName <<"' !";
|
||||
ERROR_LOG(m_logger) << commandName << ": successfully set new task '"<< commandName <<"' !";
|
||||
|
||||
|
||||
QTimer *x = new QTimer(guard);
|
||||
@@ -565,7 +564,7 @@ void UAVCommanderImpl::sendCommand(Resolver *resolver, const Command &cmd, int t
|
||||
connect(guard, &QObject::destroyed, x, &QTimer::stop);
|
||||
connect(x, &QTimer::timeout, this, [this, timeout, guard, resolver]()
|
||||
{
|
||||
ERROR_LOG() << "############# RESOLVE AFTER 1s";
|
||||
ERROR_LOG(m_logger) << "############# RESOLVE AFTER 1s";
|
||||
|
||||
m_tried = 0;
|
||||
if (timeout != nullptr)
|
||||
@@ -588,7 +587,7 @@ void UAVCommanderImpl::sendCommand(Resolver *resolver, const Command &cmd, int t
|
||||
}
|
||||
}
|
||||
|
||||
ERROR_LOG() << commandName << ": command '"<< commandName <<"' not accepted (yet)";
|
||||
ERROR_LOG(m_logger) << commandName << ": command '"<< commandName <<"' not accepted (yet)";
|
||||
|
||||
|
||||
});
|
||||
@@ -642,7 +641,7 @@ void UAVCommanderImpl::sendTryReclaimAutoMode()
|
||||
}
|
||||
catch(const std::exception &ex)
|
||||
{
|
||||
ERROR_LOG() << "Failed to send DeviceMode:" << ex.what();
|
||||
ERROR_LOG(m_logger) << "Failed to send DeviceMode:" << ex.what();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -669,25 +668,25 @@ CreateInterfaceAdapterInstance::CreateInterfaceAdapterInstance(int uasId, const
|
||||
connect(m_reader.readerSignal(), &ReaderSignal::dataReady,
|
||||
this, [this, uasId]()
|
||||
{
|
||||
ERROR_LOG() << "readerSignal for uasId" << m_uasId;
|
||||
ERROR_LOG(m_logger) << "readerSignal for uasId" << m_uasId;
|
||||
|
||||
const auto msgs = readAll<ObjectManager::ReportPoint::Message>(m_reader);
|
||||
ERROR_LOG() << "msgs.size" << msgs.size() << m_uasId;
|
||||
ERROR_LOG(m_logger) << "msgs.size" << msgs.size() << m_uasId;
|
||||
|
||||
for (const auto &msg : msgs)
|
||||
{
|
||||
ERROR_LOG() << "msg uas" << msg.uasId << "removed" << msg.isRemoved;
|
||||
ERROR_LOG(m_logger) << "msg uas" << msg.uasId << "removed" << msg.isRemoved;
|
||||
if (msg.uasId == uasId && !msg.isRemoved)
|
||||
{
|
||||
|
||||
ERROR_LOG() << "DONE!!";
|
||||
ERROR_LOG(m_logger) << "DONE!!";
|
||||
m_timeout->stop();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
ERROR_LOG() << "no ia instance for"<<m_uasId<<"found !! starting timeout";
|
||||
ERROR_LOG(m_logger) << "no ia instance for"<<m_uasId<<"found !! starting timeout";
|
||||
if (!m_timeout->isActive())
|
||||
{
|
||||
m_timeout->start();
|
||||
@@ -706,7 +705,7 @@ CreateInterfaceAdapterInstance::CreateInterfaceAdapterInstance(int uasId, const
|
||||
|
||||
void CreateInterfaceAdapterInstance::onStart()
|
||||
{
|
||||
ERROR_LOG() << " -- CreateInterfaceAdapterInstance -- ::onStart() CmdAddUpdatePoint" << m_uasId<<" ip: "<<m_ip<<" use TCP ? "<<m_useTcp;
|
||||
ERROR_LOG(m_logger) << " -- CreateInterfaceAdapterInstance -- ::onStart() CmdAddUpdatePoint" << m_uasId<<" ip: "<<m_ip<<" use TCP ? "<<m_useTcp;
|
||||
|
||||
M_ObjectManager::PointObjectType pot;
|
||||
pot.AdditionalInfo.push_back({ "IP", m_ip, {}, {}, M_Common::PropertyAccessKind::Type::Undefined });
|
||||
@@ -720,7 +719,7 @@ void CreateInterfaceAdapterInstance::onStart()
|
||||
}
|
||||
catch (const std::exception &ex)
|
||||
{
|
||||
ERROR_LOG() << "CmdAddUpdatePoint FAILED!" << m_uasId << ":" << ex.what();
|
||||
ERROR_LOG(m_logger) << "CmdAddUpdatePoint FAILED!" << m_uasId << ":" << ex.what();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -742,18 +741,18 @@ KillInterfaceAdapterInstanceAsync::KillInterfaceAdapterInstanceAsync(int uasId)
|
||||
return;
|
||||
}
|
||||
|
||||
ERROR_LOG() << "readerSignal for uasId" << m_uasId;
|
||||
ERROR_LOG(m_logger) << "readerSignal for uasId" << m_uasId;
|
||||
|
||||
const auto msgs = readAll<ObjectManager::ReportPoint::Message>(m_reader);
|
||||
ERROR_LOG() << "msgs.size" << msgs.size() << m_uasId;
|
||||
ERROR_LOG(m_logger) << "msgs.size" << msgs.size() << m_uasId;
|
||||
|
||||
for (const auto &msg : msgs)
|
||||
{
|
||||
ERROR_LOG() << "msg uas" << msg.uasId << "removed" << msg.isRemoved;
|
||||
ERROR_LOG(m_logger) << "msg uas" << msg.uasId << "removed" << msg.isRemoved;
|
||||
if (msg.uasId == uasId && msg.isRemoved)
|
||||
{
|
||||
|
||||
ERROR_LOG() << "DONE!!";
|
||||
ERROR_LOG(m_logger) << "DONE!!";
|
||||
m_done = true;
|
||||
deleteLater();
|
||||
return;
|
||||
@@ -778,7 +777,7 @@ void KillInterfaceAdapterInstanceAsync::onStop()
|
||||
}
|
||||
catch (const std::exception &ex)
|
||||
{
|
||||
ERROR_LOG() << "CmdRemove" << m_uasId << ":" << ex.what();
|
||||
ERROR_LOG(m_logger) << "CmdRemove" << m_uasId << ":" << ex.what();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+2
@@ -48,6 +48,8 @@ private slots:
|
||||
void onStart();
|
||||
|
||||
private:
|
||||
|
||||
NGL::INGLLogger &m_logger;
|
||||
mutable CommunicationMaster<M_ObjectManager::Client, ObjectManager::ReportPoint::Dispatcher> m_master;
|
||||
Reader<ObjectManager::ReportPoint::Message> m_reader;
|
||||
M_ObjectManager::Client m_writer;
|
||||
|
||||
+9
-9
@@ -115,12 +115,12 @@ bool FromTab::txData(const TrainingAreaBase::TetraIcd::Init &data)
|
||||
bool FromTab::txData(const TrainingAreaBase::TetraIcd::UAVPerformMission &data)
|
||||
{
|
||||
const int eqId = data.header.equipmentNumber;
|
||||
DEBUG_LOG() << "eqId: " << eqId;
|
||||
DEBUG_LOG(m_logger) << "eqId: " << eqId;
|
||||
const ParticipantManagement::Participant p = m_dtcPpm->participant(m_dtcPpm->participantIdByEquipmentNumber(eqId));
|
||||
|
||||
if (p.id() <= 0)
|
||||
{
|
||||
WARNING_LOG() << "participant not found - stop";
|
||||
WARNING_LOG(m_logger) << "participant not found - stop";
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -130,7 +130,7 @@ bool FromTab::txData(const TrainingAreaBase::TetraIcd::UAVPerformMission &data)
|
||||
|
||||
if (!m_uavIAManager->waypoint(p.id(), action.absPosition, QStringLiteral("%1_%2").arg(data.missionId).arg(data.missionName)))
|
||||
{
|
||||
WARNING_LOG() << "sending waypoint failed!";
|
||||
WARNING_LOG(m_logger) << "sending waypoint failed!";
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -145,7 +145,7 @@ bool FromTab::txData(const TrainingAreaBase::TetraIcd::UAVChangeState &data)
|
||||
|
||||
if (p.id() <= 0)
|
||||
{
|
||||
WARNING_LOG() << "participant not found - stop";
|
||||
WARNING_LOG(m_logger) << "participant not found - stop";
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -167,23 +167,23 @@ bool FromTab::txData(const TrainingAreaBase::TetraIcd::CesHitRequest &data)
|
||||
{
|
||||
|
||||
|
||||
DEBUG_LOG() << "data.chargeTasCodeDirect = " << data.chargeTasCodeDirect;
|
||||
DEBUG_LOG(m_logger) << "data.chargeTasCodeDirect = " << data.chargeTasCodeDirect;
|
||||
|
||||
|
||||
if (!m_dtcPdm->isJamming(data.chargeTasCodeDirect,0,0))
|
||||
{
|
||||
WARNING_LOG() << "not jamming";
|
||||
WARNING_LOG(m_logger) << "not jamming";
|
||||
return false;
|
||||
}
|
||||
|
||||
DEBUG_LOG() << "participantEventChanged: JAMMING! chargetasCodeDirect = " << data.chargeTasCodeDirect;
|
||||
DEBUG_LOG(m_logger) << "participantEventChanged: JAMMING! chargetasCodeDirect = " << data.chargeTasCodeDirect;
|
||||
|
||||
const int eqId = data.header.equipmentNumber;
|
||||
const ParticipantManagement::Participant p = m_dtcPpm->participant(m_dtcPpm->participantIdByEquipmentNumber(eqId));
|
||||
|
||||
if (p.id() <= 0)
|
||||
{
|
||||
WARNING_LOG() << "participant not found - stop";
|
||||
WARNING_LOG(m_logger) << "participant not found - stop";
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -196,7 +196,7 @@ bool FromTab::txData(const TrainingAreaBase::TetraIcd::CesHitRequest &data)
|
||||
msg.vulnerabilityState = TrainingAreaBase::TetraIcd::VulnerabilityState::CatastrophicKill;
|
||||
msg.originatorId = data.originatorEquipmentNumber;
|
||||
|
||||
DEBUG_LOG() << "sending state change direct (kill) with jamming for eqId " << msg.header.equipmentNumber;
|
||||
DEBUG_LOG(m_logger) << "sending state change direct (kill) with jamming for eqId " << msg.header.equipmentNumber;
|
||||
|
||||
m_sendToDds->rxData(msg);
|
||||
|
||||
|
||||
@@ -84,6 +84,7 @@ Q_SIGNALS:
|
||||
void outgoingMessage(const QByteArray &msg);
|
||||
|
||||
protected:
|
||||
NGL::INGLLogger &m_logger;
|
||||
bool m_isConnected;
|
||||
std::shared_ptr<ProjectDataManagement::Interface::Dtc> m_dtcPdm;
|
||||
std::shared_ptr<ParticipantManagement::Interface::Dtc> m_dtcPpm;
|
||||
|
||||
+5
-6
@@ -23,9 +23,8 @@
|
||||
|
||||
namespace UAS
|
||||
{
|
||||
TmsIfModuleHandle::TmsIfModuleHandle()
|
||||
: m_handle(ModuleLoader::load(QString(QCoreApplication::applicationDirPath() + QStringLiteral("/../lib/")).toStdString()))
|
||||
{}
|
||||
TmsIfModuleHandle::TmsIfModuleHandle() : m_handle(ModuleLoader::load(QString(QCoreApplication::applicationDirPath() + QStringLiteral("/../lib/")).toStdString())),
|
||||
m_logger(NGL::NGLLoggerBootstrap::getLogger()) {}
|
||||
|
||||
|
||||
TmsIfModuleHandle::~TmsIfModuleHandle()
|
||||
@@ -55,11 +54,11 @@ PluginInstance::PluginInstance(TrainingAreaBase::Plugin::DataProvider *dataProvi
|
||||
, m_uavIAManager(new UAVInterfaceAdapterManager(m_ddsHandler, m_sendToDds, m_tmsIfAdapter, m_exerciseId, this))
|
||||
, m_fromTab(new FromTab(ddsHandler, m_sendToDds, m_uavIAManager, m_exerciseId))
|
||||
{
|
||||
DEBUG_LOG() << "UAS PluginInstance running!";
|
||||
DEBUG_LOG(m_logger) << "UAS PluginInstance running!";
|
||||
|
||||
if (!m_dtcPdm)
|
||||
{
|
||||
WARNING_LOG() << "m_dtcPdm failed";
|
||||
WARNING_LOG(m_logger) << "m_dtcPdm failed";
|
||||
throw std::runtime_error("m_dtcPdm failed");
|
||||
}
|
||||
m_dtcPdm->enableChargeType();
|
||||
@@ -68,7 +67,7 @@ PluginInstance::PluginInstance(TrainingAreaBase::Plugin::DataProvider *dataProvi
|
||||
|
||||
if (!m_dtcPpm)
|
||||
{
|
||||
WARNING_LOG() << "m_dtcPpm failed";
|
||||
WARNING_LOG(m_logger) << "m_dtcPpm failed";
|
||||
throw std::runtime_error("m_dtcPpm failed");
|
||||
}
|
||||
m_dtcPpm->enableParticipant();
|
||||
|
||||
+2
@@ -37,6 +37,8 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
NGL::INGLLogger &m_logger;
|
||||
void *m_handle { nullptr };
|
||||
};
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ UAVInterfaceAdapter::UAVInterfaceAdapter(UAVInterfaceAdapterConfig uavConfig, UA
|
||||
|
||||
UAVInterfaceAdapter::~UAVInterfaceAdapter()
|
||||
{
|
||||
DEBUG_LOG() << "terminating IA for UAV - " << (quintptr)this;
|
||||
DEBUG_LOG(m_logger) << "terminating IA for UAV - " << (quintptr)this;
|
||||
delete m_commander;
|
||||
}
|
||||
}
|
||||
@@ -57,6 +57,8 @@ public:
|
||||
UAVCommander &commander() { return *m_commander; }
|
||||
|
||||
private:
|
||||
|
||||
NGL::INGLLogger &m_logger;
|
||||
UAVInterfaceAdapterConfig m_config;
|
||||
UAVCommander *m_commander;
|
||||
};
|
||||
|
||||
+42
-43
@@ -25,19 +25,18 @@ const int UAVInterfaceAdapterManager::s_domainId = 4;
|
||||
|
||||
UAVInterfaceAdapterManager::UAVInterfaceAdapterManager(const std::shared_ptr<TrainingAreaBase::DdsHandler> &ddsHandler,
|
||||
const std::shared_ptr<TrainingAreaBase::RecvFromTab> &sendToDds,
|
||||
TmsIfAdapter &tmsIfAdapter, int exerciseId, QObject *parent)
|
||||
: QObject(parent)
|
||||
TmsIfAdapter &tmsIfAdapter, int exerciseId, QObject *parent) : QObject(parent)
|
||||
, m_exerciseId(exerciseId)
|
||||
, m_dtcPpm(ParticipantManagement::Interface::Dtc::create(ddsHandler->ddsConnector()))
|
||||
, m_ftcPpm(ParticipantManagement::Interface::Ftc::create(ddsHandler->ddsConnector()))
|
||||
, m_tmsIfAdapter(tmsIfAdapter)
|
||||
, m_sendToDds(sendToDds)
|
||||
{}
|
||||
, m_sendToDds(sendToDds),
|
||||
m_logger(NGL::NGLLoggerBootstrap::getLogger()) {}
|
||||
|
||||
|
||||
void UAVInterfaceAdapterManager::init()
|
||||
{
|
||||
DEBUG_LOG() << "UAVInterfaceAdapterManager starting for ex " << m_exerciseId;
|
||||
DEBUG_LOG(m_logger) << "UAVInterfaceAdapterManager starting for ex " << m_exerciseId;
|
||||
|
||||
m_dtcPpm->waitForHistoricalDataDynamicParticipantData(3000);
|
||||
m_dtcPpm->waitForHistoricalDataParticipant(3000);
|
||||
@@ -80,7 +79,7 @@ void UAVInterfaceAdapterManager::init()
|
||||
m_dtcPpm->enableUAS();
|
||||
}
|
||||
|
||||
DEBUG_LOG() << "done";
|
||||
DEBUG_LOG(m_logger) << "done";
|
||||
}
|
||||
|
||||
|
||||
@@ -95,21 +94,21 @@ void UAVInterfaceAdapterManager::removed(const ParticipantManagement::UAS &uas)
|
||||
|
||||
if (m_uavs.find(uas.id()) != m_uavs.cend())
|
||||
{
|
||||
WARNING_LOG() << "tried removing participant " << uas.id() << " that doesn't exist";
|
||||
WARNING_LOG(m_logger) << "tried removing participant " << uas.id() << " that doesn't exist";
|
||||
return;
|
||||
}
|
||||
DEBUG_LOG() << "UAV with uas id " << uas.id() << " found! removing.....";
|
||||
DEBUG_LOG(m_logger) << "UAV with uas id " << uas.id() << " found! removing.....";
|
||||
stop(uas);
|
||||
}
|
||||
|
||||
|
||||
void UAVInterfaceAdapterManager::modified(const ParticipantManagement::UAS &uas)
|
||||
{
|
||||
DEBUG_LOG() << "modify uas " << uas.id();
|
||||
DEBUG_LOG(m_logger) << "modify uas " << uas.id();
|
||||
|
||||
if (uas.participantId() <= 0)
|
||||
{
|
||||
WARNING_LOG() << "UAV with uas id " << uas.id() << " not a UAV anymore - removing";
|
||||
WARNING_LOG(m_logger) << "UAV with uas id " << uas.id() << " not a UAV anymore - removing";
|
||||
stop(uas);
|
||||
return;
|
||||
}
|
||||
@@ -121,14 +120,14 @@ void UAVInterfaceAdapterManager::modified(const ParticipantManagement::UAS &uas)
|
||||
const auto i = m_uavs.find(uasId);
|
||||
if (i == m_uavs.cend())
|
||||
{
|
||||
WARNING_LOG() << "UAV with uas id " << uas.id() << " was modified but now found in our list - feeding it as 'added' instead as a bail-out";
|
||||
WARNING_LOG(m_logger) << "UAV with uas id " << uas.id() << " was modified but now found in our list - feeding it as 'added' instead as a bail-out";
|
||||
added(uas);
|
||||
return;
|
||||
}
|
||||
|
||||
const UAVInterfaceAdapter &uav2 = *i->second;
|
||||
|
||||
DEBUG_LOG() << "UAV with uas id " << uas.id() << " found";
|
||||
DEBUG_LOG(m_logger) << "UAV with uas id " << uas.id() << " found";
|
||||
|
||||
try
|
||||
{
|
||||
@@ -136,7 +135,7 @@ void UAVInterfaceAdapterManager::modified(const ParticipantManagement::UAS &uas)
|
||||
|
||||
if (uav2.config() == config)
|
||||
{
|
||||
DEBUG_LOG() << "UAV with uas id " << uas.id() << " already running and config has not changed - doing nothing (irrelevant data has changed)";
|
||||
DEBUG_LOG(m_logger) << "UAV with uas id " << uas.id() << " already running and config has not changed - doing nothing (irrelevant data has changed)";
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -149,14 +148,14 @@ void UAVInterfaceAdapterManager::modified(const ParticipantManagement::UAS &uas)
|
||||
}
|
||||
catch(const std::exception &ex)
|
||||
{
|
||||
WARNING_LOG() << "Failed to modify UAV: " << ex.what();
|
||||
WARNING_LOG(m_logger) << "Failed to modify UAV: " << ex.what();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void UAVInterfaceAdapterManager::added(const ParticipantManagement::UAS &uas)
|
||||
{
|
||||
DEBUG_LOG() << "exId: " << m_exerciseId << ", uas: " << uas.id() << ", participantId: " << uas.participantId()<<" ## use tcp ? "<<uas.useTcp();
|
||||
DEBUG_LOG(m_logger) << "exId: " << m_exerciseId << ", uas: " << uas.id() << ", participantId: " << uas.participantId()<<" ## use tcp ? "<<uas.useTcp();
|
||||
|
||||
const auto participant = m_dtcPpm->participant(uas.participantId());
|
||||
|
||||
@@ -170,17 +169,17 @@ void UAVInterfaceAdapterManager::added(const ParticipantManagement::UAS &uas)
|
||||
return;
|
||||
}
|
||||
|
||||
DEBUG_LOG() << "added uav with id " << uas.id() << " for pId " << uas.participantId();
|
||||
DEBUG_LOG(m_logger) << "added uav with id " << uas.id() << " for pId " << uas.participantId();
|
||||
|
||||
if (m_uavs.find(uas.id()) != m_uavs.cend())
|
||||
{
|
||||
|
||||
DEBUG_LOG() << "participant " << uas.id() << " already started - doing nothing";
|
||||
DEBUG_LOG(m_logger) << "participant " << uas.id() << " already started - doing nothing";
|
||||
return;
|
||||
}
|
||||
|
||||
DEBUG_LOG() << "############# ALLES OKAY uas: " << uas.id() << " - pId: " << uas.participantId();
|
||||
DEBUG_LOG() << "UAV with uas id " << uas.id() << " found";
|
||||
DEBUG_LOG(m_logger) << "############# ALLES OKAY uas: " << uas.id() << " - pId: " << uas.participantId();
|
||||
DEBUG_LOG(m_logger) << "UAV with uas id " << uas.id() << " found";
|
||||
|
||||
try
|
||||
{
|
||||
@@ -189,7 +188,7 @@ void UAVInterfaceAdapterManager::added(const ParticipantManagement::UAS &uas)
|
||||
}
|
||||
catch (const std::exception &ex)
|
||||
{
|
||||
WARNING_LOG() << "Failed to start uav ia: " << ex.what();
|
||||
WARNING_LOG(m_logger) << "Failed to start uav ia: " << ex.what();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -212,7 +211,7 @@ void UAVInterfaceAdapterManager::start(const ParticipantManagement::UAS &uas, UA
|
||||
const int droneDomainId = s_domainId;
|
||||
const bool useTcp = uas.useTcp();
|
||||
|
||||
DEBUG_LOG() << "starting IA for eqId = " << droneEqId << ", pid = " << droneParticipantId << ", domain = " << droneDomainId << ", uasId = " << uasId<<" // ** useTcp: "<<uas.useTcp();
|
||||
DEBUG_LOG(m_logger) << "starting IA for eqId = " << droneEqId << ", pid = " << droneParticipantId << ", domain = " << droneDomainId << ", uasId = " << uasId<<" // ** useTcp: "<<uas.useTcp();
|
||||
|
||||
auto *uav = m_tmsIfAdapter.createUAV(droneDomainId, uasId);
|
||||
|
||||
@@ -221,13 +220,13 @@ void UAVInterfaceAdapterManager::start(const ParticipantManagement::UAS &uas, UA
|
||||
|
||||
const auto fn = [this, droneDomainId, droneParticipantId, droneEqId, useTcp]()
|
||||
{
|
||||
DEBUG_LOG() << "UAV " << droneDomainId << " / " << droneParticipantId <<" / use TCP ? "<<useTcp<< " ready !!";
|
||||
DEBUG_LOG(m_logger) << "UAV " << droneDomainId << " / " << droneParticipantId <<" / use TCP ? "<<useTcp<< " ready !!";
|
||||
|
||||
const auto pdata = m_dtcPpm->dynamicParticipantData(droneParticipantId);
|
||||
|
||||
if (pdata.participantId() < 1 || pdata.stateHistory().empty())
|
||||
{
|
||||
DEBUG_LOG() << "pdata or state history for pid " << droneParticipantId << " is empty - sending init";
|
||||
DEBUG_LOG(m_logger) << "pdata or state history for pid " << droneParticipantId << " is empty - sending init";
|
||||
|
||||
TrainingAreaBase::TetraIcd::StateChange msg;
|
||||
msg.header.equipmentNumber = droneEqId;
|
||||
@@ -240,11 +239,11 @@ void UAVInterfaceAdapterManager::start(const ParticipantManagement::UAS &uas, UA
|
||||
|
||||
m_sendToDds->rxData(msg);
|
||||
|
||||
DEBUG_LOG() << "sent combat ready for " << droneParticipantId << " - done";
|
||||
DEBUG_LOG(m_logger) << "sent combat ready for " << droneParticipantId << " - done";
|
||||
}
|
||||
else
|
||||
{
|
||||
WARNING_LOG() << "state history for pid " << droneParticipantId << " not empty - nothing to do";
|
||||
WARNING_LOG(m_logger) << "state history for pid " << droneParticipantId << " not empty - nothing to do";
|
||||
}
|
||||
};
|
||||
uav->set_isReady_Callback(fn);
|
||||
@@ -259,7 +258,7 @@ void UAVInterfaceAdapterManager::start(const ParticipantManagement::UAS &uas, UA
|
||||
msg.header.timeStamp = QDateTime::currentMSecsSinceEpoch();
|
||||
msg.geoPosition = { data.lon * LtsCoordTrans::deg2rad(), data.lat * LtsCoordTrans::deg2rad(), data.alt };
|
||||
|
||||
DEBUG_LOG() << "POSITION! sending PositionReport into TAB";
|
||||
DEBUG_LOG(m_logger) << "POSITION! sending PositionReport into TAB";
|
||||
|
||||
m_sendToDds->rxData(msg);
|
||||
});
|
||||
@@ -317,19 +316,19 @@ void UAVInterfaceAdapterManager::start(const ParticipantManagement::UAS &uas, UA
|
||||
}
|
||||
|
||||
m_sendToDds->rxData(msg);
|
||||
DEBUG_LOG() << "RadioLinkConnectionState! sending RadioLinkConnectionState into TAB";
|
||||
DEBUG_LOG(m_logger) << "RadioLinkConnectionState! sending RadioLinkConnectionState into TAB";
|
||||
});
|
||||
|
||||
|
||||
uav->set_ReportRadioLinkConnectionState_Callback([this, droneEqId](const TeleOperation::RadioLinkConnectionState::Message &data)
|
||||
{
|
||||
DEBUG_LOG() << "COULD! send RadioLinkConnectionState! sending RadioLinkConnectionState into TAB << " << droneEqId << " " << data.status;
|
||||
DEBUG_LOG(m_logger) << "COULD! send RadioLinkConnectionState! sending RadioLinkConnectionState into TAB << " << droneEqId << " " << data.status;
|
||||
});
|
||||
|
||||
|
||||
uav->set_ReportMissionStatus_Callback([this, droneEqId](const MissionCtrl::ReportMissionStatus::Message &data)
|
||||
{
|
||||
DEBUG_LOG() << "ReportMissionStatus! sending ReportMissionStatus into TAB << " << droneEqId << " - currentTask = " << (int)data.currentTask << ", currentMission = " << data.currentMissionName;
|
||||
DEBUG_LOG(m_logger) << "ReportMissionStatus! sending ReportMissionStatus into TAB << " << droneEqId << " - currentTask = " << (int)data.currentTask << ", currentMission = " << data.currentMissionName;
|
||||
|
||||
TrainingAreaBase::TetraIcd::UAVMissionStatus msg;
|
||||
msg.header.equipmentNumber = droneEqId;
|
||||
@@ -345,7 +344,7 @@ void UAVInterfaceAdapterManager::start(const ParticipantManagement::UAS &uas, UA
|
||||
case MissionCtrl::Task::Connect: msg.currentAction = TrainingAreaBase::TetraIcd::UAVActionTask::Connect; break;
|
||||
case MissionCtrl::Task::Loiter: msg.currentAction = TrainingAreaBase::TetraIcd::UAVActionTask::Loiter; break;
|
||||
case MissionCtrl::Task::Return: msg.currentAction = TrainingAreaBase::TetraIcd::UAVActionTask::Return;
|
||||
DEBUG_LOG() << "Return";
|
||||
DEBUG_LOG(m_logger) << "Return";
|
||||
setMissionActionFulfilled(droneEqId);
|
||||
break;
|
||||
case MissionCtrl::Task::Observe: msg.currentAction = TrainingAreaBase::TetraIcd::UAVActionTask::Observe; break;
|
||||
@@ -358,23 +357,23 @@ void UAVInterfaceAdapterManager::start(const ParticipantManagement::UAS &uas, UA
|
||||
|
||||
uav->startIA(config.m_ip.toStdString(), config.m_port, config.m_useTcp);
|
||||
|
||||
DEBUG_LOG() << "DONE STARTING UAV!";
|
||||
DEBUG_LOG(m_logger) << "DONE STARTING UAV!";
|
||||
}
|
||||
catch (const std::exception &ex)
|
||||
{
|
||||
|
||||
WARNING_LOG() << "Failed to start UAV: " << ex.what();
|
||||
WARNING_LOG(m_logger) << "Failed to start UAV: " << ex.what();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void UAVInterfaceAdapterManager::stop(const ParticipantManagement::UAS &uas)
|
||||
{
|
||||
DEBUG_LOG() << "############################### STOP !! " << uas.id();
|
||||
DEBUG_LOG(m_logger) << "############################### STOP !! " << uas.id();
|
||||
auto it = m_uavs.find(uas.id());
|
||||
if (it == m_uavs.cend())
|
||||
{
|
||||
DEBUG_LOG() << "uav not found - ignoring :/";
|
||||
DEBUG_LOG(m_logger) << "uav not found - ignoring :/";
|
||||
return;
|
||||
}
|
||||
it->second->deleteLater();
|
||||
@@ -388,7 +387,7 @@ bool UAVInterfaceAdapterManager::kill(int participantId)
|
||||
|
||||
if (uas.id() < 1)
|
||||
{
|
||||
DEBUG_LOG() << "uas by participant id " << participantId << " not found - stop";
|
||||
DEBUG_LOG(m_logger) << "uas by participant id " << participantId << " not found - stop";
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -396,7 +395,7 @@ bool UAVInterfaceAdapterManager::kill(int participantId)
|
||||
|
||||
if (i == m_uavs.cend())
|
||||
{
|
||||
DEBUG_LOG() << "uav by participant id " << participantId << " not found - stop";
|
||||
DEBUG_LOG(m_logger) << "uav by participant id " << participantId << " not found - stop";
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -413,7 +412,7 @@ bool UAVInterfaceAdapterManager::waypoint(int participantId, TrainingAreaBase::T
|
||||
|
||||
if (uas.id() < 1)
|
||||
{
|
||||
DEBUG_LOG() << "uas by participant id " << participantId << " not found - stop";
|
||||
DEBUG_LOG(m_logger) << "uas by participant id " << participantId << " not found - stop";
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -421,11 +420,11 @@ bool UAVInterfaceAdapterManager::waypoint(int participantId, TrainingAreaBase::T
|
||||
|
||||
if (i == m_uavs.cend())
|
||||
{
|
||||
DEBUG_LOG() << "uav by participant id " << participantId << " not found - stop";
|
||||
DEBUG_LOG(m_logger) << "uav by participant id " << participantId << " not found - stop";
|
||||
|
||||
for (const auto &uav : m_uavs)
|
||||
{
|
||||
DEBUG_LOG() << "pid: " << uav.first;
|
||||
DEBUG_LOG(m_logger) << "pid: " << uav.first;
|
||||
}
|
||||
|
||||
return false;
|
||||
@@ -433,7 +432,7 @@ bool UAVInterfaceAdapterManager::waypoint(int participantId, TrainingAreaBase::T
|
||||
|
||||
if (i->second == nullptr)
|
||||
{
|
||||
WARNING_LOG() << "UAVInterfaceAdapterManager::waypoint: NULLPTR for "<<participantId;
|
||||
WARNING_LOG(m_logger) << "UAVInterfaceAdapterManager::waypoint: NULLPTR for "<<participantId;
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -447,7 +446,7 @@ bool UAVInterfaceAdapterManager::waypoint(int participantId, TrainingAreaBase::T
|
||||
}
|
||||
catch (const std::exception& e)
|
||||
{
|
||||
WARNING_LOG() << "UAVInterfaceAdapterManager::waypoint: " << e.what();
|
||||
WARNING_LOG(m_logger) << "UAVInterfaceAdapterManager::waypoint: " << e.what();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -457,7 +456,7 @@ void UAVInterfaceAdapterManager::setMissionActionFulfilled(int equipmentNumber)
|
||||
{
|
||||
|
||||
|
||||
DEBUG_LOG() << "setMissionActionFulfilled equipmentId=" << equipmentNumber;
|
||||
DEBUG_LOG(m_logger) << "setMissionActionFulfilled equipmentId=" << equipmentNumber;
|
||||
|
||||
const int missionId = m_dtcPpm->uasMissionIdByEquipmentNumber(equipmentNumber);
|
||||
|
||||
@@ -472,7 +471,7 @@ void UAVInterfaceAdapterManager::setMissionActionFulfilled(int equipmentNumber)
|
||||
}
|
||||
catch (const std::exception &e)
|
||||
{
|
||||
WARNING_LOG() << " -- unable to abort mission with planId:"<<abortReq.missionId() << ": " << e.what();
|
||||
WARNING_LOG(m_logger) << " -- unable to abort mission with planId:"<<abortReq.missionId() << ": " << e.what();
|
||||
}
|
||||
|
||||
return;
|
||||
|
||||
+2
@@ -50,6 +50,8 @@ public:
|
||||
bool tryChangeModeToAuto(int participantId);
|
||||
|
||||
private:
|
||||
|
||||
NGL::INGLLogger &m_logger;
|
||||
void removed(const ParticipantManagement::UAS &uas);
|
||||
void modified(const ParticipantManagement::UAS &uas);
|
||||
void added(const ParticipantManagement::UAS &uas);
|
||||
|
||||
Reference in new issue
Block a user