Commit adc5ee2c authored by lm's avatar lm

Added debug output for QMapControl library, added GPS_RAW_INT message

parent cb9774ec
......@@ -63,10 +63,10 @@ namespace qmapcontrol
void MapNetwork::requestFinished(int id, bool error)
{
// sleep(1);
// qDebug() << "MapNetwork::requestFinished" << http->state() << ", id: " << id;
qDebug() << "QMapControl: MapNetwork::requestFinished" << http->state() << ", id: " << id;
if (error)
{
qDebug() << "network error: " << http->errorString();
qDebug() << "QMapControl: network error: " << http->errorString();
//restart query
}
......@@ -79,7 +79,7 @@ namespace qmapcontrol
QString url = loadingMap[id];
loadingMap.remove(id);
vectorMutex.unlock();
// qDebug() << "request finished for id: " << id << ", belongs to: " << notifier.url << endl;
//qDebug() << "QMapControl: request finished for id: " << id << ", belongs to: " << notifier.url << endl;
QByteArray ax;
if (http->bytesAvailable()>0)
......@@ -87,17 +87,20 @@ namespace qmapcontrol
QPixmap pm;
ax = http->readAll();
qDebug() << "QMapControl: Request consisted of " << ax.size() << "bytes";
if (pm.loadFromData(ax))
{
loaded += pm.size().width()*pm.size().height()*pm.depth()/8/1024;
// qDebug() << "Network loaded: " << (loaded);
qDebug() << "QMapControl: Network loaded: " << (loaded);
parent->receivedImage(pm, url);
}
else if (pm.width() == 0 || pm.height() == 0)
{
// Silently ignore map request for a
// 0xn pixel map
qDebug() << "QMapControl: IGNORED 0x0 pixel map request, widthxheight:" << pm.width() << "x" << pm.height();
qDebug() << "QMapControl: HTML ERROR MESSAGE:" << ax << "at " << __FILE__ << __LINE__;
}
else
{
......@@ -105,7 +108,7 @@ namespace qmapcontrol
// TODO Error is currently undetected
//qDebug() << "NETWORK_PIXMAP_ERROR: " << ax;
qDebug() << "QMapControl external library: ERROR loading map:" << "width:" << pm.width() << "heigh:" << pm.height() << "at " << __FILE__ << __LINE__;
//qDebug() << "HTML ERROR MESSAGE:" << ax << "at " << __FILE__ << __LINE__;
qDebug() << "QMapControl: HTML ERROR MESSAGE:" << ax << "at " << __FILE__ << __LINE__;
}
}
......
......@@ -628,6 +628,46 @@ void UAS::receiveMessage(LinkInterface* link, mavlink_message_t message)
}
}
break;
case MAVLINK_MSG_ID_GPS_RAW_INT:
{
mavlink_gps_raw_int_t pos;
mavlink_msg_gps_raw_int_decode(&message, &pos);
// SANITY CHECK
// only accept values in a realistic range
// quint64 time = getUnixTime(pos.usec);
quint64 time = getUnixTime();
emit valueChanged(uasId, "latitude", "deg", pos.lat/(double)1E7, time);
emit valueChanged(uasId, "longitude", "deg", pos.lon/(double)1E7, time);
if (pos.fix_type > 0)
{
emit globalPositionChanged(this, pos.lat/(double)1E7, pos.lon/(double)1E7, pos.alt/1000.0, time);
emit valueChanged(uasId, "gps speed", "m/s", pos.v, time);
// Check for NaN
int alt = pos.alt;
if (alt != alt)
{
alt = 0;
emit textMessageReceived(uasId, message.compid, 255, "GCS ERROR: RECEIVED NaN FOR ALTITUDE");
}
emit valueChanged(uasId, "altitude", "m", pos.alt/(double)1E7, time);
// Smaller than threshold and not NaN
if (pos.v < 1000000 && pos.v == pos.v)
{
emit valueChanged(uasId, "speed", "m/s", pos.v, time);
//qDebug() << "GOT GPS RAW";
// emit speedChanged(this, (double)pos.v, 0.0, 0.0, time);
}
else
{
emit textMessageReceived(uasId, message.compid, 255, QString("GCS ERROR: RECEIVED INVALID SPEED OF %1 m/s").arg(pos.v));
}
}
}
break;
case MAVLINK_MSG_ID_GPS_STATUS:
{
mavlink_gps_status_t pos;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment