mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-01-30 15:52:12 +01:00
OP-52 Big update to GPS gadget: now supports a new mode, "Telemetry", to display the onboard GPS data, including GPS constellation.
This is not tested in Windows yet - I will do this on another machine ASAP. It might break the serial mode as well, I just lack time to test everything but I will eventually do it. git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1498 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
parent
65c832da35
commit
6589e55019
150
ground/src/plugins/gpsdisplay/gpsconstellationwidget.cpp
Normal file
150
ground/src/plugins/gpsdisplay/gpsconstellationwidget.cpp
Normal file
@ -0,0 +1,150 @@
|
|||||||
|
/**
|
||||||
|
******************************************************************************
|
||||||
|
*
|
||||||
|
* @file gpsconstellationwidget.cpp
|
||||||
|
* @author Edouard Lafargue Copyright (C) 2010.
|
||||||
|
* @addtogroup GCSPlugins GCS Plugins
|
||||||
|
* @{
|
||||||
|
* @addtogroup GPSGadgetPlugin GPS Gadget Plugin
|
||||||
|
* @{
|
||||||
|
* @brief A widget which displays the GPS constellation
|
||||||
|
*****************************************************************************/
|
||||||
|
/*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
* This program 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 this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
|
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "gpsconstellationwidget.h"
|
||||||
|
|
||||||
|
#include <QtGui>
|
||||||
|
#include <QDebug>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Initialize the widget
|
||||||
|
*/
|
||||||
|
GpsConstellationWidget::GpsConstellationWidget(QWidget *parent) : QGraphicsView(parent)
|
||||||
|
{
|
||||||
|
|
||||||
|
// Create a layout, add a QGraphicsView and put the SVG inside.
|
||||||
|
// The constellation widget looks like this:
|
||||||
|
// |--------------------|
|
||||||
|
// | |
|
||||||
|
// | |
|
||||||
|
// | Constellation |
|
||||||
|
// | |
|
||||||
|
// | |
|
||||||
|
// | |
|
||||||
|
// |--------------------|
|
||||||
|
|
||||||
|
|
||||||
|
setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||||
|
setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||||
|
|
||||||
|
QGraphicsScene *scene = new QGraphicsScene(this);
|
||||||
|
QSvgRenderer *renderer = new QSvgRenderer();
|
||||||
|
world = new QGraphicsSvgItem();
|
||||||
|
renderer->load(QString(":/gpsgadget/images/gpsEarth.svg"));
|
||||||
|
world->setSharedRenderer(renderer);
|
||||||
|
world->setElementId("map");
|
||||||
|
scene->addItem(world);
|
||||||
|
scene->setSceneRect(world->boundingRect());
|
||||||
|
setScene(scene);
|
||||||
|
|
||||||
|
// Now create 16 satellite icons which we will move around on the map:
|
||||||
|
for (int i=0; i<16;i++) {
|
||||||
|
satIcons[i] = new QGraphicsSvgItem();
|
||||||
|
satIcons[i]->setSharedRenderer(renderer);
|
||||||
|
satIcons[i]->setElementId("sat-notSeen");
|
||||||
|
satIcons[i]->setParentItem(world);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
GpsConstellationWidget::~GpsConstellationWidget()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void GpsConstellationWidget::showEvent(QShowEvent *event)
|
||||||
|
{
|
||||||
|
Q_UNUSED(event)
|
||||||
|
// Thit fitInView method should only be called now, once the
|
||||||
|
// widget is shown, otherwise it cannot compute its values and
|
||||||
|
// the result is usually a ahrsbargraph that is way too small.
|
||||||
|
fitInView(world, Qt::KeepAspectRatio);
|
||||||
|
// Scale, can't use fitInView since that doesn't work until we're shown.
|
||||||
|
// qreal factor = height()/world->boundingRect().height();
|
||||||
|
// world->setScale(factor);
|
||||||
|
// setSceneRect(world->boundingRect());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void GpsConstellationWidget::updateSat(int index, int prn, int elevation, int azimuth, int snr)
|
||||||
|
{
|
||||||
|
if (index > 16)
|
||||||
|
return; // A bit of error checking never hurts.
|
||||||
|
// TODO: add range checking
|
||||||
|
satellites[index][0] = prn;
|
||||||
|
satellites[index][1] = elevation;
|
||||||
|
satellites[index][2] = azimuth;
|
||||||
|
satellites[index][3] = snr;
|
||||||
|
|
||||||
|
if (prn) {
|
||||||
|
QPointF opd = polarToCoord(elevation,azimuth);
|
||||||
|
opd += QPointF(-satIcons[index]->boundingRect().center().x(),
|
||||||
|
-satIcons[index]->boundingRect().center().y());
|
||||||
|
satIcons[index]->setTransform(QTransform::fromTranslate(opd.x(),opd.y()), false);
|
||||||
|
if (snr)
|
||||||
|
satIcons[index]->setElementId("satellite");
|
||||||
|
else
|
||||||
|
satIcons[index]->setElementId("sat-notSeen");
|
||||||
|
satIcons[index]->show();
|
||||||
|
|
||||||
|
} else {
|
||||||
|
satIcons[index]->hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Converts the elevation/azimuth to X/Y coordinates on the map
|
||||||
|
|
||||||
|
*/
|
||||||
|
QPointF GpsConstellationWidget::polarToCoord(int elevation, int azimuth)
|
||||||
|
{
|
||||||
|
double x;
|
||||||
|
double y;
|
||||||
|
double rad_elevation;
|
||||||
|
double rad_azimuth;
|
||||||
|
|
||||||
|
|
||||||
|
rad_elevation = M_PI*elevation/180;
|
||||||
|
rad_azimuth = M_PI*azimuth/180;
|
||||||
|
|
||||||
|
x = cos(rad_elevation)*sin(rad_azimuth);
|
||||||
|
y = -cos(rad_elevation)*cos(rad_azimuth);
|
||||||
|
|
||||||
|
x = world->boundingRect().width()/2 * x;
|
||||||
|
y = world->boundingRect().height()/2 * y;
|
||||||
|
|
||||||
|
x = (world->boundingRect().width() / 2) + x;
|
||||||
|
y = (world->boundingRect().height() / 2) + y;
|
||||||
|
|
||||||
|
return QPointF(x,y);
|
||||||
|
|
||||||
|
}
|
62
ground/src/plugins/gpsdisplay/gpsconstellationwidget.h
Normal file
62
ground/src/plugins/gpsdisplay/gpsconstellationwidget.h
Normal file
@ -0,0 +1,62 @@
|
|||||||
|
/**
|
||||||
|
******************************************************************************
|
||||||
|
*
|
||||||
|
* @file gpsconstellationwidget.h
|
||||||
|
* @author Edouard Lafargue Copyright (C) 2010.
|
||||||
|
* @addtogroup GCSPlugins GCS Plugins
|
||||||
|
* @{
|
||||||
|
* @addtogroup GPSGadgetPlugin GPS Gadget Plugin
|
||||||
|
* @{
|
||||||
|
* @brief A widget which displays the GPS constellation
|
||||||
|
*****************************************************************************/
|
||||||
|
/*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
* This program 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 this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
|
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef GPSCONSTELLATIONWIDGET_H_
|
||||||
|
#define GPSCONSTELLATIONWIDGET_H_
|
||||||
|
|
||||||
|
#include <QGraphicsView>
|
||||||
|
#include <QtSvg/QSvgRenderer>
|
||||||
|
#include <QtSvg/QGraphicsSvgItem>
|
||||||
|
|
||||||
|
|
||||||
|
class GpsConstellationWidget : public QGraphicsView
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
GpsConstellationWidget(QWidget *parent = 0);
|
||||||
|
~GpsConstellationWidget();
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
void updateSat(int index, int prn, int elevation, int azimuth, int snr);
|
||||||
|
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
|
||||||
|
private:
|
||||||
|
int satellites[16][4];
|
||||||
|
QGraphicsSvgItem* satIcons[16];
|
||||||
|
QGraphicsSvgItem *world;
|
||||||
|
QGraphicsView *gpsConstellation;
|
||||||
|
QPointF polarToCoord(int elevation, int azimuth);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
void showEvent(QShowEvent *event);
|
||||||
|
|
||||||
|
|
||||||
|
};
|
||||||
|
#endif /* GPSCONSTELLATIONWIDGET_H_ */
|
@ -5,7 +5,10 @@ include(../../openpilotgcsplugin.pri)
|
|||||||
include(../../plugins/coreplugin/coreplugin.pri)
|
include(../../plugins/coreplugin/coreplugin.pri)
|
||||||
include(gpsdisplay_dependencies.pri)
|
include(gpsdisplay_dependencies.pri)
|
||||||
include(../../libs/qwt/qwt.pri)
|
include(../../libs/qwt/qwt.pri)
|
||||||
HEADERS += gpsdisplayplugin.h
|
HEADERS += gpsdisplayplugin.h \
|
||||||
|
gpsconstellationwidget.h \
|
||||||
|
gpsparser.h \
|
||||||
|
telemetryparser.h
|
||||||
HEADERS += buffer.h
|
HEADERS += buffer.h
|
||||||
HEADERS += nmeaparser.h
|
HEADERS += nmeaparser.h
|
||||||
HEADERS += gpsdisplaygadget.h
|
HEADERS += gpsdisplaygadget.h
|
||||||
@ -13,7 +16,10 @@ HEADERS += gpsdisplaywidget.h
|
|||||||
HEADERS += gpsdisplaygadgetfactory.h
|
HEADERS += gpsdisplaygadgetfactory.h
|
||||||
HEADERS += gpsdisplaygadgetconfiguration.h
|
HEADERS += gpsdisplaygadgetconfiguration.h
|
||||||
HEADERS += gpsdisplaygadgetoptionspage.h
|
HEADERS += gpsdisplaygadgetoptionspage.h
|
||||||
SOURCES += gpsdisplayplugin.cpp
|
SOURCES += gpsdisplayplugin.cpp \
|
||||||
|
gpsconstellationwidget.cpp \
|
||||||
|
gpsparser.cpp \
|
||||||
|
telemetryparser.cpp
|
||||||
SOURCES += buffer.cpp
|
SOURCES += buffer.cpp
|
||||||
SOURCES += nmeaparser.cpp
|
SOURCES += nmeaparser.cpp
|
||||||
SOURCES += gpsdisplaygadget.cpp
|
SOURCES += gpsdisplaygadget.cpp
|
||||||
|
@ -48,6 +48,8 @@ GpsDisplayGadget::~GpsDisplayGadget()
|
|||||||
void GpsDisplayGadget::loadConfiguration(IUAVGadgetConfiguration* config)
|
void GpsDisplayGadget::loadConfiguration(IUAVGadgetConfiguration* config)
|
||||||
{
|
{
|
||||||
GpsDisplayGadgetConfiguration *m = qobject_cast< GpsDisplayGadgetConfiguration*>(config);
|
GpsDisplayGadgetConfiguration *m = qobject_cast< GpsDisplayGadgetConfiguration*>(config);
|
||||||
|
|
||||||
|
if (m->connectionMode() == "Serial") {
|
||||||
PortSettings portsettings;
|
PortSettings portsettings;
|
||||||
portsettings.BaudRate=m->speed();
|
portsettings.BaudRate=m->speed();
|
||||||
portsettings.DataBits=m->dataBits();
|
portsettings.DataBits=m->dataBits();
|
||||||
@ -66,7 +68,14 @@ void GpsDisplayGadget::loadConfiguration(IUAVGadgetConfiguration* config)
|
|||||||
QextSerialPort *port=new QextSerialPort(nport.physName,portsettings,QextSerialPort::EventDriven);
|
QextSerialPort *port=new QextSerialPort(nport.physName,portsettings,QextSerialPort::EventDriven);
|
||||||
#endif
|
#endif
|
||||||
//Creates new serial port with the user configuration and passes it to the widget
|
//Creates new serial port with the user configuration and passes it to the widget
|
||||||
|
m_widget->setParser(QString("Serial"));
|
||||||
m_widget->setPort(port);
|
m_widget->setPort(port);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else if (m->connectionMode() == "Telemetry") {
|
||||||
|
m_widget->setParser(QString("Telemetry"));
|
||||||
|
|
||||||
|
} else if (m->connectionMode() == "Network") {
|
||||||
|
// Not implemented for now...
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -35,6 +35,7 @@
|
|||||||
*/
|
*/
|
||||||
GpsDisplayGadgetConfiguration::GpsDisplayGadgetConfiguration(QString classId, const QByteArray &state, QObject *parent) :
|
GpsDisplayGadgetConfiguration::GpsDisplayGadgetConfiguration(QString classId, const QByteArray &state, QObject *parent) :
|
||||||
IUAVGadgetConfiguration(classId, parent),
|
IUAVGadgetConfiguration(classId, parent),
|
||||||
|
m_connectionMode("Serial"),
|
||||||
m_defaultPort("Unknown"),
|
m_defaultPort("Unknown"),
|
||||||
m_defaultSpeed(BAUD4800),
|
m_defaultSpeed(BAUD4800),
|
||||||
m_defaultDataBits(DATA_8),
|
m_defaultDataBits(DATA_8),
|
||||||
@ -42,7 +43,6 @@ GpsDisplayGadgetConfiguration::GpsDisplayGadgetConfiguration(QString classId, co
|
|||||||
m_defaultParity(PAR_NONE),
|
m_defaultParity(PAR_NONE),
|
||||||
m_defaultStopBits(STOP_1),
|
m_defaultStopBits(STOP_1),
|
||||||
m_defaultTimeOut(5000)
|
m_defaultTimeOut(5000)
|
||||||
|
|
||||||
{
|
{
|
||||||
//if a saved configuration exists load it
|
//if a saved configuration exists load it
|
||||||
if (state.count() > 0) {
|
if (state.count() > 0) {
|
||||||
@ -58,12 +58,14 @@ GpsDisplayGadgetConfiguration::GpsDisplayGadgetConfiguration(QString classId, co
|
|||||||
int iparity;
|
int iparity;
|
||||||
int istopbits;
|
int istopbits;
|
||||||
QString port;
|
QString port;
|
||||||
|
QString conMode;
|
||||||
stream >> ispeed;
|
stream >> ispeed;
|
||||||
stream >> idatabits;
|
stream >> idatabits;
|
||||||
stream >>iflow;
|
stream >>iflow;
|
||||||
stream >>iparity;
|
stream >>iparity;
|
||||||
stream >> istopbits;
|
stream >> istopbits;
|
||||||
stream >> port;
|
stream >> port;
|
||||||
|
stream >> conMode;
|
||||||
|
|
||||||
databits = (DataBitsType) idatabits;
|
databits = (DataBitsType) idatabits;
|
||||||
flow = (FlowType)iflow;
|
flow = (FlowType)iflow;
|
||||||
@ -76,6 +78,7 @@ GpsDisplayGadgetConfiguration::GpsDisplayGadgetConfiguration(QString classId, co
|
|||||||
m_defaultFlow = flow;
|
m_defaultFlow = flow;
|
||||||
m_defaultParity = parity;
|
m_defaultParity = parity;
|
||||||
m_defaultStopBits = stopbits;
|
m_defaultStopBits = stopbits;
|
||||||
|
m_connectionMode = conMode;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -95,6 +98,7 @@ IUAVGadgetConfiguration *GpsDisplayGadgetConfiguration::clone()
|
|||||||
m->m_defaultParity = m_defaultParity;
|
m->m_defaultParity = m_defaultParity;
|
||||||
m->m_defaultStopBits = m_defaultStopBits;
|
m->m_defaultStopBits = m_defaultStopBits;
|
||||||
m->m_defaultPort = m_defaultPort;
|
m->m_defaultPort = m_defaultPort;
|
||||||
|
m->m_connectionMode = m_connectionMode;
|
||||||
return m;
|
return m;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -112,5 +116,6 @@ QByteArray GpsDisplayGadgetConfiguration::saveState() const
|
|||||||
stream << (int)m_defaultParity;
|
stream << (int)m_defaultParity;
|
||||||
stream << (int)m_defaultStopBits;
|
stream << (int)m_defaultStopBits;
|
||||||
stream << m_defaultPort;
|
stream << m_defaultPort;
|
||||||
|
stream << m_connectionMode;
|
||||||
return bytes;
|
return bytes;
|
||||||
}
|
}
|
||||||
|
@ -39,6 +39,9 @@ class GpsDisplayGadgetConfiguration : public IUAVGadgetConfiguration
|
|||||||
public:
|
public:
|
||||||
explicit GpsDisplayGadgetConfiguration(QString classId, const QByteArray &state = 0, QObject *parent = 0);
|
explicit GpsDisplayGadgetConfiguration(QString classId, const QByteArray &state = 0, QObject *parent = 0);
|
||||||
|
|
||||||
|
void setConnectionMode(QString mode) { m_connectionMode = mode; }
|
||||||
|
QString connectionMode() { return m_connectionMode; }
|
||||||
|
|
||||||
//set port configuration functions
|
//set port configuration functions
|
||||||
void setSpeed(BaudRateType speed) {m_defaultSpeed=speed;}
|
void setSpeed(BaudRateType speed) {m_defaultSpeed=speed;}
|
||||||
void setDataBits(DataBitsType databits) {m_defaultDataBits=databits;}
|
void setDataBits(DataBitsType databits) {m_defaultDataBits=databits;}
|
||||||
@ -61,6 +64,7 @@ class GpsDisplayGadgetConfiguration : public IUAVGadgetConfiguration
|
|||||||
IUAVGadgetConfiguration *clone();
|
IUAVGadgetConfiguration *clone();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
QString m_connectionMode;
|
||||||
QString m_defaultPort;
|
QString m_defaultPort;
|
||||||
BaudRateType m_defaultSpeed;
|
BaudRateType m_defaultSpeed;
|
||||||
DataBitsType m_defaultDataBits;
|
DataBitsType m_defaultDataBits;
|
||||||
|
@ -227,6 +227,13 @@ QWidget *GpsDisplayGadgetOptionsPage::createPage(QWidget *parent)
|
|||||||
// TIMEOUT
|
// TIMEOUT
|
||||||
options_page->timeoutSpinBox->setValue(m_config->timeOut());
|
options_page->timeoutSpinBox->setValue(m_config->timeOut());
|
||||||
|
|
||||||
|
QStringList connectionModes;
|
||||||
|
connectionModes << "Serial" << "Network" << "Telemetry";
|
||||||
|
options_page->connectionMode->addItems(connectionModes);
|
||||||
|
int conMode = options_page->connectionMode->findText(m_config->connectionMode());
|
||||||
|
if (conMode != -1)
|
||||||
|
options_page->connectionMode->setCurrentIndex(conMode);
|
||||||
|
|
||||||
|
|
||||||
return optionsPageWidget;
|
return optionsPageWidget;
|
||||||
}
|
}
|
||||||
@ -249,6 +256,8 @@ void GpsDisplayGadgetOptionsPage::apply()
|
|||||||
m_config->setStopBits((StopBitsType)StopBitsTypeStringALL.indexOf(options_page->stopBitsComboBox->currentText()));
|
m_config->setStopBits((StopBitsType)StopBitsTypeStringALL.indexOf(options_page->stopBitsComboBox->currentText()));
|
||||||
m_config->setParity((ParityType)ParityTypeStringALL.indexOf(options_page->parityComboBox->currentText()));
|
m_config->setParity((ParityType)ParityTypeStringALL.indexOf(options_page->parityComboBox->currentText()));
|
||||||
m_config->setTimeOut( options_page->timeoutSpinBox->value());
|
m_config->setTimeOut( options_page->timeoutSpinBox->value());
|
||||||
|
m_config->setConnectionMode(options_page->connectionMode->currentText());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GpsDisplayGadgetOptionsPage::finish()
|
void GpsDisplayGadgetOptionsPage::finish()
|
||||||
|
@ -6,8 +6,8 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>486</width>
|
<width>587</width>
|
||||||
<height>300</height>
|
<height>359</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
@ -38,13 +38,13 @@
|
|||||||
<string>Mode:</string>
|
<string>Mode:</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QComboBox" name="comboBox">
|
<widget class="QComboBox" name="connectionMode">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>50</x>
|
<x>50</x>
|
||||||
<y>10</y>
|
<y>1</y>
|
||||||
<width>69</width>
|
<width>101</width>
|
||||||
<height>22</height>
|
<height>31</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
@ -64,84 +64,84 @@
|
|||||||
<widget class="QWidget" name="formLayoutWidget">
|
<widget class="QWidget" name="formLayoutWidget">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>50</x>
|
<x>10</x>
|
||||||
<y>50</y>
|
<y>73</y>
|
||||||
<width>421</width>
|
<width>221</width>
|
||||||
<height>201</height>
|
<height>261</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QFormLayout" name="formLayout">
|
<layout class="QFormLayout" name="formLayout">
|
||||||
<property name="fieldGrowthPolicy">
|
<property name="fieldGrowthPolicy">
|
||||||
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
|
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
|
||||||
</property>
|
</property>
|
||||||
<item row="1" column="0">
|
<item row="0" column="0">
|
||||||
<widget class="QLabel" name="portLabel">
|
<widget class="QLabel" name="portLabel">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Port:</string>
|
<string>Port:</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="1">
|
<item row="0" column="1">
|
||||||
<widget class="QComboBox" name="portComboBox"/>
|
<widget class="QComboBox" name="portComboBox"/>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="0">
|
<item row="1" column="0">
|
||||||
<widget class="QLabel" name="portSpeedLabel">
|
<widget class="QLabel" name="portSpeedLabel">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Port Speed:</string>
|
<string>Port Speed:</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="1">
|
<item row="1" column="1">
|
||||||
<widget class="QComboBox" name="portSpeedComboBox"/>
|
<widget class="QComboBox" name="portSpeedComboBox"/>
|
||||||
</item>
|
</item>
|
||||||
<item row="3" column="0">
|
<item row="2" column="0">
|
||||||
<widget class="QLabel" name="flowControlLabel">
|
<widget class="QLabel" name="flowControlLabel">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Flow Control:</string>
|
<string>Flow Control:</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="3" column="1">
|
<item row="2" column="1">
|
||||||
<widget class="QComboBox" name="flowControlComboBox"/>
|
<widget class="QComboBox" name="flowControlComboBox"/>
|
||||||
</item>
|
</item>
|
||||||
<item row="4" column="0">
|
<item row="3" column="0">
|
||||||
<widget class="QLabel" name="dataBitsLabel">
|
<widget class="QLabel" name="dataBitsLabel">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Data Bits:</string>
|
<string>Data Bits:</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="4" column="1">
|
<item row="3" column="1">
|
||||||
<widget class="QComboBox" name="dataBitsComboBox"/>
|
<widget class="QComboBox" name="dataBitsComboBox"/>
|
||||||
</item>
|
</item>
|
||||||
<item row="5" column="0">
|
<item row="4" column="0">
|
||||||
<widget class="QLabel" name="stopBitsLabel">
|
<widget class="QLabel" name="stopBitsLabel">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Stop Bits:</string>
|
<string>Stop Bits:</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="5" column="1">
|
<item row="4" column="1">
|
||||||
<widget class="QComboBox" name="stopBitsComboBox"/>
|
<widget class="QComboBox" name="stopBitsComboBox"/>
|
||||||
</item>
|
</item>
|
||||||
<item row="6" column="0">
|
<item row="5" column="0">
|
||||||
<widget class="QLabel" name="parityLabel">
|
<widget class="QLabel" name="parityLabel">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Parity:</string>
|
<string>Parity:</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="6" column="1">
|
<item row="5" column="1">
|
||||||
<widget class="QComboBox" name="parityComboBox"/>
|
<widget class="QComboBox" name="parityComboBox"/>
|
||||||
</item>
|
</item>
|
||||||
<item row="7" column="0">
|
<item row="6" column="0">
|
||||||
<widget class="QLabel" name="timeoutLabel">
|
<widget class="QLabel" name="timeoutLabel">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Timeout(ms):</string>
|
<string>Timeout(ms):</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="7" column="1">
|
<item row="6" column="1">
|
||||||
<widget class="QSpinBox" name="timeoutSpinBox">
|
<widget class="QSpinBox" name="timeoutSpinBox">
|
||||||
<property name="maximum">
|
<property name="maximum">
|
||||||
<number>100000</number>
|
<number>100000</number>
|
||||||
@ -150,6 +150,32 @@
|
|||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
|
<widget class="QLabel" name="label_3">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>280</x>
|
||||||
|
<y>50</y>
|
||||||
|
<width>111</width>
|
||||||
|
<height>17</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>IP Connection</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QLabel" name="label_2">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>60</x>
|
||||||
|
<y>50</y>
|
||||||
|
<width>125</width>
|
||||||
|
<height>17</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Serial Connection</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
|
@ -34,6 +34,7 @@
|
|||||||
#include <QtGui>
|
#include <QtGui>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include "nmeaparser.h"
|
#include "nmeaparser.h"
|
||||||
|
#include "telemetryparser.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -45,20 +46,6 @@ GpsDisplayWidget::GpsDisplayWidget(QWidget *parent) : QWidget(parent)
|
|||||||
widget = new Ui_GpsDisplayWidget();
|
widget = new Ui_GpsDisplayWidget();
|
||||||
widget->setupUi(this);
|
widget->setupUi(this);
|
||||||
|
|
||||||
QGraphicsScene *scene = new QGraphicsScene(this);
|
|
||||||
QSvgRenderer *renderer = new QSvgRenderer();
|
|
||||||
QGraphicsSvgItem *world = new QGraphicsSvgItem();
|
|
||||||
renderer->load(QString(":/gpsgadget/images/gpsEarth.svg"));
|
|
||||||
world->setSharedRenderer(renderer);
|
|
||||||
world->setElementId("map");
|
|
||||||
scene->addItem(world);
|
|
||||||
scene->setSceneRect(world->boundingRect());
|
|
||||||
widget->gpsWorld->setScene(scene);
|
|
||||||
|
|
||||||
// Scale, can't use fitInView since that doesn't work until we're shown.
|
|
||||||
qreal factor = widget->gpsWorld->size().height()/world->boundingRect().height();
|
|
||||||
world->setScale(factor);
|
|
||||||
|
|
||||||
//Not elegant, just load the image for now
|
//Not elegant, just load the image for now
|
||||||
QGraphicsScene *fescene = new QGraphicsScene(this);
|
QGraphicsScene *fescene = new QGraphicsScene(this);
|
||||||
QPixmap earthpix( ":/gpsgadget/images/flatEarth.png" );
|
QPixmap earthpix( ":/gpsgadget/images/flatEarth.png" );
|
||||||
@ -69,14 +56,6 @@ GpsDisplayWidget::GpsDisplayWidget(QWidget *parent) : QWidget(parent)
|
|||||||
this,SLOT(connectButtonClicked()));
|
this,SLOT(connectButtonClicked()));
|
||||||
connect(widget->disconnectButton, SIGNAL(clicked(bool)),
|
connect(widget->disconnectButton, SIGNAL(clicked(bool)),
|
||||||
this,SLOT(disconnectButtonClicked()));
|
this,SLOT(disconnectButtonClicked()));
|
||||||
parser=new NMEAParser();
|
|
||||||
connect(parser,SIGNAL(sv(int)),this,SLOT(setSVs(int)));
|
|
||||||
connect(parser,SIGNAL(position(double,double,double)),this,SLOT(setPosition(double,double,double)));
|
|
||||||
connect(parser,SIGNAL(speedheading(double,double)),this,SLOT(setSpeedHeading(double,double)));
|
|
||||||
connect(parser,SIGNAL(datetime(double,double)),this,SLOT(setDateTime(double,double)));
|
|
||||||
connect(parser,SIGNAL(packet(char*)), this, SLOT(dumpPacket(char*)));
|
|
||||||
|
|
||||||
port = NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
GpsDisplayWidget::~GpsDisplayWidget()
|
GpsDisplayWidget::~GpsDisplayWidget()
|
||||||
@ -143,16 +122,38 @@ void GpsDisplayWidget::setPosition(double lat, double lon, double alt)
|
|||||||
//widget->textBrowser->append(temp);
|
//widget->textBrowser->append(temp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void GpsDisplayWidget::setPort(QextSerialPort* port)
|
void GpsDisplayWidget::setPort(QextSerialPort* port)
|
||||||
{
|
{
|
||||||
|
|
||||||
this->port=port;
|
this->port=port;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GpsDisplayWidget::setParser(NMEAParser* parser)
|
void GpsDisplayWidget::setParser(QString connectionMode)
|
||||||
{
|
{
|
||||||
|
|
||||||
this->parser=parser;
|
if (connectionMode == "Serial") {
|
||||||
|
parser = new NMEAParser();
|
||||||
|
widget->connectButton->setEnabled(true);
|
||||||
|
widget->disconnectButton->setEnabled(false);
|
||||||
|
|
||||||
|
} else if (connectionMode == "Telemetry") {
|
||||||
|
parser = new TelemetryParser();
|
||||||
|
widget->connectButton->setEnabled(false);
|
||||||
|
widget->disconnectButton->setEnabled(false);
|
||||||
|
} else {
|
||||||
|
parser = new NMEAParser(); // for the time being...
|
||||||
|
}
|
||||||
|
|
||||||
|
connect(parser,SIGNAL(sv(int)),this,SLOT(setSVs(int)));
|
||||||
|
connect(parser,SIGNAL(position(double,double,double)),this,SLOT(setPosition(double,double,double)));
|
||||||
|
connect(parser,SIGNAL(speedheading(double,double)),this,SLOT(setSpeedHeading(double,double)));
|
||||||
|
connect(parser,SIGNAL(datetime(double,double)),this,SLOT(setDateTime(double,double)));
|
||||||
|
connect(parser,SIGNAL(packet(char*)), this, SLOT(dumpPacket(char*)));
|
||||||
|
connect(parser, SIGNAL(satellite(int,int,int,int,int)), widget->gpsSky, SLOT(updateSat(int,int,int,int,int)))
|
||||||
|
;
|
||||||
|
port = NULL;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GpsDisplayWidget::connectButtonClicked() {
|
void GpsDisplayWidget::connectButtonClicked() {
|
||||||
|
@ -29,6 +29,7 @@
|
|||||||
#define GPSDISPLAYWIDGET_H_
|
#define GPSDISPLAYWIDGET_H_
|
||||||
|
|
||||||
#include "gpsdisplaygadgetconfiguration.h"
|
#include "gpsdisplaygadgetconfiguration.h"
|
||||||
|
#include "gpsconstellationwidget.h"
|
||||||
#include "uavobjects/uavobject.h"
|
#include "uavobjects/uavobject.h"
|
||||||
#include <QGraphicsView>
|
#include <QGraphicsView>
|
||||||
#include <QtSvg/QSvgRenderer>
|
#include <QtSvg/QSvgRenderer>
|
||||||
@ -50,7 +51,7 @@ public:
|
|||||||
|
|
||||||
// void setMode(QString mode); // Either UAVTalk or serial port
|
// void setMode(QString mode); // Either UAVTalk or serial port
|
||||||
void setPort(QextSerialPort* port);
|
void setPort(QextSerialPort* port);
|
||||||
void setParser(NMEAParser *parser);
|
void setParser(QString connectionMode);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void connectButtonClicked();
|
void connectButtonClicked();
|
||||||
@ -65,8 +66,9 @@ private slots:
|
|||||||
private:
|
private:
|
||||||
void processNewSerialData(QByteArray serialData);
|
void processNewSerialData(QByteArray serialData);
|
||||||
Ui_GpsDisplayWidget* widget;
|
Ui_GpsDisplayWidget* widget;
|
||||||
|
GpsConstellationWidget * gpsConstellation;
|
||||||
QextSerialPort *port;
|
QextSerialPort *port;
|
||||||
NMEAParser *parser;
|
GPSParser *parser;
|
||||||
bool connected;
|
bool connected;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@ -187,54 +187,6 @@
|
|||||||
<height>171</height>
|
<height>171</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QGraphicsView" name="gpsWorld">
|
|
||||||
<property name="geometry">
|
|
||||||
<rect>
|
|
||||||
<x>0</x>
|
|
||||||
<y>0</y>
|
|
||||||
<width>171</width>
|
|
||||||
<height>171</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="minimumSize">
|
|
||||||
<size>
|
|
||||||
<width>171</width>
|
|
||||||
<height>171</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="maximumSize">
|
|
||||||
<size>
|
|
||||||
<width>171</width>
|
|
||||||
<height>171</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="acceptDrops">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
<property name="toolTip">
|
|
||||||
<string extracomment="Shows locations of satellites"/>
|
|
||||||
</property>
|
|
||||||
<property name="verticalScrollBarPolicy">
|
|
||||||
<enum>Qt::ScrollBarAlwaysOff</enum>
|
|
||||||
</property>
|
|
||||||
<property name="horizontalScrollBarPolicy">
|
|
||||||
<enum>Qt::ScrollBarAlwaysOff</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sceneRect">
|
|
||||||
<rectf>
|
|
||||||
<x>0.000000000000000</x>
|
|
||||||
<y>0.000000000000000</y>
|
|
||||||
<width>169.000000000000000</width>
|
|
||||||
<height>169.000000000000000</height>
|
|
||||||
</rectf>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
<widget class="QGraphicsView" name="flatEarth">
|
<widget class="QGraphicsView" name="flatEarth">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
@ -278,39 +230,15 @@
|
|||||||
<set>QGraphicsView::DontAdjustForAntialiasing</set>
|
<set>QGraphicsView::DontAdjustForAntialiasing</set>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QGraphicsView" name="gpsGraph">
|
<widget class="GpsConstellationWidget" name="gpsSky">
|
||||||
<property name="enabled">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>177</x>
|
<x>0</x>
|
||||||
<y>104</y>
|
<y>0</y>
|
||||||
<width>191</width>
|
<width>171</width>
|
||||||
<height>67</height>
|
<height>151</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="minimumSize">
|
|
||||||
<size>
|
|
||||||
<width>191</width>
|
|
||||||
<height>67</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="maximumSize">
|
|
||||||
<size>
|
|
||||||
<width>191</width>
|
|
||||||
<height>67</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="toolTip">
|
|
||||||
<string extracomment="Individual satellite information"/>
|
|
||||||
</property>
|
|
||||||
</widget>
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
@ -407,6 +335,13 @@
|
|||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
|
<customwidgets>
|
||||||
|
<customwidget>
|
||||||
|
<class>GpsConstellationWidget</class>
|
||||||
|
<extends>QGraphicsView</extends>
|
||||||
|
<header>gpsconstellationwidget.h</header>
|
||||||
|
</customwidget>
|
||||||
|
</customwidgets>
|
||||||
<resources/>
|
<resources/>
|
||||||
<connections/>
|
<connections/>
|
||||||
</ui>
|
</ui>
|
||||||
|
28
ground/src/plugins/gpsdisplay/gpsparser.cpp
Normal file
28
ground/src/plugins/gpsdisplay/gpsparser.cpp
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
/**
|
||||||
|
******************************************************************************
|
||||||
|
*
|
||||||
|
* @file gpsparser.cpp
|
||||||
|
* @author Sami Korhonen Copyright (C) 2010.
|
||||||
|
* @addtogroup GCSPlugins GCS Plugins
|
||||||
|
* @{
|
||||||
|
* @addtogroup GPSGadgetPlugin GPS Gadget Plugin
|
||||||
|
* @{
|
||||||
|
* @brief A gadget that displays GPS status and enables basic configuration
|
||||||
|
*****************************************************************************/
|
||||||
|
/*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
* This program 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 this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
|
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "gpsparser.h"
|
51
ground/src/plugins/gpsdisplay/gpsparser.h
Normal file
51
ground/src/plugins/gpsdisplay/gpsparser.h
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
/**
|
||||||
|
******************************************************************************
|
||||||
|
*
|
||||||
|
* @file gpsparser.h
|
||||||
|
* @author Sami Korhonen Copyright (C) 2010.
|
||||||
|
* @addtogroup GCSPlugins GCS Plugins
|
||||||
|
* @{
|
||||||
|
* @addtogroup GPSGadgetPlugin GPS Gadget Plugin
|
||||||
|
* @{
|
||||||
|
* @brief A gadget that displays GPS status and enables basic configuration
|
||||||
|
*****************************************************************************/
|
||||||
|
/*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
* This program 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 this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
|
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef GPSPARSER_H
|
||||||
|
#define GPSPARSER_H
|
||||||
|
|
||||||
|
#include <QObject>
|
||||||
|
#include <QtCore>
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
|
||||||
|
class GPSParser: public QObject
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
void processInputStream(char c) { Q_UNUSED(c)};
|
||||||
|
signals:
|
||||||
|
void sv(int); // Satellites in view
|
||||||
|
void position(double,double,double); // Lat, Lon, Alt
|
||||||
|
void datetime(double,double); // Date then time
|
||||||
|
void speedheading(double,double);
|
||||||
|
void packet(char*); // Raw NMEA Packet (or just info)
|
||||||
|
void satellite(int,int,int,int,int); // Index, PRN, Elevation, Azimuth, SNR
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // GPSPARSER_H
|
@ -109,16 +109,16 @@
|
|||||||
borderopacity="1.0"
|
borderopacity="1.0"
|
||||||
inkscape:pageopacity="0.0"
|
inkscape:pageopacity="0.0"
|
||||||
inkscape:pageshadow="2"
|
inkscape:pageshadow="2"
|
||||||
inkscape:zoom="0.98994949"
|
inkscape:zoom="0.7"
|
||||||
inkscape:cx="187.01425"
|
inkscape:cx="84.9969"
|
||||||
inkscape:cy="254.52868"
|
inkscape:cy="256.33672"
|
||||||
inkscape:document-units="px"
|
inkscape:document-units="px"
|
||||||
inkscape:current-layer="layer1"
|
inkscape:current-layer="map"
|
||||||
showgrid="false"
|
showgrid="false"
|
||||||
inkscape:window-width="1280"
|
inkscape:window-width="1366"
|
||||||
inkscape:window-height="744"
|
inkscape:window-height="693"
|
||||||
inkscape:window-x="-4"
|
inkscape:window-x="0"
|
||||||
inkscape:window-y="1020"
|
inkscape:window-y="24"
|
||||||
inkscape:window-maximized="1" />
|
inkscape:window-maximized="1" />
|
||||||
<metadata
|
<metadata
|
||||||
id="metadata7">
|
id="metadata7">
|
||||||
@ -185,7 +185,7 @@
|
|||||||
d="m 451.12161,342.96352 c 37.2498,32.4066 41.17599,88.87427 8.76939,126.12407 -32.4066,37.2498 -88.87426,41.17599 -126.12407,8.76939 -37.2498,-32.4066 -41.17598,-88.87427 -8.76938,-126.12407 29.53979,-33.95454 79.71538,-40.65585 117.1306,-15.64362"
|
d="m 451.12161,342.96352 c 37.2498,32.4066 41.17599,88.87427 8.76939,126.12407 -32.4066,37.2498 -88.87426,41.17599 -126.12407,8.76939 -37.2498,-32.4066 -41.17598,-88.87427 -8.76938,-126.12407 29.53979,-33.95454 79.71538,-40.65585 117.1306,-15.64362"
|
||||||
transform="matrix(1.9716104,0,0,1.9716104,-399.86707,-407.46887)" />
|
transform="matrix(1.9716104,0,0,1.9716104,-399.86707,-407.46887)" />
|
||||||
<g
|
<g
|
||||||
transform="translate(2.1015148,0)"
|
transform="translate(2.1015148,18)"
|
||||||
id="g3618">
|
id="g3618">
|
||||||
<rect
|
<rect
|
||||||
style="fill:#acbbf0;fill-opacity:1;stroke:#909196;stroke-width:4;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0"
|
style="fill:#acbbf0;fill-opacity:1;stroke:#909196;stroke-width:4;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0"
|
||||||
@ -208,7 +208,7 @@
|
|||||||
y="182.85712">N</tspan></text>
|
y="182.85712">N</tspan></text>
|
||||||
</g>
|
</g>
|
||||||
<g
|
<g
|
||||||
transform="translate(0,-0.53294563)"
|
transform="translate(-12,-0.53294563)"
|
||||||
id="g3695">
|
id="g3695">
|
||||||
<rect
|
<rect
|
||||||
style="fill:#acbbf0;fill-opacity:1;stroke:#909196;stroke-width:4;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0"
|
style="fill:#acbbf0;fill-opacity:1;stroke:#909196;stroke-width:4;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0"
|
||||||
@ -231,7 +231,7 @@
|
|||||||
y="414.77591">E</tspan></text>
|
y="414.77591">E</tspan></text>
|
||||||
</g>
|
</g>
|
||||||
<g
|
<g
|
||||||
transform="translate(-0.40098763,0)"
|
transform="translate(-0.40098763,-18)"
|
||||||
id="g3707">
|
id="g3707">
|
||||||
<rect
|
<rect
|
||||||
style="fill:#acbbf0;fill-opacity:1;stroke:#909196;stroke-width:4;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0"
|
style="fill:#acbbf0;fill-opacity:1;stroke:#909196;stroke-width:4;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0"
|
||||||
@ -254,7 +254,7 @@
|
|||||||
y="640.0907">S</tspan></text>
|
y="640.0907">S</tspan></text>
|
||||||
</g>
|
</g>
|
||||||
<g
|
<g
|
||||||
transform="translate(2.502516,459.47727)"
|
transform="translate(22.502516,459.47727)"
|
||||||
id="g3687">
|
id="g3687">
|
||||||
<rect
|
<rect
|
||||||
ry="3.3283663"
|
ry="3.3283663"
|
||||||
@ -311,7 +311,7 @@
|
|||||||
</g>
|
</g>
|
||||||
<g
|
<g
|
||||||
id="satellite"
|
id="satellite"
|
||||||
transform="matrix(0.73446976,0,0,0.73446976,137.3895,45.89308)"
|
transform="matrix(0.93879118,0,0,0.93879118,26.496058,0.9451615)"
|
||||||
inkscape:label="#g3722">
|
inkscape:label="#g3722">
|
||||||
<path
|
<path
|
||||||
transform="translate(0.08444214,0)"
|
transform="translate(0.08444214,0)"
|
||||||
@ -321,7 +321,7 @@
|
|||||||
sodipodi:cy="195.93361"
|
sodipodi:cy="195.93361"
|
||||||
sodipodi:cx="569.28571"
|
sodipodi:cx="569.28571"
|
||||||
id="path3712"
|
id="path3712"
|
||||||
style="fill:#fff954;fill-opacity:1;stroke:#fcaa21;stroke-width:2;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
|
style="fill:#fff954;fill-opacity:1;stroke:#fcaa21;stroke-width:1.56471384;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
|
||||||
sodipodi:type="arc" />
|
sodipodi:type="arc" />
|
||||||
<rect
|
<rect
|
||||||
ry="2.2728431"
|
ry="2.2728431"
|
||||||
@ -330,9 +330,9 @@
|
|||||||
height="45.456863"
|
height="45.456863"
|
||||||
width="4.5456862"
|
width="4.5456862"
|
||||||
id="rect3718"
|
id="rect3718"
|
||||||
style="fill:#fff954;fill-opacity:1;stroke:#fcaa21;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0" />
|
style="fill:#fff954;fill-opacity:1;stroke:#fcaa21;stroke-width:1.56471384;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0" />
|
||||||
<rect
|
<rect
|
||||||
style="fill:#fff954;fill-opacity:1;stroke:#fcaa21;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0"
|
style="fill:#fff954;fill-opacity:1;stroke:#fcaa21;stroke-width:1.56471384;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0"
|
||||||
id="rect3720"
|
id="rect3720"
|
||||||
width="4.5456862"
|
width="4.5456862"
|
||||||
height="45.456863"
|
height="45.456863"
|
||||||
@ -340,5 +340,37 @@
|
|||||||
y="173.52946"
|
y="173.52946"
|
||||||
ry="2.2728431" />
|
ry="2.2728431" />
|
||||||
</g>
|
</g>
|
||||||
|
<g
|
||||||
|
inkscape:label="#g3722"
|
||||||
|
transform="matrix(0.93879118,0,0,0.93879118,-357.05733,0.9451615)"
|
||||||
|
id="sat-notSeen"
|
||||||
|
style="opacity:0.4">
|
||||||
|
<path
|
||||||
|
sodipodi:type="arc"
|
||||||
|
style="fill:#fff954;fill-opacity:1;stroke:#fcaa21;stroke-width:1.56471384000000002;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
|
||||||
|
id="path3069"
|
||||||
|
sodipodi:cx="569.28571"
|
||||||
|
sodipodi:cy="195.93361"
|
||||||
|
sodipodi:rx="20.714285"
|
||||||
|
sodipodi:ry="20.714285"
|
||||||
|
d="m 589.99999,195.93361 c 0,11.44018 -9.2741,20.71428 -20.71428,20.71428 -11.44019,0 -20.71429,-9.2741 -20.71429,-20.71428 0,-11.44018 9.2741,-20.71429 20.71429,-20.71429 11.44018,0 20.71428,9.27411 20.71428,20.71429 z"
|
||||||
|
transform="translate(0.08444214,0)" />
|
||||||
|
<rect
|
||||||
|
style="fill:#fff954;fill-opacity:1;stroke:#fcaa21;stroke-width:1.56471384000000002;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0"
|
||||||
|
id="rect3071"
|
||||||
|
width="4.5456862"
|
||||||
|
height="45.456863"
|
||||||
|
x="590.45447"
|
||||||
|
y="173.52946"
|
||||||
|
ry="2.2728431" />
|
||||||
|
<rect
|
||||||
|
ry="2.2728431"
|
||||||
|
y="173.52946"
|
||||||
|
x="543.74017"
|
||||||
|
height="45.456863"
|
||||||
|
width="4.5456862"
|
||||||
|
id="rect3073"
|
||||||
|
style="fill:#fff954;fill-opacity:1;stroke:#fcaa21;stroke-width:1.56471384000000002;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0" />
|
||||||
|
</g>
|
||||||
</g>
|
</g>
|
||||||
</svg>
|
</svg>
|
||||||
|
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 20 KiB |
@ -63,7 +63,7 @@
|
|||||||
/**
|
/**
|
||||||
* Initialize the parser
|
* Initialize the parser
|
||||||
*/
|
*/
|
||||||
NMEAParser::NMEAParser(QObject *parent):QObject(parent)
|
NMEAParser::NMEAParser(QObject *parent):GPSParser()
|
||||||
{
|
{
|
||||||
bufferInit(&gpsRxBuffer, (unsigned char *)gpsRxData, 512);
|
bufferInit(&gpsRxBuffer, (unsigned char *)gpsRxData, 512);
|
||||||
gpsRxOverflow=0;
|
gpsRxOverflow=0;
|
||||||
|
@ -32,6 +32,7 @@
|
|||||||
#include <QtCore>
|
#include <QtCore>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include "buffer.h"
|
#include "buffer.h"
|
||||||
|
#include "gpsparser.h"
|
||||||
|
|
||||||
// constants/macros/typdefs
|
// constants/macros/typdefs
|
||||||
#define NMEA_BUFFERSIZE 128
|
#define NMEA_BUFFERSIZE 128
|
||||||
@ -54,9 +55,9 @@ typedef struct struct_GpsData
|
|||||||
|
|
||||||
}GpsData_t;
|
}GpsData_t;
|
||||||
|
|
||||||
class NMEAParser: public QObject
|
class NMEAParser: public GPSParser
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
|
||||||
public:
|
public:
|
||||||
NMEAParser(QObject *parent = 0);
|
NMEAParser(QObject *parent = 0);
|
||||||
~NMEAParser();
|
~NMEAParser();
|
||||||
@ -76,13 +77,7 @@ public:
|
|||||||
uint32_t numUpdates;
|
uint32_t numUpdates;
|
||||||
uint32_t numErrors;
|
uint32_t numErrors;
|
||||||
int32_t gpsRxOverflow;
|
int32_t gpsRxOverflow;
|
||||||
signals:
|
|
||||||
void sv(int);
|
|
||||||
void position(double,double,double);
|
|
||||||
void datetime(double,double);
|
|
||||||
void speedheading(double,double);
|
|
||||||
void packet(char*);
|
|
||||||
private slots:
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // NMEAPARSER_H
|
#endif // NMEAPARSER_H
|
||||||
|
112
ground/src/plugins/gpsdisplay/telemetryparser.cpp
Normal file
112
ground/src/plugins/gpsdisplay/telemetryparser.cpp
Normal file
@ -0,0 +1,112 @@
|
|||||||
|
/**
|
||||||
|
******************************************************************************
|
||||||
|
*
|
||||||
|
* @file telemetryparser.cpp
|
||||||
|
* @author Edouard Lafargue & the OpenPilot team Copyright (C) 2010.
|
||||||
|
* @addtogroup GCSPlugins GCS Plugins
|
||||||
|
* @{
|
||||||
|
* @addtogroup GPSGadgetPlugin GPS Gadget Plugin
|
||||||
|
* @{
|
||||||
|
* @brief A gadget that displays GPS status and enables basic configuration
|
||||||
|
*****************************************************************************/
|
||||||
|
/*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
* This program 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 this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
|
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#include "telemetryparser.h"
|
||||||
|
#include <math.h>
|
||||||
|
#include <QDebug>
|
||||||
|
#include <QStringList>
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initialize the parser
|
||||||
|
*/
|
||||||
|
TelemetryParser::TelemetryParser(QObject *parent) : GPSParser()
|
||||||
|
{
|
||||||
|
Q_UNUSED(parent)
|
||||||
|
|
||||||
|
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
|
||||||
|
UAVObjectManager *objManager = pm->getObject<UAVObjectManager>();
|
||||||
|
UAVDataObject *gpsObj = dynamic_cast<UAVDataObject*>(objManager->getObject("GPSPosition"));
|
||||||
|
if (gpsObj != NULL) {
|
||||||
|
connect(gpsObj, SIGNAL(objectUpdated(UAVObject*)), this, SLOT(updateGPS(UAVObject*)));
|
||||||
|
} else {
|
||||||
|
qDebug() << "Error: Object is unknown (GPSPosition).";
|
||||||
|
}
|
||||||
|
|
||||||
|
gpsObj = dynamic_cast<UAVDataObject*>(objManager->getObject("GPSTime"));
|
||||||
|
if (gpsObj != NULL) {
|
||||||
|
connect(gpsObj, SIGNAL(objectUpdated(UAVObject*)), this, SLOT(updateTime(UAVObject*)));
|
||||||
|
} else {
|
||||||
|
qDebug() << "Error: Object is unknown (GPSTime).";
|
||||||
|
}
|
||||||
|
|
||||||
|
gpsObj = dynamic_cast<UAVDataObject*>(objManager->getObject("GPSSatellites"));
|
||||||
|
if (gpsObj != NULL) {
|
||||||
|
connect(gpsObj, SIGNAL(objectUpdated(UAVObject*)), this, SLOT(updateSats(UAVObject*)));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
TelemetryParser::~TelemetryParser()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void TelemetryParser::updateGPS( UAVObject* object1) {
|
||||||
|
UAVObjectField* field = object1->getField(QString("Satellites"));
|
||||||
|
emit sv(field->getValue().toInt());
|
||||||
|
|
||||||
|
double lat = object1->getField(QString("Latitude"))->getDouble();
|
||||||
|
double lon = object1->getField(QString("Longitude"))->getDouble();
|
||||||
|
double alt = object1->getField(QString("Altitude"))->getDouble();
|
||||||
|
emit position(lat,lon,alt);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void TelemetryParser::updateTime( UAVObject* object1) {
|
||||||
|
double hour = object1->getField(QString("Hour"))->getDouble();
|
||||||
|
double minute = object1->getField(QString("Minute"))->getDouble();
|
||||||
|
double second = object1->getField(QString("Second"))->getDouble();
|
||||||
|
double time = second + minute*100 + hour*10000;
|
||||||
|
double year = object1->getField(QString("Year"))->getDouble();
|
||||||
|
double month = object1->getField(QString("Month"))->getDouble();
|
||||||
|
double day = object1->getField(QString("Day"))->getDouble();
|
||||||
|
double date = day + month * 100 + year * 10000;
|
||||||
|
emit datetime(date,time);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Updates the satellite constellation.
|
||||||
|
|
||||||
|
Not really optimized for now, we should only send updates for the stas
|
||||||
|
which have changed instead of updating everything... That said, Qt is supposed
|
||||||
|
to be able to optimize redraws anyway.
|
||||||
|
*/
|
||||||
|
void TelemetryParser::updateSats( UAVObject* object1) {
|
||||||
|
UAVObjectField* prn = object1->getField(QString("PRN"));
|
||||||
|
UAVObjectField* elevation = object1->getField(QString("Elevation"));
|
||||||
|
UAVObjectField* azimuth = object1->getField(QString("Azimuth"));
|
||||||
|
UAVObjectField* snr = object1->getField(QString("SNR"));
|
||||||
|
|
||||||
|
for (int i=0;i< prn->getNumElements();i++) {
|
||||||
|
emit satellite(i,prn->getValue(i).toInt(),elevation->getValue(i).toInt(),
|
||||||
|
azimuth->getValue(i).toInt(), snr->getValue(i).toInt());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
55
ground/src/plugins/gpsdisplay/telemetryparser.h
Normal file
55
ground/src/plugins/gpsdisplay/telemetryparser.h
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
/**
|
||||||
|
******************************************************************************
|
||||||
|
*
|
||||||
|
* @file nmeaparser.h
|
||||||
|
* @author Edouard Lafargue & the OpenPilot team Copyright (C) 2010.
|
||||||
|
* @addtogroup GCSPlugins GCS Plugins
|
||||||
|
* @{
|
||||||
|
* @addtogroup GPSGadgetPlugin GPS Gadget Plugin
|
||||||
|
* @{
|
||||||
|
* @brief A gadget that displays GPS status and enables basic configuration
|
||||||
|
*****************************************************************************/
|
||||||
|
/*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
* This program 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 this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
|
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef TELEMETRYPARSER_H
|
||||||
|
#define TELEMETRYPARSER_H
|
||||||
|
|
||||||
|
#include <QObject>
|
||||||
|
#include <QtCore>
|
||||||
|
#include "extensionsystem/pluginmanager.h"
|
||||||
|
#include "uavobjects/uavobjectmanager.h"
|
||||||
|
#include "uavobjects/uavobject.h"
|
||||||
|
#include "gpsparser.h"
|
||||||
|
|
||||||
|
|
||||||
|
class TelemetryParser: public GPSParser
|
||||||
|
{
|
||||||
|
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
TelemetryParser(QObject *parent = 0);
|
||||||
|
~TelemetryParser();
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
void updateGPS(UAVObject* object1);
|
||||||
|
void updateTime(UAVObject* object1);
|
||||||
|
void updateSats(UAVObject* object1);
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // TELEMETRYPARSER_H
|
Loading…
x
Reference in New Issue
Block a user