diff --git a/qgroundcontrol.pri b/qgroundcontrol.pri index d4570a155b5f18ae8603725f1f1f8823e2e63126..b745ad4e83bb09f729c8c72f2e4e6a8ff4a1cbd7 100644 --- a/qgroundcontrol.pri +++ b/qgroundcontrol.pri @@ -65,7 +65,7 @@ macx { } } else { # x64 Mac OS X Snow Leopard 10.6 and later - CONFIG += x86_64 x86 cocoa + CONFIG += x86_64 x86 cocoa phonon #CONFIG -= x86 # phonon #message(Building for Mac OS X 64bit/Snow Leopard 10.6 and later) debug { diff --git a/src/GAudioOutput.cc b/src/GAudioOutput.cc index 641f2117036019e7eeeffdad5826c1e62c4d6629..7a3b90e4cfa66e6fb8de95a9f79f193f22c96341 100644 --- a/src/GAudioOutput.cc +++ b/src/GAudioOutput.cc @@ -295,11 +295,12 @@ void GAudioOutput::beep() { if (!muted) { - // Use QFile to transform path for all OS - QFile f(QCoreApplication::applicationDirPath()+QString("/audio/alert.wav")); - m_media->setCurrentSource(Phonon::MediaSource(f.fileName().toStdString().c_str())); - m_media->play(); -} + // Use QFile to transform path for all OS + QFile f(QCoreApplication::applicationDirPath()+QString("/audio/alert.wav")); + qDebug() << "FILE:" << f.fileName(); + m_media->setCurrentSource(Phonon::MediaSource(f.fileName().toStdString().c_str())); + m_media->play(); + } } void GAudioOutput::selectFemaleVoice() diff --git a/src/comm/MAVLinkSimulationWaypointPlanner.cc b/src/comm/MAVLinkSimulationWaypointPlanner.cc index e7a0748a15b1719b1fc2b29fdda341397c67a26f..9ed1812219a912f0c73be4e108d7642155feceba 100644 --- a/src/comm/MAVLinkSimulationWaypointPlanner.cc +++ b/src/comm/MAVLinkSimulationWaypointPlanner.cc @@ -284,7 +284,7 @@ void MAVLinkSimulationWaypointPlanner::send_setpoint(uint16_t seq) PControlSetPoint.x = cur->x; PControlSetPoint.y = cur->y; PControlSetPoint.z = cur->z; - PControlSetPoint.yaw = cur->yaw; + PControlSetPoint.yaw = cur->param4; mavlink_msg_local_position_setpoint_set_encode(systemid, compid, &msg, &PControlSetPoint); link->sendMAVLinkMessage(&msg); @@ -299,7 +299,7 @@ void MAVLinkSimulationWaypointPlanner::send_setpoint(uint16_t seq) PControlSetPoint.x = cur->x; PControlSetPoint.y = cur->y; PControlSetPoint.z = cur->z; - PControlSetPoint.yaw = cur->yaw; + PControlSetPoint.yaw = cur->param4; mavlink_msg_local_position_setpoint_set_encode(systemid, compid, &msg, &PControlSetPoint); link->sendMAVLinkMessage(&msg); @@ -337,7 +337,7 @@ void MAVLinkSimulationWaypointPlanner::send_waypoint(uint8_t target_systemid, ui wp->target_system = target_systemid; wp->target_component = target_compid; - if (verbose) qDebug("Sent waypoint %u (%u / %u / %u / %u / %u / %f / %u / %f / %f / %u / %f / %f / %f / %f / %u)\n", wp->seq, wp->target_system, wp->target_component, wp->seq, wp->frame, wp->action, wp->orbit, wp->orbit_direction, wp->param1, wp->param2, wp->current, wp->x, wp->y, wp->z, wp->yaw, wp->autocontinue); + if (verbose) qDebug("Sent waypoint %u (%u / %u / %u / %u / %u / %f / %f / %f / %u / %f / %f / %f / %f / %u)\n", wp->seq, wp->target_system, wp->target_component, wp->seq, wp->frame, wp->action, wp->param3, wp->param1, wp->param2, wp->current, wp->x, wp->y, wp->z, wp->param4, wp->autocontinue); mavlink_msg_waypoint_encode(systemid, compid, &msg, wp); link->sendMAVLinkMessage(&msg); @@ -502,19 +502,19 @@ void MAVLinkSimulationWaypointPlanner::mavlink_handler (const mavlink_message_t* //compare current yaw if (att.yaw - yaw_tolerance >= 0.0f && att.yaw + yaw_tolerance < 2.f*M_PI) { - if (att.yaw - yaw_tolerance <= wp->yaw && att.yaw + yaw_tolerance >= wp->yaw) + if (att.yaw - yaw_tolerance <= wp->param4 && att.yaw + yaw_tolerance >= wp->param4) yawReached = true; } else if(att.yaw - yaw_tolerance < 0.0f) { float lowerBound = 360.0f + att.yaw - yaw_tolerance; - if (lowerBound < wp->yaw || wp->yaw < att.yaw + yaw_tolerance) + if (lowerBound < wp->param4 || wp->param4 < att.yaw + yaw_tolerance) yawReached = true; } else { float upperBound = att.yaw + yaw_tolerance - 2.f*M_PI; - if (att.yaw - yaw_tolerance < wp->yaw || wp->yaw < upperBound) + if (att.yaw - yaw_tolerance < wp->param4 || wp->param4 < upperBound) yawReached = true; } diff --git a/src/uas/PxQuadMAV.cc b/src/uas/PxQuadMAV.cc index cb78497f3641e0b6cfc85ad291129fbcc422656c..6bb0e2d73e8fad2ecf2bf8c8a1a93031377cedba 100644 --- a/src/uas/PxQuadMAV.cc +++ b/src/uas/PxQuadMAV.cc @@ -1,5 +1,4 @@ /*===================================================================== - QGroundControl Open Source Ground Control Station (c) 2009, 2010 QGROUNDCONTROL PROJECT @@ -10,15 +9,15 @@ This file is part of the QGROUNDCONTROL project it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - + QGROUNDCONTROL is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with QGROUNDCONTROL. If not, see . - + ======================================================================*/ #include "PxQuadMAV.h" @@ -39,20 +38,12 @@ PxQuadMAV::PxQuadMAV(MAVLinkProtocol* mavlink, int id) : */ void PxQuadMAV::receiveMessage(LinkInterface* link, mavlink_message_t message) { - // Let UAS handle the default message set - UAS::receiveMessage(link, message); - - //qDebug() << "PX RECEIVED" << msg->sysid << msg->compid << msg->msgid; - -// Only compile this portion if matching MAVLink packets have been compiled + // Only compile this portion if matching MAVLink packets have been compiled #ifdef MAVLINK_ENABLED_PIXHAWK mavlink_message_t* msg = &message; if (message.sysid == uasId) { -// QString uasState; -// QString stateDescription; -// QString patternPath; switch (message.msgid) { case MAVLINK_MSG_ID_RAW_AUX: @@ -88,7 +79,7 @@ void PxQuadMAV::receiveMessage(LinkInterface* link, mavlink_message_t message) emit letterDetected(uasId, name, detected.confidence, detected.detected); } break; - case MAVLINK_MSG_ID_WATCHDOG_HEARTBEAT: + case MAVLINK_MSG_ID_WATCHDOG_HEARTBEAT: { mavlink_watchdog_heartbeat_t payload; mavlink_msg_watchdog_heartbeat_decode(msg, &payload); @@ -97,7 +88,7 @@ void PxQuadMAV::receiveMessage(LinkInterface* link, mavlink_message_t message) } break; - case MAVLINK_MSG_ID_WATCHDOG_PROCESS_INFO: + case MAVLINK_MSG_ID_WATCHDOG_PROCESS_INFO: { mavlink_watchdog_process_info_t payload; mavlink_msg_watchdog_process_info_decode(msg, &payload); @@ -106,14 +97,14 @@ void PxQuadMAV::receiveMessage(LinkInterface* link, mavlink_message_t message) } break; - case MAVLINK_MSG_ID_WATCHDOG_PROCESS_STATUS: + case MAVLINK_MSG_ID_WATCHDOG_PROCESS_STATUS: { mavlink_watchdog_process_status_t payload; mavlink_msg_watchdog_process_status_decode(msg, &payload); emit processChanged(this->uasId, payload.watchdog_id, payload.process_id, payload.state, (payload.muted == 1) ? true : false, payload.crashes, payload.pid); } break; - case MAVLINK_MSG_ID_VISION_POSITION_ESTIMATE: + case MAVLINK_MSG_ID_VISION_POSITION_ESTIMATE: { mavlink_vision_position_estimate_t pos; mavlink_msg_vision_position_estimate_decode(&message, &pos); @@ -128,21 +119,21 @@ void PxQuadMAV::receiveMessage(LinkInterface* link, mavlink_message_t message) } break; case MAVLINK_MSG_ID_VICON_POSITION_ESTIMATE: - { - mavlink_vicon_position_estimate_t pos; - mavlink_msg_vicon_position_estimate_decode(&message, &pos); - quint64 time = getUnixTime(pos.usec); - //emit valueChanged(uasId, "vis. time", pos.usec, time); - emit valueChanged(uasId, "vicon roll", "rad", pos.roll, time); - emit valueChanged(uasId, "vicon pitch", "rad", pos.pitch, time); - emit valueChanged(uasId, "vicon yaw", "rad", pos.yaw, time); - emit valueChanged(uasId, "vicon x", "m", pos.x, time); - emit valueChanged(uasId, "vicon y", "m", pos.y, time); - emit valueChanged(uasId, "vicon z", "m", pos.z, time); - emit localPositionChanged(this, pos.x, pos.y, pos.z, time); - } - break; - case MAVLINK_MSG_ID_AUX_STATUS: + { + mavlink_vicon_position_estimate_t pos; + mavlink_msg_vicon_position_estimate_decode(&message, &pos); + quint64 time = getUnixTime(pos.usec); + //emit valueChanged(uasId, "vis. time", pos.usec, time); + emit valueChanged(uasId, "vicon roll", "rad", pos.roll, time); + emit valueChanged(uasId, "vicon pitch", "rad", pos.pitch, time); + emit valueChanged(uasId, "vicon yaw", "rad", pos.yaw, time); + emit valueChanged(uasId, "vicon x", "m", pos.x, time); + emit valueChanged(uasId, "vicon y", "m", pos.y, time); + emit valueChanged(uasId, "vicon z", "m", pos.z, time); + emit localPositionChanged(this, pos.x, pos.y, pos.z, time); + } + break; + case MAVLINK_MSG_ID_AUX_STATUS: { mavlink_aux_status_t status; mavlink_msg_aux_status_decode(&message, &status); @@ -155,8 +146,9 @@ void PxQuadMAV::receiveMessage(LinkInterface* link, mavlink_message_t message) emit valueChanged(uasId, "Load", "%", ((float)status.load)/1000.0f, MG::TIME::getGroundTimeNow()); } break; - default: - // Do nothing + default: + // Let UAS handle the default message set + UAS::receiveMessage(link, message); break; } } diff --git a/src/uas/UAS.cc b/src/uas/UAS.cc index 5866ca3293353e4ba6c8929ac82cf48ab71efffd..2b0dcfeff5e23c56b9ec8dff84ded2202c4c1956 100644 --- a/src/uas/UAS.cc +++ b/src/uas/UAS.cc @@ -192,9 +192,6 @@ void UAS::receiveMessage(LinkInterface* link, mavlink_message_t message) QString uasState; QString stateDescription; - // Receive named value message - receiveMessageNamedValue(message); - switch (message.msgid) { case MAVLINK_MSG_ID_HEARTBEAT: @@ -223,6 +220,11 @@ void UAS::receiveMessage(LinkInterface* link, mavlink_message_t message) emit systemTypeSet(this, type); } + break; + case MAVLINK_MSG_ID_NAMED_VALUE_FLOAT: + case MAVLINK_MSG_ID_NAMED_VALUE_INT: + // Receive named value message + receiveMessageNamedValue(message); break; case MAVLINK_MSG_ID_BOOT: getStatusForCode((int)MAV_STATE_BOOT, uasState, stateDescription); @@ -237,7 +239,7 @@ void UAS::receiveMessage(LinkInterface* link, mavlink_message_t message) // FIXME //qDebug() << "SYSTEM NAV MODE:" << state.nav_mode; - QString audiostring = "System " + QString::number(this->getUASID()); + QString audiostring = "System " + getUASName(); QString stateAudio = ""; QString modeAudio = ""; bool statechanged = false; @@ -277,7 +279,7 @@ void UAS::receiveMessage(LinkInterface* link, mavlink_message_t message) mode = "GUIDED MODE"; break; case (uint8_t)MAV_MODE_READY: - mode = "READY"; + mode = "READY MODE"; break; case (uint8_t)MAV_MODE_TEST1: mode = "TEST1 MODE"; @@ -748,6 +750,7 @@ void UAS::receiveMessage(LinkInterface* link, mavlink_message_t message) mavlink_waypoint_reached_t wpr; mavlink_msg_waypoint_reached_decode(&message, &wpr); waypointManager.handleWaypointReached(message.sysid, message.compid, &wpr); + GAudioOutput::instance()->say(QString("System %1 reached waypoint %2").arg(getUASName()).arg(wpr.seq)); } break; @@ -866,12 +869,15 @@ void UAS::receiveMessage(LinkInterface* link, mavlink_message_t message) break; #endif + // Messages to ignore + case MAVLINK_MSG_ID_LOCAL_POSITION_SETPOINT_SET: + break; default: { if (!unknownPackets.contains(message.msgid)) { unknownPackets.append(message.msgid); - QString errString = tr("UNABLE TO DECODE MESSAGE WITH ID %1").arg(message.msgid); + QString errString = tr("UNABLE TO DECODE MESSAGE NUMBER %1").arg(message.msgid); GAudioOutput::instance()->say(errString+tr(", please check the communication console for details.")); emit textMessageReceived(uasId, message.compid, 255, errString); std::cout << "Unable to decode message from system " << std::dec << static_cast(message.sysid) << " with message id:" << static_cast(message.msgid) << std::endl; @@ -1928,7 +1934,7 @@ void UAS::startLowBattAlarm() { if (!lowBattAlarm) { - GAudioOutput::instance()->alert("LOW BATTERY"); + GAudioOutput::instance()->alert(tr("SYSTEM %1 HAS LOW BATTERY").arg(getUASName())); QTimer::singleShot(2000, GAudioOutput::instance(), SLOT(startEmergency())); lowBattAlarm = true; } diff --git a/src/uas/UASWaypointManager.cc b/src/uas/UASWaypointManager.cc index 9c4aa167e87925246c8218d7e695839a2350447c..d30f84b723367fde78e1f633088d95edfdf7645c 100644 --- a/src/uas/UASWaypointManager.cc +++ b/src/uas/UASWaypointManager.cc @@ -138,8 +138,8 @@ void UASWaypointManager::handleWaypoint(quint8 systemId, quint8 compId, mavlink_ if(wp->seq == current_wp_id) { - qDebug() << "Got WP: " << wp->seq << wp->x << wp->y << wp->z << wp->yaw << "auto:" << wp->autocontinue << "curr:" << wp->current << wp->param1 << wp->param2 << (MAV_FRAME) wp->frame << (MAV_ACTION) wp->action; - Waypoint *lwp = new Waypoint(wp->seq, wp->x, wp->y, wp->z, wp->yaw, wp->autocontinue, wp->current, wp->param1, wp->param2, (MAV_FRAME) wp->frame, (MAV_ACTION) wp->action); + qDebug() << "Got WP: " << wp->seq << wp->x << wp->y << wp->z << wp->param4 << "auto:" << wp->autocontinue << "curr:" << wp->current << wp->param1 << wp->param2 << (MAV_FRAME) wp->frame << (MAV_ACTION) wp->action; + Waypoint *lwp = new Waypoint(wp->seq, wp->x, wp->y, wp->z, wp->param4, wp->autocontinue, wp->current, wp->param1, wp->param2, (MAV_FRAME) wp->frame, (MAV_ACTION) wp->action); addWaypoint(lwp, false); //get next waypoint @@ -663,8 +663,7 @@ void UASWaypointManager::writeWaypoints() cur_d->autocontinue = cur_s->getAutoContinue(); cur_d->current = cur_s->getCurrent() & noCurrent; //make sure only one current waypoint is selected, the first selected will be chosen - cur_d->orbit = cur_s->getLoiterOrbit(); - cur_d->orbit_direction = 0; + cur_d->param3 = cur_s->getLoiterOrbit(); cur_d->param1 = cur_s->getParam1(); cur_d->param2 = cur_s->getParam2(); cur_d->frame = cur_s->getFrame(); @@ -673,7 +672,7 @@ void UASWaypointManager::writeWaypoints() cur_d->x = cur_s->getX(); cur_d->y = cur_s->getY(); cur_d->z = cur_s->getZ(); - cur_d->yaw = cur_s->getYaw(); + cur_d->param4 = cur_s->getYaw(); if (cur_s->getCurrent() && noCurrent) noCurrent = false; diff --git a/src/ui/QGCSensorSettingsWidget.ui b/src/ui/QGCSensorSettingsWidget.ui index b475dda88eedcfac776546fa9dd3b44ff4ef65cd..9c8267b99ae0e1035b197aa91f2de04fe1a79505 100644 --- a/src/ui/QGCSensorSettingsWidget.ui +++ b/src/ui/QGCSensorSettingsWidget.ui @@ -6,7 +6,7 @@ 0 0 - 237 + 307 221 @@ -134,7 +134,7 @@ - Extended + Ext. Status @@ -148,7 +148,7 @@ - Controller + Raw Contr. @@ -183,7 +183,7 @@ - RC Values + RC Chan.