Browse Source

New config windows, dynamically generated based on ANY qgw files in the

configuration directories
QGC4.4
Michael Carpenter 12 years ago
parent
commit
87de0f5b21
  1. 63
      src/ui/QGCVehicleConfig.cc
  2. 140
      src/ui/QGCVehicleConfig.ui

63
src/ui/QGCVehicleConfig.cc

@ -8,6 +8,7 @@ @@ -8,6 +8,7 @@
#endif
#include <QTimer>
#include <QDir>
#include "QGCVehicleConfig.h"
#include "UASManager.h"
@ -188,9 +189,66 @@ void QGCVehicleConfig::setActiveUAS(UASInterface* active) @@ -188,9 +189,66 @@ void QGCVehicleConfig::setActiveUAS(UASInterface* active)
QGCToolWidget* tool;
QDir autopilotdir(qApp->applicationDirPath() + "/files/" + mav->getAutopilotTypeName().toLower());
QDir generaldir = QDir(autopilotdir.absolutePath() + "/general/widgets");
QDir vehicledir = QDir(autopilotdir.absolutePath() + "/" + mav->getSystemTypeName().toLower() + "/widgets");
if (!autopilotdir.exists("general"))
{
//TODO: Throw some kind of error here. There is no general configuration directory
qDebug() << "invalid general dir";
}
if (!autopilotdir.exists(mav->getAutopilotTypeName().toLower()))
{
//TODO: Throw an error here too, no autopilot specific configuration
qDebug() << "invalid vehicle dir";
}
qDebug() << autopilotdir.absolutePath();
qDebug() << generaldir.absolutePath();
qDebug() << vehicledir.absolutePath();
foreach (QString file,generaldir.entryList(QDir::Files | QDir::NoDotAndDotDot))
{
if (file.toLower().endsWith(".qgw")) {
tool = new QGCToolWidget("", this);
if (tool->loadSettings(generaldir.absoluteFilePath(file), false))
{
toolWidgets.append(tool);
//ui->sensorLayout->addWidget(tool);
QGroupBox *box = new QGroupBox(this);
box->setTitle(tool->objectName());
box->setLayout(new QVBoxLayout());
box->layout()->addWidget(tool);
ui->multiRotorAttitudeLayout->addWidget(box);
} else {
delete tool;
}
}
}
foreach (QString file,vehicledir.entryList(QDir::Files | QDir::NoDotAndDotDot))
{
if (file.toLower().endsWith(".qgw")) {
tool = new QGCToolWidget("", this);
if (tool->loadSettings(vehicledir.absoluteFilePath(file), false))
{
toolWidgets.append(tool);
//ui->sensorLayout->addWidget(tool);
QGroupBox *box = new QGroupBox(this);
box->setTitle(tool->objectName());
box->setLayout(new QVBoxLayout());
box->layout()->addWidget(tool);
ui->fixedWingAttitudeLayout->addWidget(box);
} else {
delete tool;
}
}
}
// Load calibration
tool = new QGCToolWidget("", this);
if (tool->loadSettings(defaultsDir + "px4_calibration.qgw", false))
if (tool->loadSettings(autopilotdir.absolutePath() + "/" + mav->getSystemTypeName().toLower() + "/calibration.qgw", false))
{
toolWidgets.append(tool);
ui->sensorLayout->addWidget(tool);
@ -199,6 +257,7 @@ void QGCVehicleConfig::setActiveUAS(UASInterface* active) @@ -199,6 +257,7 @@ void QGCVehicleConfig::setActiveUAS(UASInterface* active)
}
// Load multirotor attitude pid
/*
tool = new QGCToolWidget("", this);
if (tool->loadSettings(defaultsDir + "px4_mc_attitude_pid_params.qgw", false))
{
@ -256,7 +315,7 @@ void QGCVehicleConfig::setActiveUAS(UASInterface* active) @@ -256,7 +315,7 @@ void QGCVehicleConfig::setActiveUAS(UASInterface* active)
//ui->fixedWingPositionLayout->addWidget(tool);
} else {
delete tool;
}
}*/
updateStatus(QString("Reading from system %1").arg(mav->getUASName()));
}

140
src/ui/QGCVehicleConfig.ui

@ -40,7 +40,7 @@ @@ -40,7 +40,7 @@
<item row="0" column="0" colspan="2">
<widget class="QTabWidget" name="tabWidget">
<property name="currentIndex">
<number>1</number>
<number>0</number>
</property>
<widget class="QWidget" name="rcTab">
<attribute name="title">
@ -751,22 +751,22 @@ @@ -751,22 +751,22 @@
<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:13pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:18pt;&quot;&gt;Sensor Calibration&lt;/span&gt;&lt;/p&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-size:16pt;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:12pt;&quot;&gt;The PX4FMU sensors can be calibrated with the buttons on the right. Gyroscope (GYRO) and Accelerometer (ACCEL) calibrations have to be performed with a static, unmoved system. The magnetometer calibration needs to be performed while moving the device.&lt;/span&gt;&lt;/p&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-size:12pt;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:16pt;&quot;&gt;Magnetometer Calibration&lt;/span&gt;&lt;/p&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-size:16pt;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:12pt;&quot;&gt;Carefully follow the instructions. Click on MAG to start the calibration. Watch the communication console for further instructions (Available through Main Menu -&amp;gt; Tool Widgets -&amp;gt; Communication Console). Do not calibrate the vehicle in vincinity of metal, e.g. from a table or chair. Start the calibration, leave the system unmoved on the table. Wait for the double beep. Next move the system in a figure eight, roll and pitch it strongly, rotate around all axes and perform the figure eight also upside-down. The calibration is finished after the triple beep.&lt;/span&gt;&lt;/p&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-size:12pt;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:16pt;&quot;&gt;Accelerometer Calibration&lt;/span&gt;&lt;/p&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-size:16pt;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:12pt;&quot;&gt;Put the system on an absolutely level surface and press ACCEL, wait for the the triple beep. Do not move the system. If no flat surface is available, rather not calibrate the system.&lt;/span&gt;&lt;/p&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-size:12pt;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:16pt;&quot;&gt;Gyroscope Calibration&lt;/span&gt;&lt;/p&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-size:16pt;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:12pt;&quot;&gt;The orientation is not important for this calibration, but do not move the system until the triple beep or the matching text message in the console.&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'Lucida Grande'; font-size:18pt;&quot;&gt;Sensor Calibration&lt;/span&gt;&lt;/p&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:'Lucida Grande'; font-size:16pt;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'Lucida Grande'; font-size:12pt;&quot;&gt;The PX4FMU sensors can be calibrated with the buttons on the right. Gyroscope (GYRO) and Accelerometer (ACCEL) calibrations have to be performed with a static, unmoved system. The magnetometer calibration needs to be performed while moving the device.&lt;/span&gt;&lt;/p&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:'Lucida Grande'; font-size:12pt;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'Lucida Grande'; font-size:16pt;&quot;&gt;Magnetometer Calibration&lt;/span&gt;&lt;/p&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:'Lucida Grande'; font-size:16pt;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'Lucida Grande'; font-size:12pt;&quot;&gt;Carefully follow the instructions. Click on MAG to start the calibration. Watch the communication console for further instructions (Available through Main Menu -&amp;gt; Tool Widgets -&amp;gt; Communication Console). Do not calibrate the vehicle in vincinity of metal, e.g. from a table or chair. Start the calibration, leave the system unmoved on the table. Wait for the double beep. Next move the system in a figure eight, roll and pitch it strongly, rotate around all axes and perform the figure eight also upside-down. The calibration is finished after the triple beep.&lt;/span&gt;&lt;/p&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:'Lucida Grande'; font-size:12pt;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'Lucida Grande'; font-size:16pt;&quot;&gt;Accelerometer Calibration&lt;/span&gt;&lt;/p&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:'Lucida Grande'; font-size:16pt;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'Lucida Grande'; font-size:12pt;&quot;&gt;Put the system on an absolutely level surface and press ACCEL, wait for the the triple beep. Do not move the system. If no flat surface is available, rather not calibrate the system.&lt;/span&gt;&lt;/p&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:'Lucida Grande'; font-size:12pt;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'Lucida Grande'; font-size:16pt;&quot;&gt;Gyroscope Calibration&lt;/span&gt;&lt;/p&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:'Lucida Grande'; font-size:16pt;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'Lucida Grande'; font-size:12pt;&quot;&gt;The orientation is not important for this calibration, but do not move the system until the triple beep or the matching text message in the console.&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
@ -774,19 +774,12 @@ p, li { white-space: pre-wrap; } @@ -774,19 +774,12 @@ p, li { white-space: pre-wrap; }
</widget>
<widget class="QWidget" name="multirotorTab">
<attribute name="title">
<string>Multirotor Control</string>
<string>General Config</string>
</attribute>
<layout class="QGridLayout" name="gridLayout_3" columnstretch="80,0,0">
<property name="topMargin">
<number>20</number>
</property>
<item row="0" column="2">
<widget class="QPushButton" name="loadMultiRotorDefaultsButton">
<property name="text">
<string>Load Platform Defaults</string>
</property>
</widget>
</item>
<item row="0" column="0">
<spacer name="horizontalSpacer_8">
<property name="orientation">
@ -800,50 +793,20 @@ p, li { white-space: pre-wrap; } @@ -800,50 +793,20 @@ p, li { white-space: pre-wrap; }
</property>
</spacer>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="multiRotorComboBox"/>
</item>
<item row="2" column="0" colspan="3">
<widget class="QGroupBox" name="multiRotorControlPositionGroupBox">
<property name="title">
<string>Position</string>
<item row="0" column="2">
<widget class="QPushButton" name="loadMultiRotorDefaultsButton">
<property name="text">
<string>Load Platform Defaults</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_5">
<property name="margin">
<number>0</number>
</property>
<item>
<widget class="QScrollArea" name="scrollArea_2">
<property name="widgetResizable">
<bool>true</bool>
</property>
<widget class="QWidget" name="scrollAreaWidgetContents_2">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>98</width>
<height>28</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_4">
<property name="margin">
<number>0</number>
</property>
<item>
<layout class="QVBoxLayout" name="multiRotorPositionLayout"/>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
</widget>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="multiRotorComboBox"/>
</item>
<item row="1" column="0" colspan="3">
<widget class="QGroupBox" name="multiRotorControlAttitudeGroupBox">
<property name="title">
<string>Attitude</string>
<string>Configuration</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_3">
<property name="margin">
@ -859,8 +822,8 @@ p, li { white-space: pre-wrap; } @@ -859,8 +822,8 @@ p, li { white-space: pre-wrap; }
<rect>
<x>0</x>
<y>0</y>
<width>98</width>
<height>28</height>
<width>740</width>
<height>442</height>
</rect>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_4">
@ -881,49 +844,12 @@ p, li { white-space: pre-wrap; } @@ -881,49 +844,12 @@ p, li { white-space: pre-wrap; }
</widget>
<widget class="QWidget" name="fixedWingTab">
<attribute name="title">
<string>Fixed Wing Control</string>
<string>Hardware Specific Config</string>
</attribute>
<layout class="QGridLayout" name="gridLayout_4" columnstretch="65,30,19,1">
<layout class="QGridLayout" name="gridLayout_4" columnstretch="65,0,0,0">
<property name="topMargin">
<number>20</number>
</property>
<item row="3" column="0" colspan="4">
<widget class="QGroupBox" name="fixedWingControlPositionGroupBox">
<property name="title">
<string>Position</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<property name="margin">
<number>0</number>
</property>
<item>
<widget class="QScrollArea" name="scrollArea_3">
<property name="widgetResizable">
<bool>true</bool>
</property>
<widget class="QWidget" name="scrollAreaWidgetContents_3">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>98</width>
<height>28</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_6">
<property name="margin">
<number>0</number>
</property>
<item>
<layout class="QVBoxLayout" name="fixedWingPositionLayout"/>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
</widget>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="fixedWingComboBox"/>
</item>
@ -950,7 +876,7 @@ p, li { white-space: pre-wrap; } @@ -950,7 +876,7 @@ p, li { white-space: pre-wrap; }
<item row="1" column="0" colspan="4">
<widget class="QGroupBox" name="fixedWingControlAttitudeGroupBox">
<property name="title">
<string>Attitude</string>
<string>Configuration</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<property name="margin">
@ -966,8 +892,8 @@ p, li { white-space: pre-wrap; } @@ -966,8 +892,8 @@ p, li { white-space: pre-wrap; }
<rect>
<x>0</x>
<y>0</y>
<width>98</width>
<height>28</height>
<width>740</width>
<height>442</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_7">

Loading…
Cancel
Save