Commit 8ba0c5b8 authored by James Goppert's avatar James Goppert

Further progress on cmake build system.

parent 55491754
......@@ -211,23 +211,28 @@ include_directories(
src/lib/qextserialport
src/lib/qwt
lib/QMapControl
${PROJECT_BINARY_DIR}
${SDL_INCLUDE_DIR}
${OPENGL_INCLUDE_DIR}
${PROJECT_BINARY_DIR}
${OPENSCENEGRAPH_INCLUDE_DIRS}
${QT_INCLUDE_DIRS}
${PHONON_INCLUDE_DIR}/phonon
${MAVLINK_INCLUDE_DIRS}
)
link_libraries(
${SDL_LIBRARY}
${OPENGL_LIBRARIES}
${OSG_LIBRARIES}
${QT_LIBRARIES}
${SDL_LIBRARY}
${PHONON_LIBS}
qextserialport
qmapcontrol
qwt
)
add_definitions(-D_TTY_POSIX_)
# forms
set(qgroundcontrolUiSrc
src/ui/MainWindow.ui
src/ui/CommSettings.ui
......@@ -275,105 +280,137 @@ set(qgroundcontrolUiSrc
src/ui/QGCSettingsWidget.ui
)
# non qt object headers
set(qgroundcontrolHdrs
src/MG.h
src/Core.h
src/uas/UASInterface.h
src/uas/UAS.h
src/uas/UASManager.h
src/comm/LinkManager.h
src/GAudioOutput.h
src/LogCompressor.h
src/MG.h
src/QGC.h
src/Waypoint.h
src/comm/AS4Protocol.h
src/comm/LinkInterface.h
src/comm/SerialLinkInterface.h
src/comm/SerialLink.h
src/comm/SerialSimulationLink.h
src/comm/ProtocolInterface.h
src/comm/LinkManager.h
src/comm/MAVLinkProtocol.h
src/comm/AS4Protocol.h
src/ui/CommConfigurationWindow.h
src/ui/SerialConfigurationWindow.h
src/ui/MainWindow.h
src/ui/uas/UASControlWidget.h
src/ui/uas/UASListWidget.h
src/ui/uas/UASInfoWidget.h
src/ui/HUD.h
src/ui/linechart/LinechartWidget.h
src/ui/linechart/LinechartPlot.h
src/ui/linechart/Scrollbar.h
src/ui/linechart/ScrollZoomer.h
src/configuration.h
src/ui/uas/UASView.h
src/ui/CameraView.h
src/comm/MAVLinkSimulationLink.h
src/comm/MAVLinkSimulationMAV.h
src/comm/MAVLinkSimulationWaypointPlanner.h
src/comm/MAVLinkSwarmSimulationLink.h
src/comm/MAVLinkSyntaxHighlighter.h
src/comm/MAVLinkXMLParser.h
src/comm/ProtocolInterface.h
src/comm/QGCMAVLink.h
src/comm/SerialLink.h
src/comm/SerialLinkInterface.h
src/comm/SerialSimulationLink.h
src/comm/UDPLink.h
src/ui/ParameterInterface.h
src/ui/WaypointList.h
src/Waypoint.h
src/ui/WaypointView.h
src/ui/ObjectDetectionView.h
src/configuration.h
src/input/JoystickInput.h
src/ui/JoystickWidget.h
src/ui/DebugConsole.h
src/ui/MapWidget.h
src/ui/XMLCommProtocolWidget.h
src/ui/mavlink/DomItem.h
src/ui/mavlink/DomModel.h
src/comm/MAVLinkXMLParser.h
src/ui/HDDisplay.h
src/ui/MAVLinkSettingsWidget.h
src/ui/AudioOutputWidget.h
src/GAudioOutput.h
src/LogCompressor.h
src/ui/QGCParamWidget.h
src/ui/QGCSensorSettingsWidget.h
src/ui/linechart/Linecharts.h
src/uas/SlugsMAV.h
src/uas/PxQuadMAV.h
src/uas/ArduPilotMegaMAV.h
src/comm/MAVLinkSyntaxHighlighter.h
src/ui/watchdog/WatchdogControl.h
src/ui/watchdog/WatchdogProcessView.h
src/ui/watchdog/WatchdogView.h
src/uas/PxQuadMAV.h
src/uas/QGCMAVLinkUASFactory.h
src/uas/SlugsMAV.h
src/uas/UAS.h
src/uas/UASInterface.h
src/uas/UASManager.h
src/uas/UASWaypointManager.h
src/ui/map/Waypoint2DIcon.h
src/ui/map/MAV2DIcon.h
)
# qt object headers
set (qgroundcontrolMocSrc
src/ui/AudioOutputWidget.h
src/ui/CameraView.h
src/ui/CommConfigurationWindow.h
src/ui/DebugConsole.h
src/ui/HDDisplay.h
src/ui/HSIDisplay.h
src/QGC.h
src/ui/HUD.h
src/ui/JoystickWidget.h
src/ui/MAVLinkSettingsWidget.h
src/ui/MainWindow.h
src/ui/MapWidget.h
src/ui/ObjectDetectionView.h
src/ui/ParameterInterface.h
src/ui/QGCDataPlot2D.h
src/ui/QGCFirmwareUpdate.h
src/ui/QGCMAVLinkLogPlayer.h
src/ui/QGCMainWindowAPConfigurator.h
src/ui/QGCParamWidget.h
src/ui/QGCPxImuFirmwareUpdate.h
src/ui/QGCDataPlot2D.h
src/ui/linechart/IncrementalPlot.h
src/ui/map/Waypoint2DIcon.h
src/ui/map/MAV2DIcon.h
src/ui/QGCRemoteControlView.h
src/ui/QGCSensorSettingsWidget.h
src/ui/QGCSettingsWidget.h
src/ui/QGCUDPLinkConfiguration.h
src/ui/QGCWaypointListMulti.h
src/ui/QGCWebView.h
src/ui/RadioCalibration/AbstractCalibrator.h
src/ui/RadioCalibration/AirfoilServoCalibrator.h
src/ui/RadioCalibration/CurveCalibrator.h
src/ui/RadioCalibration/RadioCalibrationData.h
src/ui/RadioCalibration/RadioCalibrationWindow.h
src/ui/RadioCalibration/AirfoilServoCalibrator.h
src/ui/RadioCalibration/SwitchCalibrator.h
src/ui/RadioCalibration/CurveCalibrator.h
src/ui/RadioCalibration/AbstractCalibrator.h
src/comm/QGCMAVLink.h
src/ui/QGCWebView.h
src/ui/map3D/QGCWebPage.h
src/ui/SerialConfigurationWindow.h
src/ui/SlugsDataSensorView.h
src/ui/SlugsHilSim.h
src/ui/SlugsPIDControl.h
src/ui/SlugsVideoCamControl.h
src/ui/SlugsPadCameraControl.h
src/ui/QGCMainWindowAPConfigurator.h
src/comm/MAVLinkSwarmSimulationLink.h
src/ui/uas/QGCUnconnectedInfoWidget.h
src/ui/designer/QGCToolWidget.h
src/ui/designer/QGCParamSlider.h
src/ui/SlugsVideoCamControl.h
src/ui/WaypointList.h
src/ui/WaypointView.h
src/ui/XMLCommProtocolWidget.h
src/ui/designer/QGCActionButton.h
src/ui/designer/QGCParamSlider.h
src/ui/designer/QGCToolWidget.h
src/ui/designer/QGCToolWidgetItem.h
src/ui/QGCMAVLinkLogPlayer.h
src/comm/MAVLinkSimulationWaypointPlanner.h
src/comm/MAVLinkSimulationMAV.h
src/uas/QGCMAVLinkUASFactory.h
src/ui/QGCWaypointListMulti.h
src/ui/QGCUDPLinkConfiguration.h
src/ui/QGCSettingsWidget.h
src/ui/linechart/IncrementalPlot.h
src/ui/linechart/LinechartPlot.h
src/ui/linechart/LinechartWidget.h
src/ui/linechart/Linecharts.h
src/ui/linechart/ScrollZoomer.h
src/ui/linechart/Scrollbar.h
src/ui/map3D/QGCWebPage.h
src/ui/mavlink/DomItem.h
src/ui/mavlink/DomModel.h
src/ui/uas/QGCUnconnectedInfoWidget.h
src/ui/uas/UASControlWidget.h
src/ui/uas/UASInfoWidget.h
src/ui/uas/UASListWidget.h
src/ui/uas/UASView.h
src/ui/watchdog/WatchdogControl.h
src/ui/watchdog/WatchdogProcessView.h
src/ui/watchdog/WatchdogView.h
)
set (qgroundcontrolMocSrc
# source
set (qgroundcontrolSrc
src/main.cc
src/Core.cc
src/GAudioOutput.cc
src/LogCompressor.cc
src/QGC.cc
src/Waypoint.cc
src/comm/AS4Protocol.cc
src/comm/LinkManager.cc
src/comm/MAVLinkProtocol.cc
src/comm/MAVLinkSimulationLink.cc
src/comm/MAVLinkSimulationMAV.cc
src/comm/MAVLinkSimulationWaypointPlanner.cc
src/comm/MAVLinkSwarmSimulationLink.cc
src/comm/MAVLinkSyntaxHighlighter.cc
src/comm/MAVLinkXMLParser.cc
src/comm/SerialLink.cc
src/comm/SerialSimulationLink.cc
src/comm/UDPLink.cc
src/input/JoystickInput.cc
src/uas/ArduPilotMegaMAV.cc
src/uas/PxQuadMAV.cc
src/uas/QGCMAVLinkUASFactory.cc
src/uas/SlugsMAV.cc
src/uas/UAS.cc
src/uas/UASManager.cc
src/uas/UASWaypointManager.cc
src/ui/AudioOutputWidget.cc
src/ui/CameraView.cc
src/ui/CommConfigurationWindow.cc
......@@ -439,35 +476,224 @@ set (qgroundcontrolMocSrc
src/ui/watchdog/WatchdogView.cc
)
set (qgroundcontrolSrc
src/main.cc
src/Core.cc
src/GAudioOutput.cc
src/LogCompressor.cc
src/QGC.cc
src/Waypoint.cc
src/comm/AS4Protocol.cc
src/comm/LinkManager.cc
src/comm/MAVLinkProtocol.cc
src/comm/MAVLinkSimulationLink.cc
src/comm/MAVLinkSimulationMAV.cc
src/comm/MAVLinkSimulationWaypointPlanner.cc
src/comm/MAVLinkSwarmSimulationLink.cc
src/comm/MAVLinkSyntaxHighlighter.cc
src/comm/MAVLinkXMLParser.cc
src/comm/SerialLink.cc
src/comm/SerialSimulationLink.cc
src/comm/UDPLink.cc
src/input/JoystickInput.cc
src/uas/ArduPilotMegaMAV.cc
src/uas/PxQuadMAV.cc
src/uas/QGCMAVLinkUASFactory.cc
src/uas/SlugsMAV.cc
src/uas/UAS.cc
src/uas/UASManager.cc
src/uas/UASWaypointManager.cc
set (qmapcontrolHdrs
lib/QMapControl/src/googlemapadapter.h
lib/QMapControl/src/circlepoint.h
lib/QMapControl/src/mapnetwork.h
lib/QMapControl/src/wmsmapadapter.h
lib/QMapControl/src/mapadapter.h
lib/QMapControl/src/geometrylayer.h
lib/QMapControl/src/linestring.h
lib/QMapControl/src/mapcontrol.h
lib/QMapControl/src/tilemapadapter.h
lib/QMapControl/src/curve.h
lib/QMapControl/src/imagemanager.h
lib/QMapControl/src/layer.h
lib/QMapControl/src/maplayer.h
lib/QMapControl/src/geometry.h
lib/QMapControl/src/googlesatmapadapter.h
lib/QMapControl/src/point.h
lib/QMapControl/src/osmmapadapter.h
lib/QMapControl/src/gps_position.h
lib/QMapControl/src/layermanager.h
lib/QMapControl/src/fixedimageoverlay.h
lib/QMapControl/src/openaerialmapadapter.h
lib/QMapControl/src/emptymapadapter.h
lib/QMapControl/src/yahoomapadapter.h
lib/QMapControl/src/imagepoint.h
lib/QMapControl/qmapcontrol.h
)
set (qmapcontrolSrc
lib/QMapControl/src/point.cpp
lib/QMapControl/src/imagepoint.cpp
lib/QMapControl/src/yahoomapadapter.cpp
lib/QMapControl/src/layermanager.cpp
lib/QMapControl/src/circlepoint.cpp
lib/QMapControl/src/imagemanager.cpp
lib/QMapControl/src/maplayer.cpp
lib/QMapControl/src/geometrylayer.cpp
lib/QMapControl/src/mapadapter.cpp
lib/QMapControl/src/mapnetwork.cpp
lib/QMapControl/src/linestring.cpp
lib/QMapControl/src/osmmapadapter.cpp
lib/QMapControl/src/fixedimageoverlay.cpp
lib/QMapControl/src/layer.cpp
lib/QMapControl/src/openaerialmapadapter.cpp
lib/QMapControl/src/geometry.cpp
lib/QMapControl/src/mapcontrol.cpp
lib/QMapControl/src/tilemapadapter.cpp
lib/QMapControl/src/googlemapadapter.cpp
lib/QMapControl/src/wmsmapadapter.cpp
lib/QMapControl/src/googlesatmapadapter.cpp
lib/QMapControl/src/curve.cpp
lib/QMapControl/src/emptymapadapter.cpp
lib/QMapControl/src/gps_position.cpp
)
set (qwtHdrs
src/lib/qwt/qwt_plot_panner.h
src/lib/qwt/qwt_plot_marker.h
src/lib/qwt/qwt_plot_curve.h
src/lib/qwt/qwt_double_range.h
src/lib/qwt/qwt_symbol.h
src/lib/qwt/qwt_event_pattern.h
src/lib/qwt/qwt_abstract_scale_draw.h
src/lib/qwt/qwt_clipper.h
src/lib/qwt/qwt_compass_rose.h
src/lib/qwt/qwt_wheel.h
src/lib/qwt/qwt_raster_data.h
src/lib/qwt/qwt.h
src/lib/qwt/qwt_text_label.h
src/lib/qwt/qwt_legend_itemmanager.h
src/lib/qwt/qwt_picker.h
src/lib/qwt/qwt_layout_metrics.h
src/lib/qwt/qwt_curve_fitter.h
src/lib/qwt/qwt_picker_machine.h
src/lib/qwt/qwt_magnifier.h
src/lib/qwt/qwt_round_scale_draw.h
src/lib/qwt/qwt_knob.h
src/lib/qwt/qwt_plot_svgitem.h
src/lib/qwt/qwt_plot_picker.h
src/lib/qwt/qwt_valuelist.h
src/lib/qwt/qwt_global.h
src/lib/qwt/qwt_plot_zoomer.h
src/lib/qwt/qwt_counter.h
src/lib/qwt/qwt_plot.h
src/lib/qwt/qwt_painter.h
src/lib/qwt/qwt_plot_canvas.h
src/lib/qwt/qwt_plot_item.h
src/lib/qwt/qwt_double_interval.h
src/lib/qwt/qwt_plot_magnifier.h
src/lib/qwt/qwt_arrow_button.h
src/lib/qwt/qwt_color_map.h
src/lib/qwt/qwt_math.h
src/lib/qwt/qwt_scale_map.h
src/lib/qwt/qwt_text_engine.h
src/lib/qwt/qwt_interval_data.h
src/lib/qwt/qwt_dial.h
src/lib/qwt/qwt_data.h
src/lib/qwt/qwt_text.h
src/lib/qwt/qwt_polygon.h
src/lib/qwt/qwt_plot_spectrogram.h
src/lib/qwt/qwt_plot_grid.h
src/lib/qwt/qwt_spline.h
src/lib/qwt/qwt_scale_widget.h
src/lib/qwt/qwt_legend.h
src/lib/qwt/qwt_plot_layout.h
src/lib/qwt/qwt_dial_needle.h
src/lib/qwt/qwt_rect.h
src/lib/qwt/qwt_analog_clock.h
src/lib/qwt/qwt_dyngrid_layout.h
src/lib/qwt/qwt_slider.h
src/lib/qwt/qwt_scale_draw.h
src/lib/qwt/qwt_plot_rasteritem.h
src/lib/qwt/qwt_legend_item.h
src/lib/qwt/qwt_scale_engine.h
src/lib/qwt/qwt_double_rect.h
src/lib/qwt/qwt_abstract_scale.h
src/lib/qwt/qwt_abstract_slider.h
src/lib/qwt/qwt_compass.h
src/lib/qwt/qwt_plot_scaleitem.h
src/lib/qwt/qwt_panner.h
src/lib/qwt/qwt_thermo.h
src/lib/qwt/qwt_plot_dict.h
src/lib/qwt/qwt_scale_div.h
src/lib/qwt/qwt_paint_buffer.h
src/lib/qwt/qwt_plot_printfilter.h
src/lib/qwt/qwt_array.h
)
set (qwtSrc
src/lib/qwt/qwt_plot_magnifier.cpp
src/lib/qwt/qwt_plot_curve.cpp
src/lib/qwt/qwt_panner.cpp
src/lib/qwt/qwt_round_scale_draw.cpp
src/lib/qwt/qwt_clipper.cpp
src/lib/qwt/qwt_plot_printfilter.cpp
src/lib/qwt/qwt_data.cpp
src/lib/qwt/qwt_text_engine.cpp
src/lib/qwt/qwt_dial.cpp
src/lib/qwt/qwt_plot_rasteritem.cpp
src/lib/qwt/qwt_spline.cpp
src/lib/qwt/qwt_rect.cpp
src/lib/qwt/qwt_plot_canvas.cpp
src/lib/qwt/qwt_magnifier.cpp
src/lib/qwt/qwt_analog_clock.cpp
src/lib/qwt/qwt_knob.cpp
src/lib/qwt/qwt_counter.cpp
src/lib/qwt/qwt_plot_axis.cpp
src/lib/qwt/qwt_interval_data.cpp
src/lib/qwt/qwt_scale_map.cpp
src/lib/qwt/qwt_slider.cpp
src/lib/qwt/qwt_compass_rose.cpp
src/lib/qwt/qwt_plot_print.cpp
src/lib/qwt/qwt_plot_layout.cpp
src/lib/qwt/qwt_abstract_scale_draw.cpp
src/lib/qwt/qwt_abstract_slider.cpp
src/lib/qwt/qwt_picker.cpp
src/lib/qwt/qwt_raster_data.cpp
src/lib/qwt/qwt_picker_machine.cpp
src/lib/qwt/qwt_plot_marker.cpp
src/lib/qwt/qwt_scale_draw.cpp
src/lib/qwt/qwt_thermo.cpp
src/lib/qwt/qwt_layout_metrics.cpp
src/lib/qwt/qwt_dial_needle.cpp
src/lib/qwt/qwt_plot_xml.cpp
src/lib/qwt/qwt_legend.cpp
src/lib/qwt/qwt_plot_picker.cpp
src/lib/qwt/qwt_event_pattern.cpp
src/lib/qwt/qwt_curve_fitter.cpp
src/lib/qwt/qwt_double_range.cpp
src/lib/qwt/qwt_painter.cpp
src/lib/qwt/qwt_double_interval.cpp
src/lib/qwt/qwt_math.cpp
src/lib/qwt/qwt_plot_item.cpp
src/lib/qwt/qwt_plot_zoomer.cpp
src/lib/qwt/qwt_symbol.cpp
src/lib/qwt/qwt_scale_div.cpp
src/lib/qwt/qwt_color_map.cpp
src/lib/qwt/qwt_plot.cpp
src/lib/qwt/qwt_plot_spectrogram.cpp
src/lib/qwt/qwt_paint_buffer.cpp
src/lib/qwt/qwt_plot_dict.cpp
src/lib/qwt/qwt_scale_widget.cpp
src/lib/qwt/qwt_text.cpp
src/lib/qwt/qwt_dyngrid_layout.cpp
src/lib/qwt/qwt_abstract_scale.cpp
src/lib/qwt/qwt_plot_svgitem.cpp
src/lib/qwt/qwt_arrow_button.cpp
src/lib/qwt/qwt_double_rect.cpp
src/lib/qwt/qwt_compass.cpp
src/lib/qwt/qwt_wheel.cpp
src/lib/qwt/qwt_legend_item.cpp
src/lib/qwt/qwt_plot_scaleitem.cpp
src/lib/qwt/qwt_text_label.cpp
src/lib/qwt/qwt_plot_panner.cpp
src/lib/qwt/qwt_scale_engine.cpp
src/lib/qwt/qwt_plot_grid.cpp
)
set (qextserialportHdrs
src/lib/qextserialport/qextserialport.h
src/lib/qextserialport/qextserialbase.h
src/lib/qextserialport/posix_qextserialport.h
#src/lib/qextserialport/win_qextserialport.h
src/lib/qextserialport/qextserialenumerator.h
)
set (qextserialportSrc
src/lib/qextserialport/posix_qextserialport.cpp
src/lib/qextserialport/qextserialport.cpp
src/lib/qextserialport/qextserialbase.cpp
#src/lib/qextserialport/win_qextserialport.cpp
src/lib/qextserialport/qextserialenumerator.cpp
)
add_library(qextserialport ${qextserialportSrc})
add_library(qmapcontrol ${qmapcontrolSrc})
add_library(qwt ${qwtSrc})
# process qt files
qt4_wrap_cpp(qgroundcontrolMoc ${qgroundcontrolMocSrc})
qt4_wrap_ui(qgroundcontrolUi ${qgroundcontrolUiSrc})
......
/*=====================================================================
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
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