Commit 498a8544 authored by Mariano Lizarraga's avatar Mariano Lizarraga

Added technosapiens' Slugs View. Need to create a new menu entry and a SLUGS icon for the menu

parent 53e8ec10
...@@ -135,7 +135,8 @@ FORMS += src/ui/MainWindow.ui \ ...@@ -135,7 +135,8 @@ FORMS += src/ui/MainWindow.ui \
src/ui/QGCPxImuFirmwareUpdate.ui \ src/ui/QGCPxImuFirmwareUpdate.ui \
src/ui/QGCDataPlot2D.ui \ src/ui/QGCDataPlot2D.ui \
src/ui/QGCRemoteControlView.ui \ src/ui/QGCRemoteControlView.ui \
src/ui/WaypointGlobalView.ui src/ui/WaypointGlobalView.ui \
src/ui/SlugsDataSensorView.ui
INCLUDEPATH += src \ INCLUDEPATH += src \
src/ui \ src/ui \
src/ui/linechart \ src/ui/linechart \
...@@ -234,7 +235,8 @@ HEADERS += src/MG.h \ ...@@ -234,7 +235,8 @@ HEADERS += src/MG.h \
src/ui/map3D/WebImage.h \ src/ui/map3D/WebImage.h \
src/ui/map3D/WebImageCache.h \ src/ui/map3D/WebImageCache.h \
src/ui/map3D/Imagery.h \ src/ui/map3D/Imagery.h \
src/comm/QGCMAVLink.h src/comm/QGCMAVLink.h\
src/ui/SlugsDataSensorView.h
SOURCES += src/main.cc \ SOURCES += src/main.cc \
src/Core.cc \ src/Core.cc \
src/uas/UASManager.cc \ src/uas/UASManager.cc \
...@@ -313,7 +315,9 @@ SOURCES += src/main.cc \ ...@@ -313,7 +315,9 @@ SOURCES += src/main.cc \
src/ui/map3D/TextureCache.cc \ src/ui/map3D/TextureCache.cc \
src/ui/map3D/WebImageCache.cc \ src/ui/map3D/WebImageCache.cc \
src/ui/map3D/WebImage.cc \ src/ui/map3D/WebImage.cc \
src/ui/map3D/Imagery.cc src/ui/map3D/Imagery.cc \
src/ui/SlugsDataSensorView.cc
RESOURCES = mavground.qrc RESOURCES = mavground.qrc
# Include RT-LAB Library # Include RT-LAB Library
......
...@@ -2,7 +2,11 @@ ...@@ -2,7 +2,11 @@
#define CONFIGURATION_H #define CONFIGURATION_H
/** @brief Polling interval in ms */ /** @brief Polling interval in ms */
#define SERIAL_POLL_INTERVAL 2 #ifdef MAVLINK_ENABLED_SLUGS_MESSAGES_QGC
#define SERIAL_POLL_INTERVAL 7
#else
#define SERIAL_POLL_INTERVAL 2
#endif
/** @brief Heartbeat emission rate, in Hertz (times per second) */ /** @brief Heartbeat emission rate, in Hertz (times per second) */
#define MAVLINK_HEARTBEAT_DEFAULT_RATE 1 #define MAVLINK_HEARTBEAT_DEFAULT_RATE 1
......
...@@ -178,6 +178,9 @@ void MainWindow::buildWidgets() ...@@ -178,6 +178,9 @@ void MainWindow::buildWidgets()
//FIXME: free memory in destructor //FIXME: free memory in destructor
joystick = new JoystickInput(); joystick = new JoystickInput();
slugsDataWidget = new QDockWidget(tr("Slugs Data"), this);
slugsDataWidget->setWidget( new SlugsDataSensorView(this));
} }
/** /**
...@@ -377,6 +380,8 @@ void MainWindow::connectActions() ...@@ -377,6 +380,8 @@ void MainWindow::connectActions()
// Joystick configuration // Joystick configuration
connect(ui.actionJoystickSettings, SIGNAL(triggered()), this, SLOT(configure())); connect(ui.actionJoystickSettings, SIGNAL(triggered()), this, SLOT(configure()));
// Slugs View
connect(ui.actionShow_Slugs_View, SIGNAL(triggered()), this, SLOT(loadSlugsView()));
} }
...@@ -649,11 +654,11 @@ void MainWindow::loadSlugsView() ...@@ -649,11 +654,11 @@ void MainWindow::loadSlugsView()
debugConsoleDockWidget->show(); debugConsoleDockWidget->show();
} }
// ONBOARD PARAMETERS // Slugs Data View
if (parametersDockWidget) if (slugsDataWidget)
{ {
addDockWidget(Qt::RightDockWidgetArea, parametersDockWidget); addDockWidget(Qt::RightDockWidgetArea, slugsDataWidget);
parametersDockWidget->show(); slugsDataWidget->show();
} }
this->show(); this->show();
......
...@@ -64,7 +64,7 @@ This file is part of the QGROUNDCONTROL project ...@@ -64,7 +64,7 @@ This file is part of the QGROUNDCONTROL project
#include "QGCDataPlot2D.h" #include "QGCDataPlot2D.h"
#include "QGCRemoteControlView.h" #include "QGCRemoteControlView.h"
#include "QMap3DWidget.h" #include "QMap3DWidget.h"
#include "SlugsDataSensorView.h"
#include "LogCompressor.h" #include "LogCompressor.h"
...@@ -179,6 +179,7 @@ protected: ...@@ -179,6 +179,7 @@ protected:
QPointer<QDockWidget> headUpDockWidget; QPointer<QDockWidget> headUpDockWidget;
QPointer<QDockWidget> hsiDockWidget; QPointer<QDockWidget> hsiDockWidget;
QPointer<QDockWidget> rcViewDockWidget; QPointer<QDockWidget> rcViewDockWidget;
QPointer<QDockWidget> slugsDataWidget;
// Popup widgets // Popup widgets
JoystickWidget* joystickWidget; JoystickWidget* joystickWidget;
......
...@@ -38,7 +38,7 @@ ...@@ -38,7 +38,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>1000</width> <width>1000</width>
<height>25</height> <height>22</height>
</rect> </rect>
</property> </property>
<widget class="QMenu" name="menuMGround"> <widget class="QMenu" name="menuMGround">
...@@ -82,6 +82,7 @@ ...@@ -82,6 +82,7 @@
<addaction name="actionShow_data_analysis_view"/> <addaction name="actionShow_data_analysis_view"/>
<addaction name="actionShow_full_view"/> <addaction name="actionShow_full_view"/>
<addaction name="actionStyleConfig"/> <addaction name="actionStyleConfig"/>
<addaction name="actionShow_Slugs_View"/>
</widget> </widget>
<widget class="QMenu" name="menuHelp"> <widget class="QMenu" name="menuHelp">
<property name="title"> <property name="title">
...@@ -318,6 +319,15 @@ ...@@ -318,6 +319,15 @@
<string>Show Global operator view</string> <string>Show Global operator view</string>
</property> </property>
</action> </action>
<action name="actionShow_Slugs_View">
<property name="icon">
<iconset resource="../../mavground.qrc">
<normaloff>:/images/categories/applications-internet.svg</normaloff>:/images/categories/applications-internet.svg</iconset>
</property>
<property name="text">
<string>Show Slugs View</string>
</property>
</action>
</widget> </widget>
<layoutdefault spacing="6" margin="11"/> <layoutdefault spacing="6" margin="11"/>
<resources> <resources>
......
#include "SlugsDataSensorView.h"
#include "ui_SlugsDataSensorView.h"
#include <UASManager.h>
SlugsDataSensorView::SlugsDataSensorView(QWidget *parent) :
QWidget(parent),
ui(new Ui::SlugsDataSensorView)
{
ui->setupUi(this);
connect(UASManager::instance(), SIGNAL(activeUASSet(UASInterface*)), this, SLOT(setActiveUAS(UASInterface*)));
activeUAS = NULL;
loadParameters();
this->setVisible(false);
// timer for refresh UI
updateTimer = new QTimer(this);
connect(updateTimer, SIGNAL(timeout()), this, SLOT(refresh()));
updateTimer->start(200);
}
void SlugsDataSensorView::loadParameters()
{
Xpos = 0;
Ypos = 0;
Zpos = 0;
TimeActualPosition = 0;
VXpos = 0;
VYpos = 0;
VZpos = 0;
TimeActualSpeed =0;
roll = 0;
pitch = 0;
yaw = 0;
TimeActualAttitude = 0;
//Sensor Biases
//Acelerometer
Axb = 0;
Ayb = 0;
Azb = 0;
TimeActualAcel = 0;
//Gyro
Gxb = 0;
Gyb = 0;
Gzb = 0;
TimeActualGyro = 0;
}
SlugsDataSensorView::~SlugsDataSensorView()
{
delete ui;
}
void SlugsDataSensorView::addUAS(UASInterface* uas)
{
if (uas != NULL)
{
connect(uas, SIGNAL(localPositionChanged(UASInterface*,double,double,double,quint64)), this, SLOT(slugLocalPositionChange(UASInterface*,double,double,double,quint64)));
connect(uas, SIGNAL(speedChanged(UASInterface*,double,double,double,quint64)), this, SLOT(slugSpeedLocalPositionChanged(UASInterface*,double,double,double,quint64)));
connect(uas, SIGNAL(attitudeChanged(UASInterface*,double,double,double,quint64)), this, SLOT(slugAttitudeChanged(UASInterface*,double,double,double,quint64)));
connect(uas, SIGNAL(sensorBiasAcelerometerChanged(UASInterface*,double,double,double,quint64)), this, SLOT(slugsSensorBiasAcelerometerChanged(UASInterface*,double,double,double,quint64)));
// Set this UAS as active if it is the first one
if(activeUAS == 0)
{
activeUAS = uas;
}
}
}
void SlugsDataSensorView::setActiveUAS(UASInterface* uas)
{
activeUAS = uas;
}
void SlugsDataSensorView::refresh()
{
//refresh UI position data
ui->ed_x->setPlainText(QString::number(Xpos, 'f', 4));
ui->ed_y->setPlainText(QString::number(Ypos, 'f', 4));
ui->ed_z->setPlainText(QString::number(Zpos, 'f', 4));
//refresh UI speed position data
ui->ed_vx->setPlainText(QString::number(VXpos,'f',4));
ui->ed_vy->setPlainText(QString::number(VYpos,'f',4));
ui->ed_vz->setPlainText(QString::number(VZpos,'f',4));
//refresh UI attitude data
ui->m_SlugAttitudeRoll_plainTextEdit->setPlainText(QString::number(roll,'f',4));
ui->m_SlugAttitudePitch_plainTextEdit->setPlainText(QString::number(pitch,'f',4));
ui->m_SlugAttitudeYaw_plainTextEdit->setPlainText(QString::number(yaw,'f',4));
//refresh UI sensor bias acelerometer data
ui->m_SlugsAxBiases_textEdit->setText(QString::number(Axb, 'f', 4));
ui->m_SlugsAyBiases_textEdit->setText(QString::number(Ayb, 'f', 4));
ui->m_SlugsAzBiases_textEdit->setText(QString::number(Azb, 'f', 4));
}
void SlugsDataSensorView::slugLocalPositionChanged(UASInterface * uasTemp, double x, double y, double z, quint64 time)
{
Q_UNUSED( uasTemp);
Xpos = x;
Ypos = y;
Zpos = z;
TimeActualPosition = time;
}
void SlugsDataSensorView::slugSpeedLocalPositionChanged(UASInterface *uasTemp, double vx, double vy, double vz, quint64 time)
{
Q_UNUSED( uasTemp);
VXpos = vx;
VYpos = vy;
VZpos = vz;
TimeActualSpeed = time;
}
void SlugsDataSensorView::slugAttitudeChanged(UASInterface *uasTemp, double slugroll, double slugpitch, double slugyaw, quint64 time)
{
Q_UNUSED( uasTemp);
roll = slugroll;
pitch = slugpitch;
yaw = slugyaw;
TimeActualAttitude = time;
}
void SlugsDataSensorView::slugsSensorBiasAcelerometerChanged(UASInterface *uasTemp, double axb, double ayb, double azb, quint64 time)
{
Q_UNUSED( uasTemp);
Axb = axb;
Ayb = ayb;
Azb = azb;
TimeActualAcel = time;
}
/*=====================================================================
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 Grpahical presentation of SLUGS generated data
*
* @author Juan F. Robles <jfroblesc@gmail.com>
*
*/
#ifndef SLUGSDATASENSORVIEW_H
#define SLUGSDATASENSORVIEW_H
#include <QWidget>
#include "UASInterface.h"
namespace Ui {
class SlugsDataSensorView;
}
class SlugsDataSensorView : public QWidget
{
Q_OBJECT
public:
explicit SlugsDataSensorView(QWidget *parent = 0);
~SlugsDataSensorView();
public slots:
/**
* @brief Adds the UAS for data display
*
* Adds the UAS and makes all the correct connections for data display on the Widgets. If
* there is no current UAS active, it sets it as active.
* @param uas The UAS being added
*/
void addUAS(UASInterface* uas);
/**
* @brief Sets the UAS as active
*
* @param uas The UAS being set as active
*/
void setActiveUAS(UASInterface* uas);
/**
* @brief Adds the UAS for data display
*
* Adds the UAS and makes all the correct connections for data display on the Widgets
*/
void refresh();
void slugLocalPositionChanged(UASInterface* uasTemp,double x,double y,double z,quint64 time);
void slugSpeedLocalPositionChanged(UASInterface* uasTemp,double vx,double vy,double vz,quint64 time);
void slugAttitudeChanged(UASInterface* uasTemp,double slugroll,double slugpitch,double slugyaw, quint64 time);
void slugsSensorBiasAcelerometerChanged(UASInterface* uasTemp, double axb, double ayb, double azb, quint64 time);
protected:
QTimer* updateTimer;
UASInterface* activeUAS;
// Position and Attitude
//Position
double Xpos;
double Ypos;
double Zpos;
quint64 TimeActualPosition;
//Speed
double VXpos;
double VYpos;
double VZpos;
quint64 TimeActualSpeed;
//Attitude
double roll;
double pitch;
double yaw;
quint64 TimeActualAttitude;
//Sensor Biases
//Acelerometer
double Axb;
double Ayb;
double Azb;
quint64 TimeActualAcel;
//Gyro
double Gxb;
double Gyb;
double Gzb;
quint64 TimeActualGyro;
private:
Ui::SlugsDataSensorView *ui;
void loadParameters();
};
#endif // SLUGSDATASENSORVIEW_H
This diff is collapsed.
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