Commit fb4c0a0d authored by Lorenz Meier's avatar Lorenz Meier

Huge progress in vehicle config view, added text console to sensors view, all WIP, still ugly

parent 1d79eb00
...@@ -345,6 +345,16 @@ QPushButton, QToolButton { ...@@ -345,6 +345,16 @@ QPushButton, QToolButton {
background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #777, stop: 1 #333); background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #777, stop: 1 #333);
} }
QPushButton#planePushButton, QPushButton#flyingWingPushButton, QPushButton#quadXPushButton, QPushButton#quadPlusPushButton, QPushButton#hPushButton {
background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #777, stop: 1 #333);
border-radius: 12px;
min-height: 120px;
max-height: 140px;
min-width: 120px;
max-width: 140px;
border: 3px solid #465158;
}
QPushButton#viewModeGeneric, QPushButton#viewModePX4, QPushButton#viewModeAPM, QPushButton#viewModeAR { QPushButton#viewModeGeneric, QPushButton#viewModePX4, QPushButton#viewModeAPM, QPushButton#viewModeAR {
background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #73D95D, stop: 1 #18A154); background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #73D95D, stop: 1 #18A154);
border-radius: 12px; border-radius: 12px;
......
...@@ -157,6 +157,12 @@ ...@@ -157,6 +157,12 @@
<file>files/images/firmware/X8_on.png</file> <file>files/images/firmware/X8_on.png</file>
<file>files/images/firmware/Y6_off.png</file> <file>files/images/firmware/Y6_off.png</file>
<file>files/images/firmware/Y6_on.png</file> <file>files/images/firmware/Y6_on.png</file>
<file>files/images/px4/airframes/quad_x.png</file>
<file>files/images/px4/airframes/quad_+.png</file>
<file>files/images/px4/airframes/octo_+.png</file>
<file>files/images/px4/airframes/hexa_+.png</file>
<file>files/images/px4/airframes/hexa_x.png</file>
<file>files/images/px4/airframes/octo_x.png</file>
</qresource> </qresource>
<qresource prefix="/general"> <qresource prefix="/general">
<file alias="vera.ttf">files/styles/Vera.ttf</file> <file alias="vera.ttf">files/styles/Vera.ttf</file>
......
...@@ -465,6 +465,7 @@ void QGCPX4VehicleConfig::loadQgcConfig(bool primary) ...@@ -465,6 +465,7 @@ void QGCPX4VehicleConfig::loadQgcConfig(bool primary)
} }
} }
// Load general calibration for autopilot // Load general calibration for autopilot
//TODO: Handle this more gracefully, maybe have it scan the directory for multiple calibration entries? //TODO: Handle this more gracefully, maybe have it scan the directory for multiple calibration entries?
tool = new QGCToolWidget("", ui->sensorContents); tool = new QGCToolWidget("", ui->sensorContents);
...@@ -496,11 +497,11 @@ void QGCPX4VehicleConfig::loadQgcConfig(bool primary) ...@@ -496,11 +497,11 @@ void QGCPX4VehicleConfig::loadQgcConfig(bool primary)
delete tool; delete tool;
} }
//description.txt // //description.txt
QFile sensortipsfile(autopilotdir.absolutePath() + "/general/calibration/description.txt"); // QFile sensortipsfile(autopilotdir.absolutePath() + "/general/calibration/description.txt");
sensortipsfile.open(QIODevice::ReadOnly); // sensortipsfile.open(QIODevice::ReadOnly);
ui->sensorTips->setHtml(sensortipsfile.readAll()); //// ui->sensorTips->setHtml(sensortipsfile.readAll());
sensortipsfile.close(); // sensortipsfile.close();
} }
void QGCPX4VehicleConfig::menuButtonClicked() void QGCPX4VehicleConfig::menuButtonClicked()
{ {
......
...@@ -146,7 +146,7 @@ Config</string> ...@@ -146,7 +146,7 @@ Config</string>
<item> <item>
<widget class="QStackedWidget" name="stackedWidget"> <widget class="QStackedWidget" name="stackedWidget">
<property name="currentIndex"> <property name="currentIndex">
<number>2</number> <number>1</number>
</property> </property>
<widget class="QWidget" name="rcTab"> <widget class="QWidget" name="rcTab">
<layout class="QVBoxLayout" name="verticalLayout_17"> <layout class="QVBoxLayout" name="verticalLayout_17">
...@@ -753,54 +753,31 @@ Config</string> ...@@ -753,54 +753,31 @@ Config</string>
<bold>true</bold> <bold>true</bold>
</font> </font>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_14"> <layout class="QHBoxLayout" name="horizontalLayout">
<item> <item>
<widget class="QLabel" name="tabTitleLabel_3"> <widget class="QGCMessageView" name="widget" native="true"/>
<property name="text">
<string>Sensor Calibration</string>
</property>
</widget>
</item> </item>
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout_8"> <widget class="QScrollArea" name="scrollArea_3">
<item> <property name="widgetResizable">
<widget class="QTextBrowser" name="sensorTips"> <bool>true</bool>
<property name="html"> </property>
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt; <widget class="QWidget" name="sensorContents">
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt; <property name="geometry">
p, li { white-space: pre-wrap; } <rect>
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Lucida Grande'; font-size:16pt; font-weight:600; font-style:normal;&quot;&gt; <x>0</x>
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'MS Shell Dlg 2'; font-size:8pt; font-weight:400;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string> <y>0</y>
</property> <width>1039</width>
</widget> <height>731</height>
</item> </rect>
<item> </property>
<layout class="QVBoxLayout" name="verticalLayout_9" stretch="0"> <layout class="QVBoxLayout" name="verticalLayout_10">
<item> <item>
<widget class="QScrollArea" name="scrollArea_3"> <layout class="QVBoxLayout" name="sensorLayout"/>
<property name="widgetResizable">
<bool>true</bool>
</property>
<widget class="QWidget" name="sensorContents">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>98</width>
<height>28</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_10">
<item>
<layout class="QVBoxLayout" name="sensorLayout"/>
</item>
</layout>
</widget>
</widget>
</item> </item>
</layout> </layout>
</item> </widget>
</layout> </widget>
</item> </item>
</layout> </layout>
</widget> </widget>
...@@ -1206,6 +1183,12 @@ p, li { white-space: pre-wrap; } ...@@ -1206,6 +1183,12 @@ p, li { white-space: pre-wrap; }
<header>ui/QGCPendingParamWidget.h</header> <header>ui/QGCPendingParamWidget.h</header>
<container>1</container> <container>1</container>
</customwidget> </customwidget>
<customwidget>
<class>QGCMessageView</class>
<extends>QWidget</extends>
<header location="global">QGCMessageView.h</header>
<container>1</container>
</customwidget>
</customwidgets> </customwidgets>
<resources/> <resources/>
<connections/> <connections/>
......
#include "QGCPX4AirframeConfig.h" #include "QGCPX4AirframeConfig.h"
#include "ui_QGCPX4AirframeConfig.h" #include "ui_QGCPX4AirframeConfig.h"
#include "UASManager.h"
#include "UAS.h"
QGCPX4AirframeConfig::QGCPX4AirframeConfig(QWidget *parent) : QGCPX4AirframeConfig::QGCPX4AirframeConfig(QWidget *parent) :
QWidget(parent), QWidget(parent),
mav(NULL),
ui(new Ui::QGCPX4AirframeConfig) ui(new Ui::QGCPX4AirframeConfig)
{ {
ui->setupUi(this); ui->setupUi(this);
// Fill the lists here manually in accordance with the list from:
// https://github.com/PX4/Firmware/blob/master/ROMFS/px4fmu_common/init.d/rcS
ui->planeComboBox->addItem(tr("Multiplex Easystar 1/2"), 1);
ui->planeComboBox->addItem(tr("Hobbyking Bixler 1/2"), 10);
connect(ui->planeComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(planeSelected(int)));
ui->flyingWingComboBox->addItem(tr("Bormatec Camflyer Q"), 1);
ui->flyingWingComboBox->addItem(tr("Phantom FPV"), 10);
connect(ui->flyingWingComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(flyingWingSelected(int)));
ui->quadXComboBox->addItem(tr("Standard 10\" Quad"), 1);
ui->quadXComboBox->addItem(tr("DJI F330 8\" Quad"), 10);
connect(ui->quadXComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(quadXSelected(int)));
connect(ui->quadPlusComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(quadPlusSelected(int)));
connect(ui->hexaXComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(hexaXSelected(int)));
connect(ui->hexaPlusComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(hexaPlusSelected(int)));
connect(ui->octoXComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(octoXSelected(int)));
connect(ui->octoPlusComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(octoPlusSelected(int)));
connect(ui->hComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(hSelected(int)));
connect(ui->applyButton, SIGNAL(clicked()), this, SLOT(applyAndReboot()));
connect(UASManager::instance(), SIGNAL(activeUASSet(UASInterface*)), this, SLOT(setActiveUAS()));
setActiveUAS(UASManager::instance()->getActiveUAS());
}
void QGCPX4AirframeConfig::setActiveUAS(UASInterface* uas)
{
// if (mav)
if (!uas)
return;
mav = uas;
//connect(uas->getParamManager(), SIGNAL())
}
void QGCPX4AirframeConfig::setAirframeID(int id)
{
// If UAS is present, get param manager and set SYS_AUTOSTART ID
if (!mav)
return;
mav->getParamManager()->setParameter(0, "SYS_AUTOSTART", (qint32)id);
}
void QGCPX4AirframeConfig::applyAndReboot()
{
UAS* uas = qobject_cast<UAS*>(mav);
if (!uas)
return;
// Store parameters
uas->executeCommand(MAV_CMD_PREFLIGHT_STORAGE, 1, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0);
// Reboot
uas->executeCommand(MAV_CMD_PREFLIGHT_REBOOT_SHUTDOWN, 1, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0);
}
void QGCPX4AirframeConfig::setAutoConfig(bool enabled)
{
if (!mav)
return;
mav->getParamManager()->setParameter(0, "SYS_AUTOCONFIG", (qint32) ((enabled) ? 1 : 0));
}
void QGCPX4AirframeConfig::flyingWingSelected()
{
} }
void QGCPX4AirframeConfig::flyingWingSelected(int index)
{
int system_index = ui->flyingWingComboBox->itemData(index).toInt();
setAirframeID(system_index);
}
void QGCPX4AirframeConfig::planeSelected()
{
}
void QGCPX4AirframeConfig::planeSelected(int index)
{
int system_index = ui->planeComboBox->itemData(index).toInt();
setAirframeID(system_index);
}
void QGCPX4AirframeConfig::quadXSelected()
{
}
void QGCPX4AirframeConfig::quadXSelected(int index)
{
int system_index = ui->quadXComboBox->itemData(index).toInt();
setAirframeID(system_index);
}
void QGCPX4AirframeConfig::quadPlusSelected()
{
}
void QGCPX4AirframeConfig::quadPlusSelected(int index)
{
int system_index = ui->quadPlusComboBox->itemData(index).toInt();
setAirframeID(system_index);
}
void QGCPX4AirframeConfig::hexaXSelected()
{
}
void QGCPX4AirframeConfig::hexaXSelected(int index)
{
int system_index = ui->hexaXComboBox->itemData(index).toInt();
setAirframeID(system_index);
}
void QGCPX4AirframeConfig::hexaPlusSelected()
{
}
void QGCPX4AirframeConfig::hexaPlusSelected(int index)
{
int system_index = ui->hexaPlusComboBox->itemData(index).toInt();
setAirframeID(system_index);
}
void QGCPX4AirframeConfig::octoXSelected()
{
}
void QGCPX4AirframeConfig::octoXSelected(int index)
{
int system_index = ui->octoXComboBox->itemData(index).toInt();
setAirframeID(system_index);
}
void QGCPX4AirframeConfig::octoPlusSelected()
{
}
void QGCPX4AirframeConfig::octoPlusSelected(int index)
{
int system_index = ui->octoPlusComboBox->itemData(index).toInt();
setAirframeID(system_index);
}
void QGCPX4AirframeConfig::hSelected()
{
}
void QGCPX4AirframeConfig::hSelected(int index)
{
int system_index = ui->hComboBox->itemData(index).toInt();
setAirframeID(system_index);
}
QGCPX4AirframeConfig::~QGCPX4AirframeConfig() QGCPX4AirframeConfig::~QGCPX4AirframeConfig()
{ {
delete ui; delete ui;
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
#define QGCPX4AIRFRAMECONFIG_H #define QGCPX4AIRFRAMECONFIG_H
#include <QWidget> #include <QWidget>
#include <UASInterface.h>
namespace Ui { namespace Ui {
class QGCPX4AirframeConfig; class QGCPX4AirframeConfig;
...@@ -14,8 +15,66 @@ class QGCPX4AirframeConfig : public QWidget ...@@ -14,8 +15,66 @@ class QGCPX4AirframeConfig : public QWidget
public: public:
explicit QGCPX4AirframeConfig(QWidget *parent = 0); explicit QGCPX4AirframeConfig(QWidget *parent = 0);
~QGCPX4AirframeConfig(); ~QGCPX4AirframeConfig();
public slots:
/**
* @brief Set the system currently operated on by this widget
* @param uas The currently active / configured system
*/
void setActiveUAS(UASInterface* uas);
/**
* @brief Quadrotor in X configuration has been selected
*/
void quadXSelected();
/**
* @brief Quadrotor in X configuration has been selected with sub-type
* @param index The autostart index which maps to a particular sub-type
*/
void quadXSelected(int index);
void flyingWingSelected();
void flyingWingSelected(int index);
void planeSelected();
void planeSelected(int index);
void quadPlusSelected();
void quadPlusSelected(int index);
void hexaXSelected();
void hexaXSelected(int index);
void hexaPlusSelected();
void hexaPlusSelected(int index);
void octoXSelected();
void octoXSelected(int index);
void octoPlusSelected();
void octoPlusSelected(int index);
void hSelected();
void hSelected(int index);
/**
* @brief Apply changes and reboot system
*/
void applyAndReboot();
protected:
/**
* @brief Set the ID of the current airframe
* @param id the ID as defined by the PX4 SYS_AUTOSTART enum
*/
void setAirframeID(int id);
/**
* @brief Enable automatic configuration
* @param enabled If true, the system sets the default gains for this platform on the next boot
*/
void setAutoConfig(bool enabled);
private: private:
UASInterface* mav;
Ui::QGCPX4AirframeConfig *ui; Ui::QGCPX4AirframeConfig *ui;
}; };
......
...@@ -6,8 +6,8 @@ ...@@ -6,8 +6,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>602</width> <width>803</width>
<height>345</height> <height>416</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
...@@ -24,8 +24,8 @@ ...@@ -24,8 +24,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>561</width> <width>802</width>
<height>299</height> <height>531</height>
</rect> </rect>
</property> </property>
<layout class="QGridLayout" name="gridLayout"> <layout class="QGridLayout" name="gridLayout">
...@@ -121,6 +121,16 @@ ...@@ -121,6 +121,16 @@
<property name="text"> <property name="text">
<string/> <string/>
</property> </property>
<property name="icon">
<iconset resource="../../../qgroundcontrol.qrc">
<normaloff>:/files/images/px4/airframes/quad_x.png</normaloff>:/files/images/px4/airframes/quad_x.png</iconset>
</property>
<property name="iconSize">
<size>
<width>120</width>
<height>120</height>
</size>
</property>
</widget> </widget>
</item> </item>
<item> <item>
...@@ -159,14 +169,24 @@ ...@@ -159,14 +169,24 @@
<item row="0" column="3"> <item row="0" column="3">
<layout class="QVBoxLayout" name="verticalLayout_4"> <layout class="QVBoxLayout" name="verticalLayout_4">
<item> <item>
<widget class="QPushButton" name="QuadPlusPushButton"> <widget class="QPushButton" name="quadPlusPushButton">
<property name="text"> <property name="text">
<string>PushButton</string> <string/>
</property>
<property name="icon">
<iconset resource="../../../qgroundcontrol.qrc">
<normaloff>:/files/images/px4/airframes/quad_+.png</normaloff>:/files/images/px4/airframes/quad_+.png</iconset>
</property>
<property name="iconSize">
<size>
<width>120</width>
<height>120</height>
</size>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QComboBox" name="comboBox_4"/> <widget class="QComboBox" name="quadPlusComboBox"/>
</item> </item>
<item> <item>
<widget class="QLabel" name="label_4"> <widget class="QLabel" name="label_4">
...@@ -180,14 +200,24 @@ ...@@ -180,14 +200,24 @@
<item row="1" column="0"> <item row="1" column="0">
<layout class="QVBoxLayout" name="verticalLayout_5"> <layout class="QVBoxLayout" name="verticalLayout_5">
<item> <item>
<widget class="QPushButton" name="HexaXPushButton"> <widget class="QPushButton" name="hexaXPushButton">
<property name="text"> <property name="text">
<string>PushButton</string> <string/>
</property>
<property name="icon">
<iconset resource="../../../qgroundcontrol.qrc">
<normaloff>:/files/images/px4/airframes/hexa_x.png</normaloff>:/files/images/px4/airframes/hexa_x.png</iconset>
</property>
<property name="iconSize">
<size>
<width>120</width>
<height>120</height>
</size>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QComboBox" name="comboBox_5"/> <widget class="QComboBox" name="hexaXComboBox"/>
</item> </item>
<item> <item>
<widget class="QLabel" name="label_5"> <widget class="QLabel" name="label_5">
...@@ -201,14 +231,24 @@ ...@@ -201,14 +231,24 @@
<item row="1" column="1"> <item row="1" column="1">
<layout class="QVBoxLayout" name="verticalLayout_6"> <layout class="QVBoxLayout" name="verticalLayout_6">
<item> <item>
<widget class="QPushButton" name="HexaPlusPushButton"> <widget class="QPushButton" name="hexaPlusPushButton">
<property name="text"> <property name="text">
<string>PushButton</string> <string/>
</property>
<property name="icon">
<iconset resource="../../../qgroundcontrol.qrc">
<normaloff>:/files/images/px4/airframes/hexa_+.png</normaloff>:/files/images/px4/airframes/hexa_+.png</iconset>
</property>
<property name="iconSize">
<size>
<width>120</width>
<height>120</height>
</size>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QComboBox" name="comboBox_6"/> <widget class="QComboBox" name="hexaPlusComboBox"/>
</item> </item>
<item> <item>
<widget class="QLabel" name="label_6"> <widget class="QLabel" name="label_6">
...@@ -224,12 +264,22 @@ ...@@ -224,12 +264,22 @@
<item> <item>
<widget class="QPushButton" name="octoXPushButton"> <widget class="QPushButton" name="octoXPushButton">
<property name="text"> <property name="text">
<string>PushButton</string> <string/>
</property>
<property name="icon">
<iconset resource="../../../qgroundcontrol.qrc">
<normaloff>:/files/images/px4/airframes/octo_x.png</normaloff>:/files/images/px4/airframes/octo_x.png</iconset>
</property>
<property name="iconSize">
<size>
<width>120</width>
<height>120</height>
</size>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QComboBox" name="comboBox_7"/> <widget class="QComboBox" name="octoXComboBox"/>
</item> </item>
<item> <item>
<widget class="QLabel" name="label_7"> <widget class="QLabel" name="label_7">
...@@ -245,12 +295,22 @@ ...@@ -245,12 +295,22 @@
<item> <item>
<widget class="QPushButton" name="octoPlusPushButton"> <widget class="QPushButton" name="octoPlusPushButton">
<property name="text"> <property name="text">
<string>PushButton</string> <string/>
</property>
<property name="icon">
<iconset resource="../../../qgroundcontrol.qrc">
<normaloff>:/files/images/px4/airframes/octo_+.png</normaloff>:/files/images/px4/airframes/octo_+.png</iconset>
</property>
<property name="iconSize">
<size>
<width>120</width>
<height>120</height>
</size>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QComboBox" name="comboBox_8"/> <widget class="QComboBox" name="octoPlusComboBox"/>
</item> </item>
<item> <item>
<widget class="QLabel" name="label_8"> <widget class="QLabel" name="label_8">
...@@ -266,12 +326,12 @@ ...@@ -266,12 +326,12 @@
<item> <item>
<widget class="QPushButton" name="hPushButton"> <widget class="QPushButton" name="hPushButton">
<property name="text"> <property name="text">
<string>PushButton</string> <string/>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QComboBox" name="comboBox_9"> <widget class="QComboBox" name="hComboBox">
<item> <item>
<property name="text"> <property name="text">
<string>Steadydrone</string> <string>Steadydrone</string>
...@@ -313,6 +373,8 @@ ...@@ -313,6 +373,8 @@
</item> </item>
</layout> </layout>
</widget> </widget>
<resources/> <resources>
<include location="../../../qgroundcontrol.qrc"/>
</resources>
<connections/> <connections/>
</ui> </ui>
...@@ -22,6 +22,7 @@ QGCMessageView::QGCMessageView(QWidget *parent) : ...@@ -22,6 +22,7 @@ QGCMessageView::QGCMessageView(QWidget *parent) :
ui->horizontalLayout->addWidget(connectWidget); ui->horizontalLayout->addWidget(connectWidget);
ui->plainTextEdit->hide(); ui->plainTextEdit->hide();
setActiveUAS(UASManager::instance()->getActiveUAS());
connect(UASManager::instance(), SIGNAL(activeUASSet(UASInterface*)), this, SLOT(setActiveUAS(UASInterface*))); connect(UASManager::instance(), SIGNAL(activeUASSet(UASInterface*)), this, SLOT(setActiveUAS(UASInterface*)));
} }
......
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