Commit 5505fab4 authored by oberion's avatar oberion

Merge remote-tracking branch 'remotes/pixhawk/v10release' into dev_senseSoarMavlinkv10

parents a5393402 1b6c9a55
This diff is collapsed.
This diff is collapsed.
B໿SketchUp Model૿{8.0.4810}싀菾崲題皖⻣៓纯ÿ覡乃￿ 噃牥楳湯慍ー￾䌉䄀爀挀䌀甀爀瘀攀Ā＀￾䌊䄀琀琀爀椀戀甀琀攀＀￾䌓䄀琀琀爀椀戀甀琀攀䌀漀渀琀愀椀渀攀爀＀￾䌏䄀琀琀爀椀戀甀琀攀一愀洀攀搀Ā＀￾䌐䈀愀挀欀最爀漀甀渀搀䤀洀愀最攀਀＀￾䌇䌀愀洀攀爀愀Ԁ＀￾䌊䌀漀洀瀀漀渀攀渀琀଀＀￾䌒䌀漀洀瀀漀渀攀渀琀䈀攀栀愀瘀椀漀爀Ԁ＀￾䌔䌀漀洀瀀漀渀攀渀琀䐀攀昀椀渀椀琀椀漀渀਀＀￾䌒䌀漀洀瀀漀渀攀渀琀䤀渀猀琀愀渀挀攀Ѐ＀￾䌕䌀漀渀猀琀爀甀挀琀椀漀渀䜀攀漀洀攀琀爀礀＀￾䌑䌀漀渀猀琀爀甀挀琀椀漀渀䰀椀渀攀Ā＀￾䌒䌀漀渀猀琀爀甀挀琀椀漀渀倀漀椀渀琀＀￾䌆䌀甀爀瘀攀Ѐ＀￾䌏䐀攀昀椀渀椀琀椀漀渀䰀椀猀琀＀￾䌄䐀椀戀̀＀￾䌊䐀椀洀攀渀猀椀漀渀Ā＀￾䌐䐀椀洀攀渀猀椀漀渀䰀椀渀攀愀爀؀＀￾䌐䐀椀洀攀渀猀椀漀渀刀愀搀椀愀氀Ȁ＀￾䌏䐀椀洀攀渀猀椀漀渀匀琀礀氀攀Ѐ＀￾䌏䐀爀愀眀椀渀最䔀氀攀洀攀渀琀ऀ＀￾䌅䔀搀最攀Ȁ＀￾䌈䔀搀最攀唀猀攀Ā＀￾䌇䔀渀琀椀琀礀̀＀￾䌅䘀愀挀攀̀＀￾䌒䘀愀挀攀吀攀砀琀甀爀攀䌀漀漀爀搀猀Ѐ＀￾䌌䘀漀渀琀䴀愀渀愀最攀爀＀￾䌆䜀爀漀甀瀀Ā＀￾䌆䤀洀愀最攀Ā＀￾䌆䰀愀礀攀爀Ȁ＀￾䌍䰀愀礀攀爀䴀愀渀愀最攀爀Ѐ＀￾䌅䰀漀漀瀀Ā＀￾䌉䴀愀琀攀爀椀愀氀ఀ＀￾䌐䴀愀琀攀爀椀愀氀䴀愀渀愀最攀爀Ѐ＀￾䌉倀愀最攀䰀椀猀琀Ā＀￾䌋倀漀氀礀氀椀渀攀㌀搀＀￾䌍刀攀氀愀琀椀漀渀猀栀椀瀀＀￾䌐刀攀氀愀琀椀漀渀猀栀椀瀀䴀愀瀀＀￾䌑刀攀渀搀攀爀椀渀最伀瀀琀椀漀渀猀␀＀￾䌍匀攀挀琀椀漀渀倀氀愀渀攀Ȁ＀￾䌋匀栀愀搀漀眀䤀渀昀漀܀＀￾䌇匀欀䘀漀渀琀Ā＀￾䌉匀欀攀琀挀栀䌀匀＀￾䌎匀欀攀琀挀栀唀瀀䴀漀搀攀氀ᘀ＀￾䌍匀欀攀琀挀栀唀瀀倀愀最攀Ā＀￾䌉匀欀瀀匀琀礀氀攀Ā＀￾䌐匀欀瀀匀琀礀氀攀䴀愀渀愀最攀爀Ȁ＀￾䌅吀攀砀琀ऀ＀￾䌊吀攀砀琀匀琀礀氀攀Ԁ＀￾䌈吀攀砀琀甀爀攀؀＀￾䌊吀栀甀洀戀渀愀椀氀Ā＀￾䌇嘀攀爀琀攀砀＀￾䌉嘀椀攀眀倀愀最攀ఀ＀￾䌊圀愀琀攀爀洀愀爀欀Ā＀￾䌑圀愀琀攀爀洀愀爀欀䴀愀渀愀最攀爀Ȁ＀￾䔒渀搀ⴀ伀昀ⴀ嘀攀爀猀椀漀渀ⴀ䴀愀瀀Ȁ뀀Ā＀ϿЀ䌀楄Ѣ洀褀乐േᨊ B໿SketchUp Model૿{8.0.4810}싀菾崲題皖⻣៓纯ÿ覡乃￿ 噃牥楳湯慍ー￾䌉䄀爀挀䌀甀爀瘀攀Ā＀￾䌊䄀琀琀爀椀戀甀琀攀＀￾䌓䄀琀琀爀椀戀甀琀攀䌀漀渀琀愀椀渀攀爀＀￾䌏䄀琀琀爀椀戀甀琀攀一愀洀攀搀Ā＀￾䌐䈀愀挀欀最爀漀甀渀搀䤀洀愀最攀਀＀￾䌇䌀愀洀攀爀愀Ԁ＀￾䌊䌀漀洀瀀漀渀攀渀琀଀＀￾䌒䌀漀洀瀀漀渀攀渀琀䈀攀栀愀瘀椀漀爀Ԁ＀￾䌔䌀漀洀瀀漀渀攀渀琀䐀攀昀椀渀椀琀椀漀渀਀＀￾䌒䌀漀洀瀀漀渀攀渀琀䤀渀猀琀愀渀挀攀Ѐ＀￾䌕䌀漀渀猀琀爀甀挀琀椀漀渀䜀攀漀洀攀琀爀礀＀￾䌑䌀漀渀猀琀爀甀挀琀椀漀渀䰀椀渀攀Ā＀￾䌒䌀漀渀猀琀爀甀挀琀椀漀渀倀漀椀渀琀＀￾䌆䌀甀爀瘀攀Ѐ＀￾䌏䐀攀昀椀渀椀琀椀漀渀䰀椀猀琀＀￾䌄䐀椀戀̀＀￾䌊䐀椀洀攀渀猀椀漀渀Ā＀￾䌐䐀椀洀攀渀猀椀漀渀䰀椀渀攀愀爀؀＀￾䌐䐀椀洀攀渀猀椀漀渀刀愀搀椀愀氀Ȁ＀￾䌏䐀椀洀攀渀猀椀漀渀匀琀礀氀攀Ѐ＀￾䌏䐀爀愀眀椀渀最䔀氀攀洀攀渀琀ऀ＀￾䌅䔀搀最攀Ȁ＀￾䌈䔀搀最攀唀猀攀Ā＀￾䌇䔀渀琀椀琀礀̀＀￾䌅䘀愀挀攀̀＀￾䌒䘀愀挀攀吀攀砀琀甀爀攀䌀漀漀爀搀猀Ѐ＀￾䌌䘀漀渀琀䴀愀渀愀最攀爀＀￾䌆䜀爀漀甀瀀Ā＀￾䌆䤀洀愀最攀Ā＀￾䌆䰀愀礀攀爀Ȁ＀￾䌍䰀愀礀攀爀䴀愀渀愀最攀爀Ѐ＀￾䌅䰀漀漀瀀Ā＀￾䌉䴀愀琀攀爀椀愀氀ఀ＀￾䌐䴀愀琀攀爀椀愀氀䴀愀渀愀最攀爀Ѐ＀￾䌉倀愀最攀䰀椀猀琀Ā＀￾䌋倀漀氀礀氀椀渀攀㌀搀＀￾䌍刀攀氀愀琀椀漀渀猀栀椀瀀＀￾䌐刀攀氀愀琀椀漀渀猀栀椀瀀䴀愀瀀＀￾䌑刀攀渀搀攀爀椀渀最伀瀀琀椀漀渀猀␀＀￾䌍匀攀挀琀椀漀渀倀氀愀渀攀Ȁ＀￾䌋匀栀愀搀漀眀䤀渀昀漀܀＀￾䌇匀欀䘀漀渀琀Ā＀￾䌉匀欀攀琀挀栀䌀匀＀￾䌎匀欀攀琀挀栀唀瀀䴀漀搀攀氀ᘀ＀￾䌍匀欀攀琀挀栀唀瀀倀愀最攀Ā＀￾䌉匀欀瀀匀琀礀氀攀Ā＀￾䌐匀欀瀀匀琀礀氀攀䴀愀渀愀最攀爀Ȁ＀￾䌅吀攀砀琀ऀ＀￾䌊吀攀砀琀匀琀礀氀攀Ԁ＀￾䌈吀攀砀琀甀爀攀؀＀￾䌊吀栀甀洀戀渀愀椀氀Ā＀￾䌇嘀攀爀琀攀砀＀￾䌉嘀椀攀眀倀愀最攀ఀ＀￾䌊圀愀琀攀爀洀愀爀欀Ā＀￾䌑圀愀琀攀爀洀愀爀欀䴀愀渀愀最攀爀Ȁ＀￾䔒渀搀ⴀ伀昀ⴀ嘀攀爀猀椀漀渀ⴀ䴀愀瀀Ȁ뀀Ā＀ϿЀ䌀楄Ѣ洀褀乐േᨊ
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html> <html>
<head> <head>
...@@ -7,8 +7,8 @@ ...@@ -7,8 +7,8 @@
<!-- QGroundControl --> <!-- QGroundControl -->
<title>QGroundControl Google Earth View</title> <title>QGroundControl Google Earth View</title>
<!-- *** Replace the key below below with your own API key, available at http://code.google.com/apis/maps/signup.html *** --> <!-- *** Replace the key below below with your own API key, available at http://code.google.com/apis/maps/signup.html *** -->
<!--<script type="text/javascript" src="https://getfirebug.com/firebug-lite-beta.js"></script>--> <script type="text/javascript" src="https://getfirebug.com/firebug-lite-beta.js"></script>
<script type="text/javascript" src="http://www.google.com/jsapi?key=ABQIAAAAwbkbZLyhsmTCWXbTcjbgbRSzHs7K5SvaUdm8ua-Xxy_-2dYwMxQMhnagaawTo7L1FE1-amhuQxIlXw"></script> <script type="text/javascript" src="https://www.google.com/jsapi?key=ABQIAAAA5Q6wxQ6lxKS8haLVdUJaqhSjosg_0jiTTs2iXtkDVG0n0If1mBRHzhWw5VqBZX-j4NuzoVpU-UaHVg"></script>
<script type="text/javascript"> <script type="text/javascript">
google.load("earth", "1", { 'language': 'en'}); google.load("earth", "1", { 'language': 'en'});
...@@ -99,6 +99,12 @@ var clickMode = 0; ...@@ -99,6 +99,12 @@ var clickMode = 0;
var homePlacemark = null; var homePlacemark = null;
// Data / heightmap
var heightMapPlacemark = null;
var heightMapModel = null;
function getGlobal(variable) function getGlobal(variable)
{ {
return variable; return variable;
...@@ -417,8 +423,16 @@ function createAircraft(id, type, color) ...@@ -417,8 +423,16 @@ function createAircraft(id, type, color)
planeOrient = ge.createOrientation(''); planeOrient = ge.createOrientation('');
planeModel.setOrientation(planeOrient); planeModel.setOrientation(planeOrient);
planeLink.setHref('http://www.asl.ethz.ch/people/rudink/senseSoarDummy.dae'); var factor = 1.0;
//planeLink.setHref('http://www.asl.ethz.ch/people/rudink/senseSoarDummy.dae');
planeLink.setHref('http://qgroundcontrol.org/_media/users/models/sfly-hex.dae');
factor = 1.0/1000.0;
//planeLink.setHref('http://qgroundcontrol.org/_media/users/models/ascent-park-glider.dae');
planeModel.setLink(planeLink); planeModel.setLink(planeLink);
var scale = planeModel.getScale();
scale.set(scale.getX()*factor, scale.getY()*factor, scale.getZ()*factor)
planeModel.setScale(scale);
planeModel.setAltitudeMode (ge.ALTITUDE_ABSOLUTE); planeModel.setAltitudeMode (ge.ALTITUDE_ABSOLUTE);
planeLoc.setLatitude(currLat); planeLoc.setLatitude(currLat);
...@@ -553,6 +567,34 @@ function initCallback(object) ...@@ -553,6 +567,34 @@ function initCallback(object)
enableEventListener(); enableEventListener();
document.getElementById('JScript_initialized').setAttribute('value','true'); document.getElementById('JScript_initialized').setAttribute('value','true');
// Load heightmap
// http://www.inf.ethz.ch/personal/lomeier/data/untex-environment.dae
heightMapPlacemark = ge.createPlacemark('');
heightMapPlacemark.setName('aircraft');
heightMapModel = ge.createModel('');
ge.getFeatures().appendChild(heightMapPlacemark);
planeLoc = ge.createLocation('');
heightMapModel.setLocation(planeLoc);
planeLink = ge.createLink('');
planeOrient = ge.createOrientation('');
heightMapModel.setOrientation(planeOrient);
planeLink.setHref('http://www.inf.ethz.ch/personal/lomeier/data/untex-environment.dae');
heightMapModel.setLink(planeLink);
var scale = heightMapModel.getScale();
var factor = 1.0;//1.0/1000.0;
scale.set(scale.getX()*factor, scale.getY()*factor, scale.getZ()*factor)
heightMapModel.setScale(scale);
heightMapModel.setAltitudeMode (ge.ALTITUDE_ABSOLUTE);
planeLoc.setLatitude(currLat);
planeLoc.setLongitude(currLon);
planeLoc.setAltitude(currAlt);
heightMapPlacemark.setGeometry(heightMapModel);
initialized = true; initialized = true;
} }
...@@ -578,18 +620,16 @@ function setAircraftPositionAttitude(id, lat, lon, alt, roll, pitch, yaw) ...@@ -578,18 +620,16 @@ function setAircraftPositionAttitude(id, lat, lon, alt, roll, pitch, yaw)
currAlt = trueGroundAlt+0.1; currAlt = trueGroundAlt+0.1;
} }
// Interpolate between t-1 and t and set new states // Interpolate between t-1 and t and set new states
lastLat = lastLat*0.8+currLat*0.2; lastLat = lastLat*0.5+currLat*0.5;
lastLon = lastLon*0.8+currLon*0.2; lastLon = lastLon*0.5+currLon*0.5;
lastAlt = lastAlt*0.8+currAlt*0.2; lastAlt = lastAlt*0.5+currAlt*0.5;
//currFollowHeading = ((yaw/M_PI)+1.0)*360.0;
planeOrient.setRoll(+((roll/M_PI))*180.0);
planeOrient.setRoll(+((pitch / M_PI)) * 180.0); planeOrient.setTilt(-((pitch/M_PI))*180.0);
planeOrient.setTilt(-((roll / M_PI)) * 180.0); planeOrient.setHeading(((yaw/M_PI))*180.0-90.0);
planeOrient.setHeading(((yaw / M_PI)) * 180.0 - 90.0);
planeModel.setOrientation(planeOrient); planeModel.setOrientation(planeOrient);
currFollowHeading = ((yaw/M_PI))*180.0; currFollowHeading = currFollowHeading*0.95+0.05*(((yaw/M_PI))*180.0);
planeLoc.setLatitude(lastLat); planeLoc.setLatitude(lastLat);
planeLoc.setLongitude(lastLon); planeLoc.setLongitude(lastLon);
...@@ -678,17 +718,10 @@ function updateFollowAircraft() ...@@ -678,17 +718,10 @@ function updateFollowAircraft()
if (viewMode != 3) // VIEW_MODE_CHASE_FREE if (viewMode != 3) // VIEW_MODE_CHASE_FREE
{ {
ge.getView().setAbstractView(currView); currView.setTilt(currFollowTilt);
var camera = ge.getView().copyAsCamera(ge.ALTITUDE_ABSOLUTE); currView.setHeading(currFollowHeading);
camera.setTilt(currFollowTilt);
camera.setRoll(0);
camera.setHeading(currFollowHeading);
ge.getView().setAbstractView(camera);
} }
else
{
ge.getView().setAbstractView(currView); ge.getView().setAbstractView(currView);
}
} }
function failureCallback(object) function failureCallback(object)
......
...@@ -42,8 +42,8 @@ macx { ...@@ -42,8 +42,8 @@ macx {
# COMPILER_VERSION = $$system(gcc -v) # COMPILER_VERSION = $$system(gcc -v)
#message(Using compiler $$COMPILER_VERSION) #message(Using compiler $$COMPILER_VERSION)
CONFIG += x86_64 cocoa phonon CONFIG += x86 cocoa phonon
CONFIG -= x86 CONFIG -= x86_64
#HARDWARE_PLATFORM = $$system(uname -a) #HARDWARE_PLATFORM = $$system(uname -a)
#contains( $$HARDWARE_PLATFORM, "9.6.0" ) || contains( $$HARDWARE_PLATFORM, "9.7.0" ) || contains( $$HARDWARE_PLATFORM, "9.8.0" ) || contains( $$HARDWARE_PLATFORM, "9.9.0" ) { #contains( $$HARDWARE_PLATFORM, "9.6.0" ) || contains( $$HARDWARE_PLATFORM, "9.7.0" ) || contains( $$HARDWARE_PLATFORM, "9.8.0" ) || contains( $$HARDWARE_PLATFORM, "9.9.0" ) {
......
...@@ -184,8 +184,8 @@ bool GAudioOutput::say(QString text, int severity) ...@@ -184,8 +184,8 @@ bool GAudioOutput::say(QString text, int severity)
cst_wave* wav = flite_text_to_wave(text.toStdString().c_str(), v); cst_wave* wav = flite_text_to_wave(text.toStdString().c_str(), v);
// file.fileName() returns the unique file name // file.fileName() returns the unique file name
cst_wave_save(wav, file.fileName().toStdString().c_str(), "riff"); cst_wave_save(wav, file.fileName().toStdString().c_str(), "riff");
m_media->setCurrentSource(Phonon::MediaSource(file.fileName().toStdString().c_str())); //m_media->setCurrentSource(Phonon::MediaSource(file.fileName().toStdString().c_str()));
m_media->play(); //m_media->play();
res = true; res = true;
} }
#endif #endif
......
...@@ -14,10 +14,10 @@ MAVLinkSimulationMAV::MAVLinkSimulationMAV(MAVLinkSimulationLink *parent, int sy ...@@ -14,10 +14,10 @@ MAVLinkSimulationMAV::MAVLinkSimulationMAV(MAVLinkSimulationLink *parent, int sy
timer1Hz(0), timer1Hz(0),
latitude(lat), latitude(lat),
longitude(lon), longitude(lon),
altitude(0.0), altitude(550.0),
x(lat), x(lat),
y(lon), y(lon),
z(550), z(altitude),
roll(0.0), roll(0.0),
pitch(0.0), pitch(0.0),
yaw(0.0), yaw(0.0),
......
...@@ -188,7 +188,7 @@ void QGCFlightGearLink::writeBytes(const char* data, qint64 size) ...@@ -188,7 +188,7 @@ void QGCFlightGearLink::writeBytes(const char* data, qint64 size)
void QGCFlightGearLink::readBytes() void QGCFlightGearLink::readBytes()
{ {
const qint64 maxLength = 65536; const qint64 maxLength = 65536;
static char data[maxLength]; char data[maxLength];
QHostAddress sender; QHostAddress sender;
quint16 senderPort; quint16 senderPort;
......
...@@ -210,7 +210,7 @@ void UDPLink::writeBytes(const char* data, qint64 size) ...@@ -210,7 +210,7 @@ void UDPLink::writeBytes(const char* data, qint64 size)
void UDPLink::readBytes() void UDPLink::readBytes()
{ {
const qint64 maxLength = 65536; const qint64 maxLength = 65536;
static char data[maxLength]; char data[maxLength];
QHostAddress sender; QHostAddress sender;
quint16 senderPort; quint16 senderPort;
......
...@@ -63,7 +63,7 @@ namespace core { ...@@ -63,7 +63,7 @@ namespace core {
/// Google Maps API generated using http://greatmaps.codeplex.com/ /// Google Maps API generated using http://greatmaps.codeplex.com/
/// from http://code.google.com/intl/en-us/apis/maps/signup.html /// from http://code.google.com/intl/en-us/apis/maps/signup.html
/// </summary> /// </summary>
GoogleMapsAPIKey = "ABQIAAAAWaQgWiEBF3lW97ifKnAczhRAzBk5Igf8Z5n2W3hNnMT0j2TikxTLtVIGU7hCLLHMAuAMt-BO5UrEWA"; GoogleMapsAPIKey = "ABQIAAAA5Q6wxQ6lxKS8haLVdUJaqhSjosg_0jiTTs2iXtkDVG0n0If1mBRHzhWw5VqBZX-j4NuzoVpU-UaHVg";
// Yahoo version strings // Yahoo version strings
VersionYahooMap = "4.3"; VersionYahooMap = "4.3";
......
...@@ -27,7 +27,6 @@ WaypointLineItem::WaypointLineItem(WayPointItem* wp1, WayPointItem* wp2, QColor ...@@ -27,7 +27,6 @@ WaypointLineItem::WaypointLineItem(WayPointItem* wp1, WayPointItem* wp2, QColor
setLine(localPoint1.X(), localPoint1.Y(), localPoint2.X(), localPoint2.Y()); setLine(localPoint1.X(), localPoint1.Y(), localPoint2.X(), localPoint2.Y());
// Connect updates // Connect updates
// Update line from both waypoints // Update line from both waypoints
connect(wp1, SIGNAL(WPValuesChanged(WayPointItem*)), this, SLOT(updateWPValues(WayPointItem*))); connect(wp1, SIGNAL(WPValuesChanged(WayPointItem*)), this, SLOT(updateWPValues(WayPointItem*)));
connect(wp2, SIGNAL(WPValuesChanged(WayPointItem*)), this, SLOT(updateWPValues(WayPointItem*))); connect(wp2, SIGNAL(WPValuesChanged(WayPointItem*)), this, SLOT(updateWPValues(WayPointItem*)));
......
...@@ -42,9 +42,12 @@ void PxQuadMAV::receiveMessage(LinkInterface* link, mavlink_message_t message) ...@@ -42,9 +42,12 @@ void PxQuadMAV::receiveMessage(LinkInterface* link, mavlink_message_t message)
#ifdef MAVLINK_ENABLED_PIXHAWK #ifdef MAVLINK_ENABLED_PIXHAWK
mavlink_message_t* msg = &message; mavlink_message_t* msg = &message;
if (message.sysid == uasId) { if (message.sysid == uasId)
switch (message.msgid) { {
case MAVLINK_MSG_ID_RAW_AUX: { switch (message.msgid)
{
case MAVLINK_MSG_ID_RAW_AUX:
{
mavlink_raw_aux_t raw; mavlink_raw_aux_t raw;
mavlink_msg_raw_aux_decode(&message, &raw); mavlink_msg_raw_aux_decode(&message, &raw);
quint64 time = getUnixTime(0); quint64 time = getUnixTime(0);
...@@ -52,14 +55,16 @@ void PxQuadMAV::receiveMessage(LinkInterface* link, mavlink_message_t message) ...@@ -52,14 +55,16 @@ void PxQuadMAV::receiveMessage(LinkInterface* link, mavlink_message_t message)
emit valueChanged(uasId, "Temperature", "raw", raw.temp, time); emit valueChanged(uasId, "Temperature", "raw", raw.temp, time);
} }
break; break;
case MAVLINK_MSG_ID_IMAGE_TRIGGERED: { case MAVLINK_MSG_ID_IMAGE_TRIGGERED:
{
// FIXME Kind of a hack to load data from disk // FIXME Kind of a hack to load data from disk
mavlink_image_triggered_t img; mavlink_image_triggered_t img;
mavlink_msg_image_triggered_decode(&message, &img); mavlink_msg_image_triggered_decode(&message, &img);
emit imageStarted(img.timestamp); emit imageStarted(img.timestamp);
} }
break; break;
case MAVLINK_MSG_ID_PATTERN_DETECTED: { case MAVLINK_MSG_ID_PATTERN_DETECTED:
{
mavlink_pattern_detected_t detected; mavlink_pattern_detected_t detected;
mavlink_msg_pattern_detected_decode(&message, &detected); mavlink_msg_pattern_detected_decode(&message, &detected);
QByteArray b; QByteArray b;
......
...@@ -232,6 +232,9 @@ void UAS::receiveMessage(LinkInterface* link, mavlink_message_t message) ...@@ -232,6 +232,9 @@ void UAS::receiveMessage(LinkInterface* link, mavlink_message_t message)
case MAV_TYPE_QUADROTOR: case MAV_TYPE_QUADROTOR:
setAirframe(UASInterface::QGC_AIRFRAME_CHEETAH); setAirframe(UASInterface::QGC_AIRFRAME_CHEETAH);
break; break;
case MAV_TYPE_HEXAROTOR:
setAirframe(UASInterface::QGC_AIRFRAME_HEXCOPTER);
break;
default: default:
// Do nothing // Do nothing
break; break;
...@@ -338,8 +341,6 @@ void UAS::receiveMessage(LinkInterface* link, mavlink_message_t message) ...@@ -338,8 +341,6 @@ void UAS::receiveMessage(LinkInterface* link, mavlink_message_t message)
emit loadChanged(this,state.load/10.0f); emit loadChanged(this,state.load/10.0f);
currentVoltage = state.voltage_battery/1000.0f; currentVoltage = state.voltage_battery/1000.0f;
lpVoltage = filterVoltage(currentVoltage); lpVoltage = filterVoltage(currentVoltage);
...@@ -463,7 +464,8 @@ void UAS::receiveMessage(LinkInterface* link, mavlink_message_t message) ...@@ -463,7 +464,8 @@ void UAS::receiveMessage(LinkInterface* link, mavlink_message_t message)
emit globalPositionChanged(this, latitude, longitude, altitude, time); emit globalPositionChanged(this, latitude, longitude, altitude, time);
emit speedChanged(this, speedX, speedY, speedZ, time); emit speedChanged(this, speedX, speedY, speedZ, time);
// Set internal state // Set internal state
if (!positionLock) { if (!positionLock)
{
// If position was not locked before, notify positive // If position was not locked before, notify positive
GAudioOutput::instance()->notifyPositive(); GAudioOutput::instance()->notifyPositive();
} }
...@@ -483,29 +485,35 @@ void UAS::receiveMessage(LinkInterface* link, mavlink_message_t message) ...@@ -483,29 +485,35 @@ void UAS::receiveMessage(LinkInterface* link, mavlink_message_t message)
// quint64 time = getUnixTime(pos.time_usec); // quint64 time = getUnixTime(pos.time_usec);
quint64 time = getUnixTime(pos.time_usec); quint64 time = getUnixTime(pos.time_usec);
if (pos.fix_type > 2) { if (pos.fix_type > 2)
{
emit globalPositionChanged(this, pos.lat/(double)1E7, pos.lon/(double)1E7, pos.alt/1000.0, time); emit globalPositionChanged(this, pos.lat/(double)1E7, pos.lon/(double)1E7, pos.alt/1000.0, time);
latitude = pos.lat/(double)1E7; latitude = pos.lat/(double)1E7;
longitude = pos.lon/(double)1E7; longitude = pos.lon/(double)1E7;
altitude = pos.alt/1000.0; altitude = pos.alt/1000.0;
positionLock = true; positionLock = true;
isGlobalPositionKnown = true;
// Check for NaN // Check for NaN
int alt = pos.alt; int alt = pos.alt;
if (alt != alt) { if (!isnan(alt) && !isinf(alt))
{
alt = 0; alt = 0;
emit textMessageReceived(uasId, message.compid, 255, "GCS ERROR: RECEIVED NaN FOR ALTITUDE"); emit textMessageReceived(uasId, message.compid, 255, "GCS ERROR: RECEIVED NaN or Inf FOR ALTITUDE");
} }
// FIXME REMOVE LATER emit valueChanged(uasId, "altitude", "m", pos.alt/(double)1E3, time); // FIXME REMOVE LATER emit valueChanged(uasId, "altitude", "m", pos.alt/(double)1E3, time);
// Smaller than threshold and not NaN // Smaller than threshold and not NaN
float vel = pos.vel/100.0f; float vel = pos.vel/100.0f;
if (vel < 1000000 && !isnan(vel) && !isinf(vel)) { if (vel < 1000000 && !isnan(vel) && !isinf(vel))
{
// FIXME REMOVE LATER emit valueChanged(uasId, "speed", "m/s", vel, time); // FIXME REMOVE LATER emit valueChanged(uasId, "speed", "m/s", vel, time);
//qDebug() << "GOT GPS RAW"; //qDebug() << "GOT GPS RAW";
// emit speedChanged(this, (double)pos.v, 0.0, 0.0, time); // emit speedChanged(this, (double)pos.v, 0.0, 0.0, time);
} else { }
else
{
emit textMessageReceived(uasId, message.compid, 255, QString("GCS ERROR: RECEIVED INVALID SPEED OF %1 m/s").arg(vel)); emit textMessageReceived(uasId, message.compid, 255, QString("GCS ERROR: RECEIVED INVALID SPEED OF %1 m/s").arg(vel));
} }
} }
......
...@@ -186,9 +186,9 @@ void HDDisplay::triggerUpdate() ...@@ -186,9 +186,9 @@ void HDDisplay::triggerUpdate()
void HDDisplay::paintEvent(QPaintEvent * event) void HDDisplay::paintEvent(QPaintEvent * event)
{ {
Q_UNUSED(event); Q_UNUSED(event);
static quint64 interval = 0; quint64 interval = 0;
//qDebug() << "INTERVAL:" << MG::TIME::getGroundTimeNow() - interval << __FILE__ << __LINE__; //qDebug() << "INTERVAL:" << MG::TIME::getGroundTimeNow() - interval << __FILE__ << __LINE__;
interval = MG::TIME::getGroundTimeNow(); interval = QGC::groundTimeMilliseconds();
renderOverlay(); renderOverlay();
} }
......
...@@ -37,10 +37,10 @@ void QGCMAVLinkInspector::refreshView() ...@@ -37,10 +37,10 @@ void QGCMAVLinkInspector::refreshView()
// Ignore NULL values // Ignore NULL values
if (!msg) continue; if (!msg) continue;
// Update the tree view // Update the tree view
QString messageName("%1 (%2 Hz, #%3)");
messageName = messageName.arg(messageInfo[msg->msgid].name).arg(messagesHz.value(msg->msgid, 0), 2, 'f', 0).arg(msg->msgid);
if (!treeWidgetItems.contains(msg->msgid)) if (!treeWidgetItems.contains(msg->msgid))
{ {
QString messageName("%1 (#%2)");
messageName = messageName.arg(messageInfo[msg->msgid].name).arg(msg->msgid);
QStringList fields; QStringList fields;
fields << messageName; fields << messageName;
QTreeWidgetItem* widget = new QTreeWidgetItem(fields); QTreeWidgetItem* widget = new QTreeWidgetItem(fields);
...@@ -56,7 +56,10 @@ void QGCMAVLinkInspector::refreshView() ...@@ -56,7 +56,10 @@ void QGCMAVLinkInspector::refreshView()
ui->treeWidget->addTopLevelItem(widget); ui->treeWidget->addTopLevelItem(widget);
} }
// Set Hz
QTreeWidgetItem* message = treeWidgetItems.value(msg->msgid); QTreeWidgetItem* message = treeWidgetItems.value(msg->msgid);
message->setFirstColumnSpanned(true);
message->setData(0, Qt::DisplayRole, QVariant(messageName));
for (unsigned int i = 0; i < messageInfo[msg->msgid].num_fields; ++i) for (unsigned int i = 0; i < messageInfo[msg->msgid].num_fields; ++i)
{ {
updateField(msg->msgid, i, message->child(i)); updateField(msg->msgid, i, message->child(i));
...@@ -68,9 +71,22 @@ void QGCMAVLinkInspector::receiveMessage(LinkInterface* link,mavlink_message_t m ...@@ -68,9 +71,22 @@ void QGCMAVLinkInspector::receiveMessage(LinkInterface* link,mavlink_message_t m
{ {
Q_UNUSED(link); Q_UNUSED(link);
// Only overwrite if system filter is set // Only overwrite if system filter is set
// int filterValue = ui->systemComboBox()->value().toInt();
// if (filterValue != )
memcpy(receivedMessages+message.msgid, &message, sizeof(mavlink_message_t)); memcpy(receivedMessages+message.msgid, &message, sizeof(mavlink_message_t));
float msgHz = 0.0f;
quint64 receiveTime = QGC::groundTimeMilliseconds();
if (lastMessageUpdate.contains(message.msgid))
{
msgHz = 1000.0/(double)(receiveTime - lastMessageUpdate.value(message.msgid));
if (isinf(msgHz) || isnan(msgHz) || msgHz < 0.0f)
{
msgHz = 1;
}
float newHz = 0.001f*msgHz+0.999f*messagesHz.value(message.msgid, 1);
messagesHz.insert(message.msgid, newHz);
}
lastMessageUpdate.insert(message.msgid, receiveTime);
} }
QGCMAVLinkInspector::~QGCMAVLinkInspector() QGCMAVLinkInspector::~QGCMAVLinkInspector()
......
...@@ -26,7 +26,8 @@ public slots: ...@@ -26,7 +26,8 @@ public slots:
void refreshView(); void refreshView();
protected: protected:
QMap<int, quint64> lastFieldUpdate; ///< Used to switch between highlight and non-highlighting color QMap<int, quint64> lastMessageUpdate; ///< Used to switch between highlight and non-highlighting color
QMap<int, float> messagesHz; ///< Used to store update rate in Hz
mavlink_message_t receivedMessages[256]; ///< Available / known messages mavlink_message_t receivedMessages[256]; ///< Available / known messages
QMap<int, QTreeWidgetItem*> treeWidgetItems; ///< Available tree widget items QMap<int, QTreeWidgetItem*> treeWidgetItems; ///< Available tree widget items
QTimer updateTimer; ///< Only update at 1 Hz to not overload the GUI QTimer updateTimer; ///< Only update at 1 Hz to not overload the GUI
......
...@@ -315,6 +315,7 @@ void LinechartWidget::appendData(int uasId, QString curve, double value, quint64 ...@@ -315,6 +315,7 @@ void LinechartWidget::appendData(int uasId, QString curve, double value, quint64
{ {
if (activePlot->isVisible(curve+unit)) if (activePlot->isVisible(curve+unit))
{ {
if (usec == 0) usec = QGC::groundTimeMilliseconds();
if (logStartTime == 0) logStartTime = usec; if (logStartTime == 0) logStartTime = usec;
qint64 time = usec - logStartTime; qint64 time = usec - logStartTime;
if (time < 0) time = 0; if (time < 0) time = 0;
...@@ -347,6 +348,7 @@ void LinechartWidget::appendData(int uasId, const QString& curve, const QString& ...@@ -347,6 +348,7 @@ void LinechartWidget::appendData(int uasId, const QString& curve, const QString&
{ {
if (activePlot->isVisible(curve+unit)) if (activePlot->isVisible(curve+unit))
{ {
if (usec == 0) usec = QGC::groundTimeMilliseconds();
if (logStartTime == 0) logStartTime = usec; if (logStartTime == 0) logStartTime = usec;
qint64 time = usec - logStartTime; qint64 time = usec - logStartTime;
if (time < 0) time = 0; if (time < 0) time = 0;
...@@ -391,6 +393,7 @@ void LinechartWidget::appendData(int uasId, const QString& curve, const QString& ...@@ -391,6 +393,7 @@ void LinechartWidget::appendData(int uasId, const QString& curve, const QString&
{ {
if (activePlot->isVisible(curve+unit)) if (activePlot->isVisible(curve+unit))
{ {
if (usec == 0) usec = QGC::groundTimeMilliseconds();
if (logStartTime == 0) logStartTime = usec; if (logStartTime == 0) logStartTime = usec;
qint64 time = usec - logStartTime; qint64 time = usec - logStartTime;
if (time < 0) time = 0; if (time < 0) time = 0;
...@@ -425,6 +428,7 @@ void LinechartWidget::appendData(int uasId, const QString& curve, const QString& ...@@ -425,6 +428,7 @@ void LinechartWidget::appendData(int uasId, const QString& curve, const QString&
{ {
if (activePlot->isVisible(curve+unit)) if (activePlot->isVisible(curve+unit))
{ {
if (usec == 0) usec = QGC::groundTimeMilliseconds();
if (logStartTime == 0) logStartTime = usec; if (logStartTime == 0) logStartTime = usec;
qint64 time = usec - logStartTime; qint64 time = usec - logStartTime;
if (time < 0) time = 0; if (time < 0) time = 0;
......
...@@ -54,15 +54,15 @@ QGCGoogleEarthView::QGCGoogleEarthView(QWidget *parent) : ...@@ -54,15 +54,15 @@ QGCGoogleEarthView::QGCGoogleEarthView(QWidget *parent) :
#ifdef _MSC_VER #ifdef _MSC_VER
// Create layout and attach webViewWin // Create layout and attach webViewWin
QFile file("doc.html"); // QFile file("doc.html");
if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) // if (!file.open(QIODevice::WriteOnly | QIODevice::Text))
qDebug() << __FILE__ << __LINE__ << "Could not open log file"; // qDebug() << __FILE__ << __LINE__ << "Could not open log file";
QTextStream out(&file); // QTextStream out(&file);
out << webViewWin->generateDocumentation(); // out << webViewWin->generateDocumentation();
out.flush(); // out.flush();
file.flush(); // file.flush();
file.close(); // file.close();
#else #else
...@@ -284,8 +284,6 @@ void QGCGoogleEarthView::updateGlobalPosition(UASInterface* uas, double lat, dou ...@@ -284,8 +284,6 @@ void QGCGoogleEarthView::updateGlobalPosition(UASInterface* uas, double lat, dou
{ {
Q_UNUSED(usec); Q_UNUSED(usec);
javaScript(QString("addTrailPosition(%1, %2, %3, %4);").arg(uas->getUASID()).arg(lat, 0, 'f', 22).arg(lon, 0, 'f', 22).arg(alt, 0, 'f', 22)); javaScript(QString("addTrailPosition(%1, %2, %3, %4);").arg(uas->getUASID()).arg(lat, 0, 'f', 22).arg(lon, 0, 'f', 22).arg(alt, 0, 'f', 22));
//qDebug() << QString("addTrailPosition(%1, %2, %3, %4);").arg(uas->getUASID()).arg(lat, 0, 'f', 15).arg(lon, 0, 'f', 15).arg(alt, 0, 'f', 15);
} }
void QGCGoogleEarthView::clearTrails() void QGCGoogleEarthView::clearTrails()
...@@ -614,7 +612,8 @@ void QGCGoogleEarthView::updateState() ...@@ -614,7 +612,8 @@ void QGCGoogleEarthView::updateState()
#if (QGC_EVENTLOOP_DEBUG) #if (QGC_EVENTLOOP_DEBUG)
qDebug() << "EVENTLOOP:" << __FILE__ << __LINE__; qDebug() << "EVENTLOOP:" << __FILE__ << __LINE__;
#endif #endif
if (gEarthInitialized) { if (gEarthInitialized)
{
int uasId = 0; int uasId = 0;
double lat = 47.3769; double lat = 47.3769;
double lon = 8.549444; double lon = 8.549444;
...@@ -628,6 +627,8 @@ void QGCGoogleEarthView::updateState() ...@@ -628,6 +627,8 @@ void QGCGoogleEarthView::updateState()
QList<UASInterface*> mavs = UASManager::instance()->getUASList(); QList<UASInterface*> mavs = UASManager::instance()->getUASList();
foreach (UASInterface* currMav, mavs) foreach (UASInterface* currMav, mavs)
{ {
// Only update if known
if (!currMav->globalPositionKnown()) continue;
uasId = currMav->getUASID(); uasId = currMav->getUASID();
lat = currMav->getLatitude(); lat = currMav->getLatitude();
lon = currMav->getLongitude(); lon = currMav->getLongitude();
...@@ -640,9 +641,9 @@ void QGCGoogleEarthView::updateState() ...@@ -640,9 +641,9 @@ void QGCGoogleEarthView::updateState()
javaScript(QString("setAircraftPositionAttitude(%1, %2, %3, %4, %6, %7, %8);") javaScript(QString("setAircraftPositionAttitude(%1, %2, %3, %4, %6, %7, %8);")
.arg(uasId) .arg(uasId)
.arg(lat, 0, 'f', 15) .arg(lat, 0, 'f', 22)
.arg(lon, 0, 'f', 15) .arg(lon, 0, 'f', 22)
.arg(alt, 0, 'f', 15) .arg(alt, 0, 'f', 22)
.arg(roll, 0, 'f', 9) .arg(roll, 0, 'f', 9)
.arg(pitch, 0, 'f', 9) .arg(pitch, 0, 'f', 9)
.arg(yaw, 0, 'f', 9)); .arg(yaw, 0, 'f', 9));
......
This diff is collapsed.
...@@ -117,6 +117,7 @@ protected: ...@@ -117,6 +117,7 @@ protected:
float alt; float alt;
float groundDistance; float groundDistance;
bool localFrame; bool localFrame;
bool globalFrameKnown;
QAction* removeAction; QAction* removeAction;
QAction* renameAction; QAction* renameAction;
QAction* selectAction; QAction* selectAction;
...@@ -126,6 +127,8 @@ protected: ...@@ -126,6 +127,8 @@ protected:
static const int updateInterval = 800; static const int updateInterval = 800;
static const int errorUpdateInterval = 200; static const int errorUpdateInterval = 200;
bool lowPowerModeEnabled; ///< Low power mode reduces update rates bool lowPowerModeEnabled; ///< Low power mode reduces update rates
unsigned int generalUpdateCount; ///< Skip counter for updates
double filterTime; ///< Filter time estimate of battery
void mouseDoubleClickEvent (QMouseEvent * event); void mouseDoubleClickEvent (QMouseEvent * event);
......
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