From 18dc426f6ac81c91d2041b779398dfcfdcda551a Mon Sep 17 00:00:00 2001 From: pixhawk Date: Tue, 1 Jun 2010 19:01:59 +0200 Subject: [PATCH] Added GPS support --- src/uas/PxQuadMAV.cc | 3 +++ src/uas/UAS.cc | 7 ++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/uas/PxQuadMAV.cc b/src/uas/PxQuadMAV.cc index b2c8392b2..17059c30e 100644 --- a/src/uas/PxQuadMAV.cc +++ b/src/uas/PxQuadMAV.cc @@ -19,6 +19,9 @@ void PxQuadMAV::receiveMessage(LinkInterface* link, mavlink_message_t message) UAS::receiveMessage(link, message); mavlink_message_t* msg = &message; + qDebug() << "PX RECEIVED" << msg->sysid << msg->compid << msg->msgid; + + // Handle your special messages switch (msg->msgid) { diff --git a/src/uas/UAS.cc b/src/uas/UAS.cc index c8de32392..5ec3f53c3 100644 --- a/src/uas/UAS.cc +++ b/src/uas/UAS.cc @@ -117,6 +117,8 @@ void UAS::receiveMessage(LinkInterface* link, mavlink_message_t message) addLink(link); } + qDebug() << "UAS RECEIVED" << message.sysid << message.compid << message.msgid; + if (message.sysid == uasId) { QString uasState; @@ -368,13 +370,16 @@ void UAS::receiveMessage(LinkInterface* link, mavlink_message_t message) { mavlink_gps_raw_t pos; mavlink_msg_gps_raw_decode(&message, &pos); - quint64 time = getUnixTime(pos.usec); + // quint64 time = getUnixTime(pos.usec); + quint64 time = MG::TIME::getGroundTimeNow(); emit valueChanged(uasId, "lat", pos.lat, time); emit valueChanged(uasId, "lon", pos.lon, time); emit valueChanged(uasId, "alt", pos.alt, time); emit valueChanged(uasId, "g-vx", pos.vx, time); emit valueChanged(uasId, "g-vy", pos.vy, time); emit valueChanged(uasId, "g-vz", pos.vz, time); + qDebug() << "GOT GPS RAW"; + emit globalPositionChanged(this, pos.lon, pos.lat, pos.alt, time); } break; case MAVLINK_MSG_ID_PARAM_VALUE: -- 2.22.0