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;
|
||||
|
||||
Reference in new issue
Block a user