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 {
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 {
background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #73D95D, stop: 1 #18A154);
border-radius: 12px;
......
......@@ -157,6 +157,12 @@
<file>files/images/firmware/X8_on.png</file>
<file>files/images/firmware/Y6_off.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 prefix="/general">
<file alias="vera.ttf">files/styles/Vera.ttf</file>
......
......@@ -465,6 +465,7 @@ void QGCPX4VehicleConfig::loadQgcConfig(bool primary)
}
}
// Load general calibration for autopilot
//TODO: Handle this more gracefully, maybe have it scan the directory for multiple calibration entries?
tool = new QGCToolWidget("", ui->sensorContents);
......@@ -496,11 +497,11 @@ void QGCPX4VehicleConfig::loadQgcConfig(bool primary)
delete tool;
}
//description.txt
QFile sensortipsfile(autopilotdir.absolutePath() + "/general/calibration/description.txt");
sensortipsfile.open(QIODevice::ReadOnly);
ui->sensorTips->setHtml(sensortipsfile.readAll());
sensortipsfile.close();
// //description.txt
// QFile sensortipsfile(autopilotdir.absolutePath() + "/general/calibration/description.txt");
// sensortipsfile.open(QIODevice::ReadOnly);
//// ui->sensorTips->setHtml(sensortipsfile.readAll());
// sensortipsfile.close();
}
void QGCPX4VehicleConfig::menuButtonClicked()
{
......
......@@ -146,7 +146,7 @@ Config</string>
<item>
<widget class="QStackedWidget" name="stackedWidget">
<property name="currentIndex">
<number>2</number>
<number>1</number>
</property>
<widget class="QWidget" name="rcTab">
<layout class="QVBoxLayout" name="verticalLayout_17">
......@@ -753,54 +753,31 @@ Config</string>
<bold>true</bold>
</font>
</property>
<layout class="QVBoxLayout" name="verticalLayout_14">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="tabTitleLabel_3">
<property name="text">
<string>Sensor Calibration</string>
</property>
</widget>
<widget class="QGCMessageView" name="widget" native="true"/>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_8">
<item>
<widget class="QTextBrowser" name="sensorTips">
<property name="html">
<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;
&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;
p, li { white-space: pre-wrap; }
&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;
&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>
</property>
</widget>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_9" stretch="0">
<widget class="QScrollArea" name="scrollArea_3">
<property name="widgetResizable">
<bool>true</bool>
</property>
<widget class="QWidget" name="sensorContents">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>1039</width>
<height>731</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_10">
<item>
<widget class="QScrollArea" name="scrollArea_3">
<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>
<layout class="QVBoxLayout" name="sensorLayout"/>
</item>
</layout>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
</widget>
......@@ -1206,6 +1183,12 @@ p, li { white-space: pre-wrap; }
<header>ui/QGCPendingParamWidget.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>QGCMessageView</class>
<extends>QWidget</extends>
<header location="global">QGCMessageView.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<resources/>
<connections/>
......
#include "QGCPX4AirframeConfig.h"
#include "ui_QGCPX4AirframeConfig.h"
#include "UASManager.h"
#include "UAS.h"
QGCPX4AirframeConfig::QGCPX4AirframeConfig(QWidget *parent) :
QWidget(parent),
mav(NULL),
ui(new Ui::QGCPX4AirframeConfig)
{
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()
{
delete ui;
......
......@@ -2,6 +2,7 @@
#define QGCPX4AIRFRAMECONFIG_H
#include <QWidget>
#include <UASInterface.h>
namespace Ui {
class QGCPX4AirframeConfig;
......@@ -14,8 +15,66 @@ class QGCPX4AirframeConfig : public QWidget
public:
explicit QGCPX4AirframeConfig(QWidget *parent = 0);
~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:
UASInterface* mav;
Ui::QGCPX4AirframeConfig *ui;
};
......
......@@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>602</width>
<height>345</height>
<width>803</width>
<height>416</height>
</rect>
</property>
<property name="windowTitle">
......@@ -24,8 +24,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>561</width>
<height>299</height>
<width>802</width>
<height>531</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout">
......@@ -121,6 +121,16 @@
<property name="text">
<string/>
</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>
</item>
<item>
......@@ -159,14 +169,24 @@
<item row="0" column="3">
<layout class="QVBoxLayout" name="verticalLayout_4">
<item>
<widget class="QPushButton" name="QuadPlusPushButton">
<widget class="QPushButton" name="quadPlusPushButton">
<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>
</widget>
</item>
<item>
<widget class="QComboBox" name="comboBox_4"/>
<widget class="QComboBox" name="quadPlusComboBox"/>
</item>
<item>
<widget class="QLabel" name="label_4">
......@@ -180,14 +200,24 @@
<item row="1" column="0">
<layout class="QVBoxLayout" name="verticalLayout_5">
<item>
<widget class="QPushButton" name="HexaXPushButton">
<widget class="QPushButton" name="hexaXPushButton">
<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>
</widget>
</item>
<item>
<widget class="QComboBox" name="comboBox_5"/>
<widget class="QComboBox" name="hexaXComboBox"/>
</item>
<item>
<widget class="QLabel" name="label_5">
......@@ -201,14 +231,24 @@
<item row="1" column="1">
<layout class="QVBoxLayout" name="verticalLayout_6">
<item>
<widget class="QPushButton" name="HexaPlusPushButton">
<widget class="QPushButton" name="hexaPlusPushButton">
<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>
</widget>
</item>
<item>
<widget class="QComboBox" name="comboBox_6"/>
<widget class="QComboBox" name="hexaPlusComboBox"/>
</item>
<item>
<widget class="QLabel" name="label_6">
......@@ -224,12 +264,22 @@
<item>
<widget class="QPushButton" name="octoXPushButton">
<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>
</widget>
</item>
<item>
<widget class="QComboBox" name="comboBox_7"/>
<widget class="QComboBox" name="octoXComboBox"/>
</item>
<item>
<widget class="QLabel" name="label_7">
......@@ -245,12 +295,22 @@
<item>
<widget class="QPushButton" name="octoPlusPushButton">
<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>
</widget>
</item>
<item>
<widget class="QComboBox" name="comboBox_8"/>
<widget class="QComboBox" name="octoPlusComboBox"/>
</item>
<item>
<widget class="QLabel" name="label_8">
......@@ -266,12 +326,12 @@
<item>
<widget class="QPushButton" name="hPushButton">
<property name="text">
<string>PushButton</string>
<string/>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="comboBox_9">
<widget class="QComboBox" name="hComboBox">
<item>
<property name="text">
<string>Steadydrone</string>
......@@ -313,6 +373,8 @@
</item>
</layout>
</widget>
<resources/>
<resources>
<include location="../../../qgroundcontrol.qrc"/>
</resources>
<connections/>
</ui>
......@@ -22,6 +22,7 @@ QGCMessageView::QGCMessageView(QWidget *parent) :
ui->horizontalLayout->addWidget(connectWidget);
ui->plainTextEdit->hide();
setActiveUAS(UASManager::instance()->getActiveUAS());
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