Commit 9fdf57e3 authored by Lorenz Meier's avatar Lorenz Meier

Merge branch 'master' of github.com:mavlink/qgroundcontrol

parents 78083844 5a786171
......@@ -21,7 +21,6 @@ tmp
debug
release
/qgroundcontrol
mavlinkgen-build-desktop
qgroundcontrol.xcodeproj/**
doc/html
doc/doxy.log
......
......@@ -123,34 +123,6 @@ INCLUDEPATH += $$MAVLINKPATH
INCLUDEPATH += $$MAVLINKPATH/common
}
#
# [DEPRECATED] MAVLink generator UI. Provides a GUI interface for generating MAVLink dialects.
# Replaced by mavgenerator.py within the MAVLink project.
#
contains(DEFINES, ENABLE_MAVGEN) {
warning("Including support for MAVLink generator GUI (manual override from command line, CAUTION: deprecated)")
} else:infile(user_config.pri, DEFINES, ENABLE_MAVGEN) {
DEFINES += ENABLE_MAVGEN # infile doesn't automatically include everything in the specified file
warning("Including support for MAVLink generator GUI (manual override from user_config.pri, CAUTION: deprecated)")
}
contains(DEFINES, ENABLE_MAVGEN) {
# Rename the macro to be consistent with other QGC feature existance macros.
DEFINES -= ENABLE_MAVGEN
DEFINES += QGC_MAVGEN_ENABLED
DEPENDPATH += \
src/apps/mavlinkgen
INCLUDEPATH += \
src/apps/mavlinkgen \
src/apps/mavlinkgen/ui \
src/apps/mavlinkgen/generator
include(src/apps/mavlinkgen/mavlinkgen.pri)
} else {
message("Skipping support for MAVLink generator GUI (deprecated, see README)")
}
#
# [OPTIONAL] OpenSceneGraph
# Allow the user to override OpenSceneGraph compilation through a DISABLE_OPEN_SCENE_GRAPH
......
......@@ -37,9 +37,6 @@ The QUpgrade module relies on `libudev` on Linux platforms, so be sure to instal
### Specifying MAVLink dialects
The MAVLink dialect compiled by default by QGC is for the ardupilotmega. This will happen if no other dialects are specified. Setting the `MAVLINK_CONF` variable sets the dialects, with more than one specified in a space-separated list. Note that doing this may result in compilation errors as certain dialects may conflict with each other!
### MAVLink dialect generator
An add-on is available for QGC that provides a UI for generating MAVLink dialects from within QGC. This feature has been deprecated since identical functionality now exists within the MAVLink project itself. Enable this functionality by specifying the `DEFINES` variable `ENABLE_MAVGEN`.
### Opal-RT's RT-LAB simulator
Integration with Opal-RT's RT-LAB simulator can be enabled on Windows by installing RT-LAB 7.2.4. This allows vehicles to be simulated in RT-LAB and communicate directly with QGC on the same computer as if the UAS was actually deployed. This support is enabled by default once the requisite RT-LAB software is installed. Disabling this can be done by adding `DISABLE_RTLAB` to the `DEFINES` variable.
......
/*=====================================================================
PIXHAWK Micro Air Vehicle Flying Robotics Toolkit
(c) 2009, 2010 PIXHAWK PROJECT <http://pixhawk.ethz.ch>
This file is part of the PIXHAWK project
PIXHAWK 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.
PIXHAWK 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 PIXHAWK. If not, see <http://www.gnu.org/licenses/>.
======================================================================*/
/**
* @file
* @brief Implementation of class MAVLinkGen
*
* @author Lorenz Meier <mavteam@student.ethz.ch>
*
*/
#include <QFile>
#include <QFlags>
#include <QThread>
#include <QSplashScreen>
#include <QPixmap>
#include <QDesktopWidget>
#include <QPainter>
#include <QStyleFactory>
#include <QAction>
#include <QSettings>
#include <QFontDatabase>
#include <QMainWindow>
#include "MAVLinkGen.h"
#include "XMLCommProtocolWidget.h"
/**
* @brief Constructor for the main application.
*
* This constructor initializes and starts the whole application. It takes standard
* command-line parameters
*
* @param argc The number of command-line parameters
* @param argv The string array of parameters
**/
MAVLinkGen::MAVLinkGen(int &argc, char* argv[]) : QApplication(argc, argv)
{
this->setApplicationName("MAVLink Generator");
this->setApplicationVersion("v. 1.0.0 (Beta)");
this->setOrganizationName(QLatin1String("MAVLink Consortium"));
this->setOrganizationDomain("http://qgroundcontrol.org/mavlink");
QSettings::setDefaultFormat(QSettings::IniFormat);
// Exit main application when last window is closed
connect(this, SIGNAL(lastWindowClosed()), this, SLOT(quit()));
// Create main window
window = new QMainWindow();
window->setCentralWidget(new XMLCommProtocolWidget(window));
window->setWindowTitle(applicationName() + " " + applicationVersion());
window->resize(qMax(950, static_cast<int>(QApplication::desktop()->width()*0.7f)), qMax(600, static_cast<int>(QApplication::desktop()->height()*0.8f)));
window->show();
}
/**
* @brief Destructor
*
**/
MAVLinkGen::~MAVLinkGen()
{
window->hide();
delete window;
}
/*=====================================================================
PIXHAWK Micro Air Vehicle Flying Robotics Toolkit
(c) 2009, 2010 PIXHAWK PROJECT <http://pixhawk.ethz.ch>
This file is part of the PIXHAWK project
PIXHAWK 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.
PIXHAWK 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 PIXHAWK. If not, see <http://www.gnu.org/licenses/>.
======================================================================*/
/**
* @file
* @brief Definition of class MAVLinkGen
*
* @author Lorenz Meier <mavteam@student.ethz.ch>
*
*/
#ifndef MAVLINKGEN_H
#define MAVLINKGEN_H
#include <QApplication>
#include <QMainWindow>
/**
* @brief The main application and management class.
*
* This class is started by the main method and provides
* the central management unit of the groundstation application.
*
**/
class MAVLinkGen : public QApplication
{
Q_OBJECT
public:
MAVLinkGen(int &argc, char* argv[]);
~MAVLinkGen();
protected:
QMainWindow* window;
private:
};
#endif /* MAVLINKGEN_H */
Code Generator for the MAVLink Micro Air Vehicle Message Marshalling Library
This is a code generator for the library for lightweight communication between
Micro Air Vehicles and/or ground control stations.
It serializes C-structs for serial channels and can be used with
any type of radio modem.
**********
* NEWS *
**********
MAVLink has been ported to Python and Java. MAVLinkGen will soon support the output of Python and Java code as well.
For help, please visit the mailing list: http://groups.google.com/group/mavlink
MAVLink is licensed under the terms of the Lesser General Public License of the Free Software Foundation (LGPL).
MAVLink's reference implementation is done in the QGroundControl operator control unit. MAVLink is however not tied in any way to QGroundControl nor does it depend on it. Many other groundstations (APM Planner, HK GCS, Copter-GCS) support it and might be better suited for your application than QGC - check them out.
Project:
http://qgroundcontrol.org/mavlink
Files:
http://github.com/pixhawk/mavlinkgen
http://github.com/pixhawk/mavlink
(c) 2009-2011 Lorenz Meier <mail@qgroundcontrol.org>
\ No newline at end of file
#!/bin/sh
cp -r ../../mavlinkgen-build-desktop/mavlinkgen.app .
echo -e '\n\nStarting to create disk image. This may take a while..\n'
macdeployqt mavlinkgen.app -dmg
rm -rf mavlinkgen.app
echo -e '\n\n MAVLinkGen .DMG file is now ready for publishing\n'
Name "MAVLink Generator"
OutFile "mavlinkgen-installer-win32.exe"
InstallDir $PROGRAMFILES\mavlinkgen
Page license
Page directory
Page components
Page instfiles
UninstPage uninstConfirm
UninstPage instfiles
LicenseData ..\license.txt
Section ""
SetOutPath $INSTDIR
File ..\release\*.*
WriteUninstaller $INSTDIR\mavlinkgen_uninstall.exe
SectionEnd
Section "Uninstall"
Delete $INSTDIR\mavlinkgen_uninstall.exe
Delete $INSTDIR\*.*
RMDir $INSTDIR
Delete "$SMPROGRAMS\mavlinkgen\*.*"
RMDir "$SMPROGRAMS\mavlinkgen\"
SectionEnd
Section "create Start Menu Shortcuts"
CreateDirectory "$SMPROGRAMS\MAVLink"
CreateShortCut "$SMPROGRAMS\MAVLink\Uninstall.lnk" "$INSTDIR\mavlinkgen_uninstall.exe" "" "$INSTDIR\mavlinkgen_uninstall.exe" 0
CreateShortCut "$SMPROGRAMS\MAVLink\MAVLinkGen.lnk" "$INSTDIR\mavlinkgen.exe" "" "$INSTDIR\mavlinkgen.exe" 0
SectionEnd
\ No newline at end of file
This diff is collapsed.
/*=====================================================================
QGroundControl Open Source Ground Control Station
(c) 2009, 2010 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
This file is part of the QGROUNDCONTROL project
QGROUNDCONTROL 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.
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 <http://www.gnu.org/licenses/>.
======================================================================*/
/**
* @file
* @brief Definition of class MAVLinkXMLParser
* @author Lorenz Meier <mail@qgroundcontrol.org>
*/
#ifndef MAVLINKXMLPARSER_H
#define MAVLINKXMLPARSER_H
#include <QObject>
#include <QDomDocument>
#include <QString>
/**
* @brief MAVLink micro air vehicle protocol generator
*
* MAVLink is a generic communication protocol for micro air vehicles.
* for more information, please see the official website.
* @ref http://pixhawk.ethz.ch/software/mavlink/
**/
class MAVLinkXMLParser : public QObject
{
Q_OBJECT
public:
MAVLinkXMLParser(QDomDocument* document, QString outputDirectory, QObject* parent=0);
MAVLinkXMLParser(QString document, QString outputDirectory, QObject* parent=0);
~MAVLinkXMLParser();
public slots:
/** @brief Parse XML and generate C files */
bool generate();
signals:
/** @brief Status message on the parsing */
void parseState(QString message);
protected:
QDomDocument* doc;
QString outputDirName;
QString fileName;
};
#endif // MAVLINKXMLPARSER_H
/*=====================================================================
QGroundControl Open Source Ground Control Station
(c) 2009 - 2011 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
This file is part of the QGROUNDCONTROL project
QGROUNDCONTROL 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.
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 <http://www.gnu.org/licenses/>.
======================================================================*/
/**
* @file
* @brief Implementation of class MAVLinkXMLParserV10
* @author Lorenz Meier <mail@qgroundcontrol.org>
*/
#include <QFile>
#include <QDir>
#include <QPair>
#include <QList>
#include <QMap>
#include <QDateTime>
#include <QLocale>
#include <QApplication>
#include "MAVLinkXMLParserV10.h"
#include <QDebug>
MAVLinkXMLParserV10::MAVLinkXMLParserV10(QDomDocument* document, QString outputDirectory, QObject* parent) : QObject(parent),
doc(document),
outputDirName(outputDirectory),
fileName("")
{
}
MAVLinkXMLParserV10::MAVLinkXMLParserV10(QString document, QString outputDirectory, QObject* parent) : QObject(parent)
{
doc = new QDomDocument();
QFile file(document);
if (file.open(QIODevice::ReadOnly | QIODevice::Text))
{
const QString instanceText(QString::fromUtf8(file.readAll()));
doc->setContent(instanceText);
}
fileName = document;
outputDirName = outputDirectory;
}
MAVLinkXMLParserV10::~MAVLinkXMLParserV10()
{
}
void MAVLinkXMLParserV10::processError(QProcess::ProcessError err)
{
switch(err)
{
case QProcess::FailedToStart:
emit parseState(tr("Generator failed to start. Please check if the path and command is correct."));
break;
case QProcess::Crashed:
emit parseState("Generator crashed, This is a generator-related problem. Please upgrade MAVLink generator.");
break;
case QProcess::Timedout:
emit parseState(tr("Generator start timed out, please check if the path and command are correct"));
break;
case QProcess::WriteError:
emit parseState(tr("Could not communicate with generator. Please check if the path and command are correct"));
break;
case QProcess::ReadError:
emit parseState(tr("Could not communicate with generator. Please check if the path and command are correct"));
break;
case QProcess::UnknownError:
default:
emit parseState(tr("Generator error. Please check if the path and command is correct."));
break;
}
}
/**
* Generate C-code (C-89 compliant) out of the XML protocol specs.
*/
bool MAVLinkXMLParserV10::generate()
{
emit parseState(tr("Generator ready."));
#ifdef Q_OS_WIN
QString generatorCall("files/mavgen.exe");
#endif
#if (defined Q_OS_MAC) || (defined Q_OS_LINUX)
QString generatorCall("python");
#endif
QString lang("C");
QString version("1.0");
QStringList arguments;
#if (defined Q_OS_MAC) || (defined Q_OS_LINUX)
// Script is only needed as argument if Python is used, the Py2Exe implicitely knows the script
arguments << QString("%1/libs/mavlink/share/pyshared/pymavlink/generator/mavgen.py").arg(QApplication::applicationDirPath());
#endif
arguments << QString("--lang=%1").arg(lang);
arguments << QString("--output=%2").arg(outputDirName);
arguments << QString("%3").arg(fileName);
arguments << QString("--wire-protocol=%4").arg(version);
qDebug() << "Attempted to start" << generatorCall << arguments;
process = new QProcess(this);
process->setProcessChannelMode(QProcess::SeparateChannels);
connect(process, SIGNAL(error(QProcess::ProcessError)), this, SLOT(processError(QProcess::ProcessError)));
connect(process, SIGNAL(readyReadStandardOutput()), this, SLOT(readStdOut()));
connect(process, SIGNAL(readyReadStandardError()), this, SLOT(readStdErr()));
process->start(generatorCall, arguments, QIODevice::ReadWrite);
QString output = QString(process->readAll());
emit parseState(output);
// Print process status
emit parseState(QString("<font color=\"red\">%1</font>").arg(QString(process->readAllStandardError())));
emit parseState(QString(process->readAllStandardOutput()));
process->waitForFinished(20000);
process->terminate();
process->kill();
return true;//result;
}
void MAVLinkXMLParserV10::readStdOut()
{
QString out(process->readAllStandardOutput());
emit parseState(out);
}
void MAVLinkXMLParserV10::readStdErr()
{
QString out = QString("<font color=\"red\">%1</font>").arg(QString(process->readAllStandardError()));
emit parseState(out);
}
/*=====================================================================
QGroundControl Open Source Ground Control Station
(c) 2009, 2010 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
This file is part of the QGROUNDCONTROL project
QGROUNDCONTROL 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.
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 <http://www.gnu.org/licenses/>.
======================================================================*/
/**
* @file
* @brief Definition of class MAVLinkXMLParserV10
* @author Lorenz Meier <mail@qgroundcontrol.org>
*/
#ifndef MAVLINKXMLPARSERV10_H
#define MAVLINKXMLPARSERV10_H
#include <QObject>
#include <QDomDocument>
#include <QString>
#include <QProcess>
#include <inttypes.h>
/**
* @brief MAVLink micro air vehicle protocol generator
*
* MAVLink is a generic communication protocol for micro air vehicles.
* for more information, please see the official website.
* @ref http://pixhawk.ethz.ch/software/mavlink/
**/
class MAVLinkXMLParserV10 : public QObject
{
Q_OBJECT
public:
MAVLinkXMLParserV10(QDomDocument* document, QString outputDirectory, QObject* parent=0);
MAVLinkXMLParserV10(QString document, QString outputDirectory, QObject* parent=0);
~MAVLinkXMLParserV10();
public slots:
/** @brief Parse XML and generate C files */
bool generate();
/** @brief Handle process errors */
void processError(QProcess::ProcessError err);
/** @brief Redirect standard output */
void readStdOut();
/** @brief Redirect standard error output */
void readStdErr();
signals:
/** @brief Status message on the parsing */
void parseState(QString message);
protected:
// /** @brief Accumulate the X.25 CRC by adding one char at a time. */
// void crcAccumulate(uint8_t data, uint16_t *crcAccum);
// /** @brief Initialize the buffer for the X.25 CRC */
// void crcInit(uint16_t* crcAccum);
QDomDocument* doc;
QString outputDirName;
QString fileName;
QProcess* process;
};
#endif // MAVLINKXMLPARSERV10_H
This diff is collapsed.
This diff is collapsed.
/*=====================================================================
PIXHAWK Micro Air Vehicle Flying Robotics Toolkit
(c) 2009, 2010 PIXHAWK PROJECT <http://pixhawk.ethz.ch>
This file is part of the PIXHAWK project
PIXHAWK 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.
PIXHAWK 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 PIXHAWK. If not, see <http://www.gnu.org/licenses/>.
======================================================================*/
/**
* @file
* @brief Main executable
* @author Lorenz Meier <mavteam@student.ethz.ch>
*
*/
#include <QtGui/QApplication>
#include "MAVLinkGen.h"
/**
* @brief Starts the application
*
* @param argc Number of commandline arguments
* @param argv Commandline arguments
* @return exit code, 0 for normal exit and !=0 for error cases
*/
int main(int argc, char *argv[])
{
MAVLinkGen gen(argc, argv);
return gen.exec();
}
# Third-party includes.
# if you include this file with the commands below into
# your Qt project, you can enable your application
# to generate MAVLink code easily.
###### EXAMPLE BEGIN
## Include MAVLink generator
#DEPENDPATH += \
# src/apps/mavlinkgen
#
#INCLUDEPATH += \
# src/apps/mavlinkgen
# src/apps/mavlinkgen/ui \
# src/apps/mavlinkgen/generator
#
#include(src/apps/mavlinkgen/mavlinkgen.pri)
###### EXAMPLE END
INCLUDEPATH += .\
ui \
generator
FORMS += ui/XMLCommProtocolWidget.ui
HEADERS += \
ui/XMLCommProtocolWidget.h \
generator/MAVLinkXMLParser.h \
generator/MAVLinkXMLParserV10.h \
ui/DomItem.h \
ui/DomModel.h \
ui/QGCMAVLinkTextEdit.h
SOURCES += \
ui/XMLCommProtocolWidget.cc \
ui/DomItem.cc \
ui/DomModel.cc \
generator/MAVLinkXMLParser.cc \
generator/MAVLinkXMLParserV10.cc \
ui/QGCMAVLinkTextEdit.cc
RESOURCES += mavlinkgen.qrc
# MAVLink code generator
# generates code in several languages for MAVLink encoding/decoding
QT += svg xml
TEMPLATE = app
TARGET = mavlinkgen
LANGUAGE = C++
# Widget files (can be included in third-party Qt applications)
include(mavlinkgen.pri)
# Standalone files
HEADERS += MAVLinkGen.h
win32-msvc2008|win32-msvc2010 {
HEADERS += msinttypes/inttypes.h \
msinttypes/stdint.h
INCLUDEPATH += msinttypes
}
SOURCES += main.cc \
MAVLinkGen.cc
<RCC>
<qresource prefix="/">
<file>images/categories/applications-system.svg</file>
<file>images/status/folder-open.svg</file>
</qresource>
</RCC>
// ISO C9x compliant inttypes.h for Microsoft Visual Studio
// Based on ISO/IEC 9899:TC2 Committee draft (May 6, 2005) WG14/N1124
//
// Copyright (c) 2006 Alexander Chemeris
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// 1. Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
// 2. Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// 3. The name of the author may be used to endorse or promote products