Commit 272965d8 authored by lm's avatar lm

Merge branch 'dev' of github.com:pixhawk/qgroundcontrol into experimental

parents a57b3824 4d8370f6
*.swp
*.nfs
CMakeFiles
*Makefile*
tags
build
......
[submodule "MAVLink"]
path = MAVLink
url = git://github.com/pixhawk/mavlink.git
[submodule "thirdParty/mavlink"]
path = thirdParty/mavlink
url = https://github.com/pixhawk/mavlink.git
This diff is collapsed.
FIND_PATH(FLITE_INCLUDE_DIR flite/flite.h)
FIND_LIBRARY(FLITE_LIBRARIES NAMES flite)
IF(FLITE_INCLUDE_DIR AND FLITE_LIBRARIES)
SET(FLITE_FOUND TRUE)
ENDIF(FLITE_INCLUDE_DIR AND FLITE_LIBRARIES)
IF(FLITE_FOUND)
IF (NOT Flite_FIND_QUIETLY)
MESSAGE(STATUS "Found flite includes: ${FLITE_INCLUDE_DIR}/flite/flite.h")
MESSAGE(STATUS "Found flite library: ${FLITE_LIBRARIES}")
ENDIF (NOT Flite_FIND_QUIETLY)
ELSE(FLITE_FOUND)
IF (Flite_FIND_REQUIRED)
MESSAGE(FATAL_ERROR "Could NOT find flite development files")
ENDIF (Flite_FIND_REQUIRED)
ENDIF(FLITE_FOUND)
# - Try to find MAVLINK
# Once done, this will define
#
# MAVLINK_FOUND - system has scicoslab
# MAVLINK_INCLUDE_DIRS - the scicoslab include directories
include(LibFindMacros)
# Include dir
find_path(MAVLINK_INCLUDE_DIR
NAMES mavlink_types.h
PATHS
/usr/include/mavlink
/usr/local/include/mavlink
)
# Set the include dir variables and the libraries and let libfind_process do the rest.
# NOTE: Singular variables for this library, plural for libraries this this lib depends on.
set(MAVLINK_PROCESS_INCLUDES MAVLINK_INCLUDE_DIR)
libfind_process(MAVLINK)
# Find libphonon
# Once done this will define
#
# PHONON_FOUND - system has Phonon Library
# PHONON_INCLUDES - the Phonon include directory
# PHONON_LIBS - link these to use Phonon
# PHONON_VERSION - the version of the Phonon Library
# Copyright (c) 2008, Matthias Kretz <kretz@kde.org>
#
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
macro(_phonon_find_version)
set(_phonon_namespace_header_file "${PHONON_INCLUDE_DIR}/phonon/phononnamespace.h")
if (APPLE AND EXISTS "${PHONON_INCLUDE_DIR}/Headers/phononnamespace.h")
set(_phonon_namespace_header_file "${PHONON_INCLUDE_DIR}/Headers/phononnamespace.h")
endif (APPLE AND EXISTS "${PHONON_INCLUDE_DIR}/Headers/phononnamespace.h")
file(READ ${_phonon_namespace_header_file} _phonon_header LIMIT 5000 OFFSET 1000)
string(REGEX MATCH "define PHONON_VERSION_STR \"(4\\.[0-9]+\\.[0-9a-z]+)\"" _phonon_version_match "${_phonon_header}")
set(PHONON_VERSION "${CMAKE_MATCH_1}")
message(STATUS "Phonon Version: ${PHONON_VERSION}")
endmacro(_phonon_find_version)
if(PHONON_FOUND)
# Already found, nothing more to do except figuring out the version
_phonon_find_version()
else(PHONON_FOUND)
if(PHONON_INCLUDE_DIR AND PHONON_LIBRARY)
set(PHONON_FIND_QUIETLY TRUE)
endif(PHONON_INCLUDE_DIR AND PHONON_LIBRARY)
# As discussed on kde-buildsystem: first look at CMAKE_PREFIX_PATH, then at the suggested PATHS (kde4 install dir)
find_library(PHONON_LIBRARY NAMES phonon phonon4 PATHS /usr/lib ${KDE4_LIB_INSTALL_DIR} ${QT_LIBRARY_DIR})
# then at the default system locations (CMAKE_SYSTEM_PREFIX_PATH, i.e. /usr etc.)
find_library(PHONON_LIBRARY NAMES phonon phonon4)
find_path(PHONON_INCLUDE_DIR NAMES phonon/phonon_export.h PATHS /usr/include ${KDE4_INCLUDE_INSTALL_DIR} ${QT_INCLUDE_DIR} ${INCLUDE_INSTALL_DIR} ${QT_LIBRARY_DIR})
find_path(PHONON_INCLUDE_DIR NAMES phonon/phonon_export.h)
if(PHONON_INCLUDE_DIR AND PHONON_LIBRARY)
set(PHONON_LIBS ${phonon_LIB_DEPENDS} ${PHONON_LIBRARY})
set(PHONON_INCLUDES ${PHONON_INCLUDE_DIR}/KDE ${PHONON_INCLUDE_DIR})
set(PHONON_FOUND TRUE)
_phonon_find_version()
else(PHONON_INCLUDE_DIR AND PHONON_LIBRARY)
set(PHONON_FOUND FALSE)
endif(PHONON_INCLUDE_DIR AND PHONON_LIBRARY)
if(PHONON_FOUND)
if(NOT PHONON_FIND_QUIETLY)
message(STATUS "Found Phonon: ${PHONON_LIBRARY}")
message(STATUS "Found Phonon Includes: ${PHONON_INCLUDES}")
endif(NOT PHONON_FIND_QUIETLY)
else(PHONON_FOUND)
if(Phonon_FIND_REQUIRED)
if(NOT PHONON_INCLUDE_DIR)
message(STATUS "Phonon includes NOT found!")
endif(NOT PHONON_INCLUDE_DIR)
if(NOT PHONON_LIBRARY)
message(STATUS "Phonon library NOT found!")
endif(NOT PHONON_LIBRARY)
message(FATAL_ERROR "Phonon library or includes NOT found!")
else(Phonon_FIND_REQUIRED)
message(STATUS "Unable to find Phonon")
endif(Phonon_FIND_REQUIRED)
endif(PHONON_FOUND)
mark_as_advanced(PHONON_INCLUDE_DIR PHONON_LIBRARY PHONON_INCLUDES)
endif(PHONON_FOUND)
# Works the same as find_package, but forwards the "REQUIRED" and "QUIET" arguments
# used for the current package. For this to work, the first parameter must be the
# prefix of the current package, then the prefix of the new package etc, which are
# passed to find_package.
macro (libfind_package PREFIX)
set (LIBFIND_PACKAGE_ARGS ${ARGN})
if (${PREFIX}_FIND_QUIETLY)
set (LIBFIND_PACKAGE_ARGS ${LIBFIND_PACKAGE_ARGS} QUIET)
endif (${PREFIX}_FIND_QUIETLY)
if (${PREFIX}_FIND_REQUIRED)
set (LIBFIND_PACKAGE_ARGS ${LIBFIND_PACKAGE_ARGS} REQUIRED)
endif (${PREFIX}_FIND_REQUIRED)
find_package(${LIBFIND_PACKAGE_ARGS})
endmacro (libfind_package)
# CMake developers made the UsePkgConfig system deprecated in the same release (2.6)
# where they added pkg_check_modules. Consequently I need to support both in my scripts
# to avoid those deprecated warnings. Here's a helper that does just that.
# Works identically to pkg_check_modules, except that no checks are needed prior to use.
macro (libfind_pkg_check_modules PREFIX PKGNAME)
if (${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 4)
include(UsePkgConfig)
pkgconfig(${PKGNAME} ${PREFIX}_INCLUDE_DIRS ${PREFIX}_LIBRARY_DIRS ${PREFIX}_LDFLAGS ${PREFIX}_CFLAGS)
else (${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 4)
find_package(PkgConfig)
if (PKG_CONFIG_FOUND)
pkg_check_modules(${PREFIX} ${PKGNAME})
endif (PKG_CONFIG_FOUND)
endif (${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 4)
endmacro (libfind_pkg_check_modules)
# Do the final processing once the paths have been detected.
# If include dirs are needed, ${PREFIX}_PROCESS_INCLUDES should be set to contain
# all the variables, each of which contain one include directory.
# Ditto for ${PREFIX}_PROCESS_LIBS and library files.
# Will set ${PREFIX}_FOUND, ${PREFIX}_INCLUDE_DIRS and ${PREFIX}_LIBRARIES.
# Also handles errors in case library detection was required, etc.
macro (libfind_process PREFIX)
# Skip processing if already processed during this run
if (NOT ${PREFIX}_FOUND)
# Start with the assumption that the library was found
set (${PREFIX}_FOUND TRUE)
# Process all includes and set _FOUND to false if any are missing
foreach (i ${${PREFIX}_PROCESS_INCLUDES})
if (${i})
set (${PREFIX}_INCLUDE_DIRS ${${PREFIX}_INCLUDE_DIRS} ${${i}})
mark_as_advanced(${i})
else (${i})
set (${PREFIX}_FOUND FALSE)
endif (${i})
endforeach (i)
# Process all libraries and set _FOUND to false if any are missing
foreach (i ${${PREFIX}_PROCESS_LIBS})
if (${i})
set (${PREFIX}_LIBRARIES ${${PREFIX}_LIBRARIES} ${${i}})
mark_as_advanced(${i})
else (${i})
set (${PREFIX}_FOUND FALSE)
endif (${i})
endforeach (i)
# Print message and/or exit on fatal error
if (${PREFIX}_FOUND)
if (NOT ${PREFIX}_FIND_QUIETLY)
message (STATUS "Found ${PREFIX} ${${PREFIX}_VERSION}")
endif (NOT ${PREFIX}_FIND_QUIETLY)
else (${PREFIX}_FOUND)
if (${PREFIX}_FIND_REQUIRED)
foreach (i ${${PREFIX}_PROCESS_INCLUDES} ${${PREFIX}_PROCESS_LIBS})
message("${i}=${${i}}")
endforeach (i)
message (FATAL_ERROR "Required library ${PREFIX} NOT FOUND.\nInstall the library (dev version) and try again. If the library is already installed, use ccmake to set the missing variables manually.")
endif (${PREFIX}_FIND_REQUIRED)
endif (${PREFIX}_FOUND)
endif (NOT ${PREFIX}_FOUND)
endmacro (libfind_process)
macro(libfind_library PREFIX basename)
set(TMP "")
if(MSVC80)
set(TMP -vc80)
endif(MSVC80)
if(MSVC90)
set(TMP -vc90)
endif(MSVC90)
set(${PREFIX}_LIBNAMES ${basename}${TMP})
if(${ARGC} GREATER 2)
set(${PREFIX}_LIBNAMES ${basename}${TMP}-${ARGV2})
string(REGEX REPLACE "\\." "_" TMP ${${PREFIX}_LIBNAMES})
set(${PREFIX}_LIBNAMES ${${PREFIX}_LIBNAMES} ${TMP})
endif(${ARGC} GREATER 2)
find_library(${PREFIX}_LIBRARY
NAMES ${${PREFIX}_LIBNAMES}
PATHS ${${PREFIX}_PKGCONF_LIBRARY_DIRS}
)
endmacro(libfind_library)
#!/bin/bash
PS3='Please enter your choice: '
LIST="in_source_build install_build grab_debian_dependencies package_source package remake clean END"
MAKEARGS="-j8"
echo
echo in_source_build: is used for development and you can start the scicoslab toolbox by typing scicoslab in the oooark source directory
echo install_build: is used for building before final installation to the system.
echo grab_debian_dependencies: installs all the required packages for debian based systems \(ubuntu maverick/ debian squeeze,lenny\)
echo remake: calls make again after project has been configured as install or in source build
echo package_source: creates a source package for distribution
echo package: creates binary packages for distribution
echo clean: removes the build directory
echo
select OPT in $LIST
do
if [ $OPT = "in_source_build" ] &> /dev/null
then
echo you chose in source build
mkdir -p build && cd build && cmake -DIN_SRC_BUILD:bool=TRUE .. && make $MAKEARGS
exit 0
elif [ $OPT = "install_build" ] &> /dev/null
then
echo you chose install build
mkdir -p build && cd build && cmake .. && make $MAKEARGS
exit 0
elif [ $OPT = "grab_debian_dependencies" ] &> /dev/null
then
echo you chose to install debian dependencies
sudo apt-get install cmake libqt4-dev libboost-all-dev libopenscenegraph-dev
sudo apt-get install scicoslab-gtk
exit 0
elif [ $OPT = "remake" ] &> /dev/null
then
echo you chose to recall make on the previously configured build
cd build && make $MAKEARGS
exit 0
elif [ $OPT = "package_source" ] &> /dev/null
then
echo you chose to package the source
mkdir -p build && cd build && cmake .. && make package_source
exit 0
elif [ $OPT = "package" ] &> /dev/null
then
echo you chose to package the binary
mkdir -p build && cd build && cmake .. && make package
exit 0
elif [ $OPT = "clean" ] &> /dev/null
then
echo you chose to clean the build
rm -rf build
elif [ $OPT = "END" ] &> /dev/null
then
exit 0
fi
done
#!/bin/bash
ctags -RV --c++-kinds=+p --fields=+iaS --extra=+q \
. \
/usr/include/qt4 \
/usr/include/osg*
......@@ -202,7 +202,12 @@ message("Compiling for linux 32")
DEPENDENCIES_PRESENT += osg
# Include OpenSceneGraph libraries
LIBS += -losg \
-losgViewer
-losgViewer \
-losgGA \
-losgDB \
-losgText \
-lOpenThreads
DEFINES += QGC_OSG_ENABLED
}
......@@ -273,7 +278,12 @@ linux-g++-64 {
DEPENDENCIES_PRESENT += osg
# Include OpenSceneGraph libraries
LIBS += -losg \
-losgViewer
-losgViewer \
-losgGA \
-losgDB \
-losgText \
-lOpenThreads
DEFINES += QGC_OSG_ENABLED
}
......@@ -342,10 +352,10 @@ INCLUDEPATH += $$BASEDIR/lib/osgEarth/win32/include \
LIBS += -L$$BASEDIR/lib/osgEarth_3rdparty/win32/OpenSceneGraph-2.8.2/lib \
-losg \
-losgViewer \
-losgGA \
-losgDB \
-losgText \
-lOpenThreads
-losgGA \
-losgDB \
-losgText \
-lOpenThreads
DEFINES += QGC_OSG_ENABLED
exists($$BASEDIR/lib/osgEarth123) {
DEPENDENCIES_PRESENT += osgearth
......@@ -400,7 +410,7 @@ win32-g++ {
debug {
#DESTDIR = $$BUILDDIR/debug
CONFIG += console
CONFIG += console
}
release {
......@@ -454,3 +464,4 @@ win32-g++ {
# see http://osgearth.org/wiki/FAQ for details.
QMAKE_CXXFLAGS += -Wl,-E
}
# vim:ts=4:sw=4:expandtab
......@@ -189,7 +189,7 @@ bool GAudioOutput::say(QString text, int severity)
file.setFileTemplate("XXXXXX.wav");
if (file.open())
{
cst_voice* v = register_cmu_us_kal(NULL);
cst_voice* v = new_voice();
cst_wave* wav = flite_text_to_wave(text.toStdString().c_str(), v);
// file.fileName() returns the unique file name
cst_wave_save(wav, file.fileName().toStdString().c_str(), "riff");
......
/*=====================================================================
PIXHAWK Micro Air Vehicle Flying Robotics Toolkit
(c) 2009 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 Brief Description
*
* @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 <MissionLog.h>
#include <MG.h>
#include <QDebug>
/**
* @brief Constructor for the mission log
*
**/
MissionLog::MissionLog(QObject* parent) : QObject(parent)
{
logLines = new QMap<QString, LogLine*>();
logFiles = new QMap<QString, QFile*>();
}
/**
* @brief Destructor for the mission log. It closes all files
*
**/
MissionLog::~MissionLog()
{
delete logFiles;
delete logLines;
}
void MissionLog::startLog(UASInterface* uas, QString format)
{
QString separator;
if (format.contains(",")) separator = ",";
if (format.contains(";")) separator = ";";
if (format.contains("\t")) separator = "\t";
QStringList fields = format.split(separator);
}
void MissionLog::stopLog(UASInterface* uas, QString format)
{
// TODO Check if file has to be closed explicitely
logFiles->remove(format);
}
/*=====================================================================
PIXHAWK Micro Air Vehicle Flying Robotics Toolkit
(c) 2009 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 Brief Description
*
* @author Lorenz Meier <mavteam@student.ethz.ch>
*
*/
#ifndef _MISSIONLOG_H_
#define _MISSIONLOG_H_
#include <QString>
#include <QFile>
#include <QMap>
#include <UASInterface.h>
/**
* @brief Log the mission executed by this groundstation
*
* Displays all events in a console window and writes (if enabled) all events to a logfile
*
**/
class MissionLog : public QObject {
Q_OBJECT
public:
MissionLog(QObject* parent = NULL);
~MissionLog();
public slots:
void startLog(UASInterface* uas, QString format);
void stopLog(UASInterface* uas, QString format);
protected:
/**
* @brief This nested class is just a data container for a log line
*/
class LogFile
{
public:
void setField(QString id, double value)
{
//fields->value(id.trimmed()) = value;
fieldsDone++;
if (fieldsDone == fields->size()) writeLine();
}
protected:
QMap<QString, double>* fields;
int fieldsDone;
QFile* file;
LogFile(QFile* file, QString format)
{
fields = new QMap<QString, double>();
fieldsDone = 0;
file->open(QIODevice::WriteOnly | QIODevice::Text);
}
void addField(QString id)
{
fields->insert(id, 0.0f);
}
void writeLine()
{
QString line = "";
// Iterate through the fields
// Reset value to zero after write
line += "\n";
file->write(line.toAscii());
file->flush();
}
};
QMap<QString, LogFile*>* logFiles;
private:
};
#endif // _MISSIONLOG_H_
#include "PxMAV.h"
#include <QtCore>
PxMAV::PxMAV() :
UAS(NULL, 0)
{
}
PxMAV::PxMAV(MAVLinkProtocol* mavlink, int id) :
UAS(mavlink, id)
{
}
/**
* This function is called by MAVLink once a complete, uncorrupted (CRC check valid)
* mavlink packet is received.
*
* @param link Hardware link the message came from (e.g. /dev/ttyUSB0 or UDP port).
* messages can be sent back to the system via this link
* @param message MAVLink message, as received from the MAVLink protocol stack
*/
void PxMAV::receiveMessage(LinkInterface* link, mavlink_message_t message)
{
// Let UAS handle the default message set
UAS::receiveMessage(link, message);
mavlink_message_t* msg = &message;
//qDebug() << "PX RECEIVED" << msg->sysid << msg->compid << msg->msgid;
// Handle your special messages
switch (msg->msgid)
{
case MAVLINK_MSG_ID_WATCHDOG_HEARTBEAT:
{
mavlink_watchdog_heartbeat_t payload;
mavlink_msg_watchdog_heartbeat_decode(msg, &payload);
emit watchdogReceived(this->uasId, payload.watchdog_id, payload.process_count);
}
break;
case MAVLINK_MSG_ID_WATCHDOG_PROCESS_INFO:
{
mavlink_watchdog_process_info_t payload;
mavlink_msg_watchdog_process_info_decode(msg, &payload);
emit processReceived(this->uasId, payload.watchdog_id, payload.process_id, QString((const char*)payload.name), QString((const char*)payload.arguments), payload.timeout);
}
break;
case MAVLINK_MSG_ID_WATCHDOG_PROCESS_STATUS:
{
mavlink_watchdog_process_status_t payload;
mavlink_msg_watchdog_process_status_decode(msg, &payload);
emit processChanged(this->uasId, payload.watchdog_id, payload.process_id, payload.state, (payload.muted == 1) ? true : false, payload.crashes, payload.pid);
}
break;
case MAVLINK_MSG_ID_DEBUG_VECT:
{
mavlink_debug_vect_t vect;
mavlink_msg_debug_vect_decode(msg, &vect);
QString str((const char*)vect.name);
emit valueChanged(uasId, str+".x", vect.x, MG::TIME::getGroundTimeNow());
emit valueChanged(uasId, str+".y", vect.y, MG::TIME::getGroundTimeNow());
emit valueChanged(uasId, str+".z", vect.z, MG::TIME::getGroundTimeNow());
}
break;
case MAVLINK_MSG_ID_VISION_POSITION_ESTIMATE:
{
mavlink_vision_position_estimate_t pos;
mavlink_msg_vision_position_estimate_decode(&message, &pos);
quint64 time = getUnixTime(pos.usec);
emit valueChanged(uasId, "vis. time", pos.usec, time);
emit valueChanged(uasId, "vis. roll", pos.roll, time);
emit valueChanged(uasId, "vis. pitch", pos.pitch, time);
emit valueChanged(uasId, "vis. yaw", pos.yaw, time);
emit valueChanged(uasId, "vis. x", pos.x, time);
emit valueChanged(uasId, "vis. y", pos.y, time);
emit valueChanged(uasId, "vis. z", pos.z, time);
emit valueChanged(uasId, "vis. vx", pos.vx, time);
emit valueChanged(uasId, "vis. vy", pos.vy, time);
emit valueChanged(uasId, "vis. vz", pos.vz, time);
emit valueChanged(uasId, "vis. vyaw", pos.vyaw, time);
// Set internal state
if (!positionLock)
{
// If position was not locked before, notify positive
// GAudioOutput::instance()->notifyPositive();
}
positionLock = true;
}
break;
default:
// Do nothing
break;
}
}
void PxMAV::sendProcessCommand(int watchdogId, int processId, unsigned int command)
{
mavlink_watchdog_command_t payload;
payload.target_system_id = uasId;
payload.watchdog_id = watchdogId;
payload.process_id = processId;
payload.command_id = (uint8_t)command;
mavlink_message_t msg;
mavlink_msg_watchdog_command_encode(mavlink->getSystemId(), mavlink->getComponentId(), &msg, &payload);
sendMessage(msg);
}
Q_EXPORT_PLUGIN2(pixhawk_plugins, PxMAV)
#ifndef PXMAV_H
#define PXMAV_H
#include "UAS.h"
class PxMAV : public UAS
{
Q_OBJECT
Q_INTERFACES(UASInterface)
public:
PxMAV(MAVLinkProtocol* mavlink, int id);
PxMAV();
public slots:
/** @brief Receive a MAVLink message from this MAV */
void receiveMessage(LinkInterface* link, mavlink_message_t message);
/** @brief Send a command to an onboard process */
void sendProcessCommand(int watchdogId, int processId, unsigned int command);
signals:
void watchdogReceived(int systemId, int watchdogId, unsigned int processCount);
void processReceived(int systemId, int watchdogId, int processId, QString name, QString arguments, int timeout);
void processChanged(int systemId, int watchdogId, int processId, int state, bool muted, int crashed, int pid);
};
#endif // PXMAV_H
#include "Logfile.h"
#include <QDebug>
LogFile::LogFile(UASInterface* uas, QString filename, QString formatString)
{
this->uas = uas;
connect(this->uas, SIGNAL(valueChanged(int, QString, double, quint64)), this, SLOT(addValue(int, QString, double, quint64)));
file = new QFile(filename);
separator = ",";
this->formatString = formatString;
if (file->open(QIODevice::WriteOnly | QIODevice::Text))
{
out = new QTextStream(file);
}
}
LogFile::~LogFile()
{
out->flush();
file->close();
delete out;
delete file;
}
void LogFile::addValue(int uas, QString id, double value, quint64 timestamp)
{
//out.atEnd()->append() << separator << value;
if (formatString == id)
{
out->operator <<(timestamp);
out->operator <<(separator);
out->operator <<(value);
out->operator <<("\n");
out->flush();
}
}
//std::ofstream markerlog("mavserial_markerlog.txt");
//std::ofstream attitudelog("mavserial_attitudelog.txt");
void LogFile::addValue(QString id, double value)
{
//out.atEnd()->append() << separator << value;
//qDebug() << id << value;
}
#ifndef LOGFILE_H
#define LOGFILE_H
#include <QFile>
#include <QTextStream>
#include <UASInterface.h>
class LogFile : public QObject
{
Q_OBJECT
public:
LogFile(UASInterface* uas, QString filename, QString formatString="");
~LogFile();
public slots:
void addValue(QString id, double value);
void addValue(int uas, QString id, double value, quint64 timestamp);
protected:
QFile* file;
QTextStream* out;
QString separator;
QString formatString;
UASInterface* uas;
};
#endif // LOGFILE_H
#ifndef QGCPARAMSLIDERPLUGIN_H
#define QGCPARAMSLIDERPLUGIN_H
#include <QtDesigner/QDesignerCustomWidgetInterface>
class QGCParamSliderPlugin : public QObject,
public QDesignerCustomWidgetInterface
{
Q_OBJECT
Q_INTERFACES(QDesignerCustomWidgetInterface)
public:
explicit QGCParamSliderPlugin(QObject *parent = 0);
bool isContainer() const;
bool isInitialized() const;
QIcon icon() const;
QString domXml() const;
QString group() const;
QString includeFile() const;
QString name() const;
QString toolTip() const;
QString whatsThis() const;
QWidget *createWidget(QWidget *parent);
void initialize(QDesignerFormEditorInterface *core);
private:
bool initialized;
};
#endif // QGCPARAMSLIDERPLUGIN_H
Subproject commit 50ad6bf278b87a105adb4887b5338daa2940f0c6
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