Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Valentin Platzgummer
qgroundcontrol
Commits
4cd86dec
Commit
4cd86dec
authored
Jul 16, 2013
by
Bill Bonney
Browse files
Merge branch 'new_menus' of
https://github.com/diydrones/apm_planner
into new_menus
Conflicts: qgroundcontrol.pro
parents
75def93b
98dc9dfc
Changes
41
Expand all
Hide whitespace changes
Inline
Side-by-side
qgroundcontrol.pro
View file @
4cd86dec
...
...
@@ -255,7 +255,12 @@ FORMS += src/ui/MainWindow.ui \
src
/
ui
/
configuration
/
GeoFenceConfig
.
ui
\
src
/
ui
/
configuration
/
FailSafeConfig
.
ui
\
src
/
ui
/
configuration
/
AdvancedParamConfig
.
ui
\
src
/
ui
/
configuration
/
ArduCopterPidConfig
.
ui
src
/
ui
/
configuration
/
ArduCopterPidConfig
.
ui
\
src
/
ui
/
configuration
/
ApmPlaneLevel
.
ui
\
src
/
ui
/
configuration
/
ParamWidget
.
ui
\
src
/
ui
/
configuration
/
ArduPlanePidConfig
.
ui
\
src
/
ui
/
configuration
/
AdvParameterList
.
ui
\
src
/
ui
/
configuration
/
ArduRoverPidConfig
.
ui
INCLUDEPATH
+=
src
\
src
/
ui
\
src
/
ui
/
linechart
\
...
...
@@ -437,7 +442,12 @@ HEADERS += src/MG.h \
src
/
ui
/
configuration
/
FailSafeConfig
.
h
\
src
/
ui
/
configuration
/
AdvancedParamConfig
.
h
\
src
/
ui
/
configuration
/
ArduCopterPidConfig
.
h
\
src
/
ui
/
apmtoolbar
.
h
src
/
ui
/
apmtoolbar
.
h
\
src
/
ui
/
configuration
/
ApmPlaneLevel
.
h
\
src
/
ui
/
configuration
/
ParamWidget
.
h
\
src
/
ui
/
configuration
/
ArduPlanePidConfig
.
h
\
src
/
ui
/
configuration
/
AdvParameterList
.
h
\
src
/
ui
/
configuration
/
ArduRoverPidConfig
.
h
#
Google
Earth
is
only
supported
on
Mac
OS
and
Windows
with
Visual
Studio
Compiler
macx
|
macx
-
g
++
|
macx
-
g
++
42
|
win32
-
msvc2008
|
win32
-
msvc2010
|
win32
-
msvc2012
::
HEADERS
+=
src
/
ui
/
map3D
/
QGCGoogleEarthView
.
h
...
...
@@ -637,7 +647,12 @@ SOURCES += src/main.cc \
src
/
ui
/
configuration
/
FailSafeConfig
.
cc
\
src
/
ui
/
configuration
/
AdvancedParamConfig
.
cc
\
src
/
ui
/
configuration
/
ArduCopterPidConfig
.
cc
\
src
/
ui
/
apmtoolbar
.
cpp
src
/
ui
/
apmtoolbar
.
cpp
\
src
/
ui
/
configuration
/
ApmPlaneLevel
.
cc
\
src
/
ui
/
configuration
/
ParamWidget
.
cc
\
src
/
ui
/
configuration
/
ArduPlanePidConfig
.
cc
\
src
/
ui
/
configuration
/
AdvParameterList
.
cc
\
src
/
ui
/
configuration
/
ArduRoverPidConfig
.
cc
#
Enable
Google
Earth
only
on
Mac
OS
and
Windows
with
Visual
Studio
compiler
macx
|
macx
-
g
++
|
macx
-
g
++
42
|
win32
-
msvc2008
|
win32
-
msvc2010
|
win32
-
msvc2012
::
SOURCES
+=
src
/
ui
/
map3D
/
QGCGoogleEarthView
.
cc
...
...
src/QGCCore.cc
View file @
4cd86dec
...
...
@@ -72,7 +72,7 @@ QGCCore::QGCCore(int &argc, char* argv[]) : QApplication(argc, argv)
this
->
setApplicationName
(
QGC_APPLICATION_NAME
);
this
->
setApplicationVersion
(
QGC_APPLICATION_VERSION
);
this
->
setOrganizationName
(
QLatin1String
(
"diydrones"
));
this
->
setOrganizationDomain
(
"
org
.diydrones"
);
this
->
setOrganizationDomain
(
"
com
.diydrones"
);
// Set settings format
QSettings
::
setDefaultFormat
(
QSettings
::
IniFormat
);
...
...
src/ui/configuration/AccelCalibrationConfig.ui
View file @
4cd86dec
...
...
@@ -34,8 +34,8 @@
<rect>
<x>
70
</x>
<y>
160
</y>
<width>
8
1
</width>
<height>
3
1
</height>
<width>
11
1
</width>
<height>
4
1
</height>
</rect>
</property>
<property
name=
"text"
>
...
...
@@ -48,8 +48,8 @@ Accelerometer</string>
<rect>
<x>
20
</x>
<y>
50
</y>
<width>
2
11
</width>
<height>
9
1
</height>
<width>
3
11
</width>
<height>
10
1
</height>
</rect>
</property>
<property
name=
"text"
>
...
...
src/ui/configuration/AdvParameterList.cc
0 → 100644
View file @
4cd86dec
#include
"AdvParameterList.h"
AdvParameterList
::
AdvParameterList
(
QWidget
*
parent
)
:
AP2ConfigWidget
(
parent
)
{
ui
.
setupUi
(
this
);
ui
.
tableWidget
->
setColumnCount
(
4
);
ui
.
tableWidget
->
horizontalHeader
()
->
hide
();
ui
.
tableWidget
->
verticalHeader
()
->
hide
();
//ui.tableWidget->setHorizontalHeader(0);
//ui.tableWidget->setVerticalHeader(0);
ui
.
tableWidget
->
setColumnWidth
(
0
,
200
);
ui
.
tableWidget
->
setColumnWidth
(
1
,
100
);
ui
.
tableWidget
->
setColumnWidth
(
2
,
200
);
ui
.
tableWidget
->
setColumnWidth
(
3
,
800
);
}
AdvParameterList
::~
AdvParameterList
()
{
}
void
AdvParameterList
::
setParameterMetaData
(
QString
name
,
QString
humanname
,
QString
description
)
{
paramToNameMap
[
name
]
=
humanname
;
paramToDescriptionMap
[
name
]
=
description
;
}
void
AdvParameterList
::
parameterChanged
(
int
uas
,
int
component
,
QString
parameterName
,
QVariant
value
)
{
if
(
!
paramValueMap
.
contains
(
parameterName
))
{
ui
.
tableWidget
->
setRowCount
(
ui
.
tableWidget
->
rowCount
()
+
1
);
if
(
paramToNameMap
.
contains
(
parameterName
))
{
ui
.
tableWidget
->
setItem
(
ui
.
tableWidget
->
rowCount
()
-
1
,
0
,
new
QTableWidgetItem
(
paramToNameMap
[
parameterName
]));
}
else
{
ui
.
tableWidget
->
setItem
(
ui
.
tableWidget
->
rowCount
()
-
1
,
0
,
new
QTableWidgetItem
(
"Unknown"
));
}
ui
.
tableWidget
->
setItem
(
ui
.
tableWidget
->
rowCount
()
-
1
,
1
,
new
QTableWidgetItem
(
QString
::
number
(
value
.
toFloat
(),
'f'
,
2
)));
ui
.
tableWidget
->
setItem
(
ui
.
tableWidget
->
rowCount
()
-
1
,
2
,
new
QTableWidgetItem
(
parameterName
));
if
(
paramToDescriptionMap
.
contains
(
parameterName
))
{
ui
.
tableWidget
->
setItem
(
ui
.
tableWidget
->
rowCount
()
-
1
,
3
,
new
QTableWidgetItem
(
paramToDescriptionMap
[
parameterName
]));
}
else
{
ui
.
tableWidget
->
setItem
(
ui
.
tableWidget
->
rowCount
()
-
1
,
3
,
new
QTableWidgetItem
(
"Unknown"
));
}
paramValueMap
[
parameterName
]
=
ui
.
tableWidget
->
item
(
ui
.
tableWidget
->
rowCount
()
-
1
,
1
);
}
paramValueMap
[
parameterName
]
->
setText
(
QString
::
number
(
value
.
toFloat
(),
'f'
,
2
));
}
src/ui/configuration/AdvParameterList.h
0 → 100644
View file @
4cd86dec
#ifndef ADVPARAMETERLIST_H
#define ADVPARAMETERLIST_H
#include
<QWidget>
#include
"ui_AdvParameterList.h"
#include
"AP2ConfigWidget.h"
class
AdvParameterList
:
public
AP2ConfigWidget
{
Q_OBJECT
public:
explicit
AdvParameterList
(
QWidget
*
parent
=
0
);
void
setParameterMetaData
(
QString
name
,
QString
humanname
,
QString
description
);
~
AdvParameterList
();
private
slots
:
void
parameterChanged
(
int
uas
,
int
component
,
QString
parameterName
,
QVariant
value
);
private:
QMap
<
QString
,
QTableWidgetItem
*>
paramValueMap
;
QMap
<
QString
,
QString
>
paramToNameMap
;
QMap
<
QString
,
QString
>
paramToDescriptionMap
;
Ui
::
AdvParameterList
ui
;
};
#endif // ADVPARAMETERLIST_H
src/ui/configuration/AdvParameterList.ui
0 → 100644
View file @
4cd86dec
<?xml version="1.0" encoding="UTF-8"?>
<ui
version=
"4.0"
>
<class>
AdvParameterList
</class>
<widget
class=
"QWidget"
name=
"AdvParameterList"
>
<property
name=
"geometry"
>
<rect>
<x>
0
</x>
<y>
0
</y>
<width>
666
</width>
<height>
497
</height>
</rect>
</property>
<property
name=
"windowTitle"
>
<string>
Form
</string>
</property>
<layout
class=
"QVBoxLayout"
name=
"verticalLayout"
>
<item>
<widget
class=
"QLabel"
name=
"label"
>
<property
name=
"text"
>
<string>
<
h2
>
Advanced Parameter List
<
/h2
>
</string>
</property>
</widget>
</item>
<item>
<widget
class=
"QTableWidget"
name=
"tableWidget"
/>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>
src/ui/configuration/AdvancedParamConfig.cc
View file @
4cd86dec
#include
"AdvancedParamConfig.h"
AdvancedParamConfig
::
AdvancedParamConfig
(
QWidget
*
parent
)
:
Q
Widget
(
parent
)
AdvancedParamConfig
::
AdvancedParamConfig
(
QWidget
*
parent
)
:
AP2Config
Widget
(
parent
)
{
ui
.
setupUi
(
this
);
}
...
...
@@ -9,3 +9,27 @@ AdvancedParamConfig::AdvancedParamConfig(QWidget *parent) : QWidget(parent)
AdvancedParamConfig
::~
AdvancedParamConfig
()
{
}
void
AdvancedParamConfig
::
addRange
(
QString
title
,
QString
description
,
QString
param
,
double
min
,
double
max
)
{
ParamWidget
*
widget
=
new
ParamWidget
(
ui
.
scrollAreaWidgetContents
);
paramToWidgetMap
[
param
]
=
widget
;
widget
->
setupDouble
(
title
+
"("
+
param
+
")"
,
description
,
0
,
min
,
max
);
ui
.
verticalLayout
->
addWidget
(
widget
);
widget
->
show
();
}
void
AdvancedParamConfig
::
addCombo
(
QString
title
,
QString
description
,
QString
param
,
QList
<
QPair
<
int
,
QString
>
>
valuelist
)
{
ParamWidget
*
widget
=
new
ParamWidget
(
ui
.
scrollAreaWidgetContents
);
paramToWidgetMap
[
param
]
=
widget
;
widget
->
setupCombo
(
title
+
"("
+
param
+
")"
,
description
,
valuelist
);
ui
.
verticalLayout
->
addWidget
(
widget
);
widget
->
show
();
}
void
AdvancedParamConfig
::
parameterChanged
(
int
uas
,
int
component
,
QString
parameterName
,
QVariant
value
)
{
if
(
paramToWidgetMap
.
contains
(
parameterName
))
{
paramToWidgetMap
[
parameterName
]
->
setValue
(
value
.
toDouble
());
}
}
src/ui/configuration/AdvancedParamConfig.h
View file @
4cd86dec
...
...
@@ -3,16 +3,21 @@
#include
<QWidget>
#include
"ui_AdvancedParamConfig.h"
class
AdvancedParamConfig
:
public
QWidget
#include
"AP2ConfigWidget.h"
#include
"ParamWidget.h"
class
AdvancedParamConfig
:
public
AP2ConfigWidget
{
Q_OBJECT
public:
explicit
AdvancedParamConfig
(
QWidget
*
parent
=
0
);
~
AdvancedParamConfig
();
void
addRange
(
QString
title
,
QString
description
,
QString
param
,
double
min
,
double
max
);
void
addCombo
(
QString
title
,
QString
description
,
QString
param
,
QList
<
QPair
<
int
,
QString
>
>
valuelist
);
private
slots
:
void
parameterChanged
(
int
uas
,
int
component
,
QString
parameterName
,
QVariant
value
);
private:
QMap
<
QString
,
ParamWidget
*>
paramToWidgetMap
;
Ui
::
AdvancedParamConfig
ui
;
};
...
...
src/ui/configuration/AdvancedParamConfig.ui
View file @
4cd86dec
...
...
@@ -6,26 +6,44 @@
<rect>
<x>
0
</x>
<y>
0
</y>
<width>
400
</width>
<height>
300
</height>
<width>
725
</width>
<height>
632
</height>
</rect>
</property>
<property
name=
"windowTitle"
>
<string>
Form
</string>
</property>
<widget
class=
"QLabel"
name=
"label"
>
<property
name=
"geometry"
>
<rect>
<x>
10
</x>
<y>
10
</y>
<width>
181
</width>
<height>
31
</height>
</rect>
</property>
<property
name=
"text"
>
<string>
<
h2
>
Advanced Params
<
/h2
>
</string>
</property>
</widget>
<layout
class=
"QVBoxLayout"
name=
"verticalLayout_3"
>
<item>
<widget
class=
"QLabel"
name=
"label"
>
<property
name=
"text"
>
<string>
<
h2
>
Advanced Params
<
/h2
>
</string>
</property>
</widget>
</item>
<item>
<widget
class=
"QScrollArea"
name=
"scrollArea"
>
<property
name=
"widgetResizable"
>
<bool>
true
</bool>
</property>
<widget
class=
"QWidget"
name=
"scrollAreaWidgetContents"
>
<property
name=
"geometry"
>
<rect>
<x>
0
</x>
<y>
0
</y>
<width>
705
</width>
<height>
585
</height>
</rect>
</property>
<layout
class=
"QVBoxLayout"
name=
"verticalLayout_2"
>
<item>
<layout
class=
"QVBoxLayout"
name=
"verticalLayout"
/>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
...
...
src/ui/configuration/ApmHardwareConfig.cc
View file @
4cd86dec
...
...
@@ -30,35 +30,28 @@ This file is part of the QGROUNDCONTROL project
*/
#include
"ApmHardwareConfig.h"
ApmHardwareConfig
::
ApmHardwareConfig
(
QWidget
*
parent
)
:
QWidget
(
parent
)
{
ui
.
setupUi
(
this
);
//ui.firmwareButton->setVisible(valse);
ui
.
manditoryHardware
->
setVisible
(
false
);
ui
.
frameTypeButton
->
setVisible
(
false
);
ui
.
compassButton
->
setVisible
(
false
);
ui
.
accelCalibrateButton
->
setVisible
(
false
);
ui
.
arduPlaneLevelButton
->
setVisible
(
false
);
ui
.
radioCalibrateButton
->
setVisible
(
false
);
ui
.
optionalHardwareButton
->
setVisible
(
false
);
//ui.radio3DRButton->setVisible(false);
ui
.
batteryMonitorButton
->
setVisible
(
false
);
ui
.
sonarButton
->
setVisible
(
false
);
ui
.
airspeedButton
->
setVisible
(
false
);
ui
.
opticalFlowButton
->
setVisible
(
false
);
ui
.
osdButton
->
setVisible
(
false
);
ui
.
cameraGimbalButton
->
setVisible
(
false
);
//ui.antennaTrackerButton->setVisible(false);
connect
(
ui
.
manditoryHardware
,
SIGNAL
(
toggled
(
bool
)),
ui
.
frameTypeButton
,
SLOT
(
setShown
(
bool
)));
connect
(
ui
.
manditoryHardware
,
SIGNAL
(
toggled
(
bool
)),
ui
.
compassButton
,
SLOT
(
setShown
(
bool
)));
connect
(
ui
.
manditoryHardware
,
SIGNAL
(
toggled
(
bool
)),
ui
.
accelCalibrateButton
,
SLOT
(
setShown
(
bool
)));
connect
(
ui
.
manditoryHardware
,
SIGNAL
(
toggled
(
bool
)),
ui
.
radioCalibrateButton
,
SLOT
(
setShown
(
bool
)));
connect
(
ui
.
optionalHardwareButton
,
SIGNAL
(
toggled
(
bool
)),
ui
.
radio3DRButton
,
SLOT
(
setShown
(
bool
)));
connect
(
ui
.
optionalHardwareButton
,
SIGNAL
(
toggled
(
bool
)),
ui
.
batteryMonitorButton
,
SLOT
(
setShown
(
bool
)));
connect
(
ui
.
optionalHardwareButton
,
SIGNAL
(
toggled
(
bool
)),
ui
.
sonarButton
,
SLOT
(
setShown
(
bool
)));
connect
(
ui
.
optionalHardwareButton
,
SIGNAL
(
toggled
(
bool
)),
ui
.
airspeedButton
,
SLOT
(
setShown
(
bool
)));
connect
(
ui
.
optionalHardwareButton
,
SIGNAL
(
toggled
(
bool
)),
ui
.
opticalFlowButton
,
SLOT
(
setShown
(
bool
)));
connect
(
ui
.
optionalHardwareButton
,
SIGNAL
(
toggled
(
bool
)),
ui
.
osdButton
,
SLOT
(
setShown
(
bool
)));
connect
(
ui
.
optionalHardwareButton
,
SIGNAL
(
toggled
(
bool
)),
ui
.
cameraGimbalButton
,
SLOT
(
setShown
(
bool
)));
...
...
@@ -87,6 +80,11 @@ ApmHardwareConfig::ApmHardwareConfig(QWidget *parent) : QWidget(parent)
buttonToConfigWidgetMap
[
ui
.
accelCalibrateButton
]
=
accelConfig
;
connect
(
ui
.
accelCalibrateButton
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
activateStackedWidget
()));
planeLevel
=
new
ApmPlaneLevel
(
this
);
ui
.
stackedWidget
->
addWidget
(
planeLevel
);
buttonToConfigWidgetMap
[
ui
.
arduPlaneLevelButton
]
=
planeLevel
;
connect
(
ui
.
arduPlaneLevelButton
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
activateStackedWidget
()));
radioConfig
=
new
RadioCalibrationConfig
(
this
);
ui
.
stackedWidget
->
addWidget
(
radioConfig
);
buttonToConfigWidgetMap
[
ui
.
radioCalibrateButton
]
=
radioConfig
;
...
...
@@ -133,8 +131,6 @@ ApmHardwareConfig::ApmHardwareConfig(QWidget *parent) : QWidget(parent)
buttonToConfigWidgetMap
[
ui
.
antennaTrackerButton
]
=
antennaTrackerConfig
;
connect
(
ui
.
antennaTrackerButton
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
activateStackedWidget
()));
connect
(
UASManager
::
instance
(),
SIGNAL
(
activeUASSet
(
UASInterface
*
)),
this
,
SLOT
(
activeUASSet
(
UASInterface
*
)));
if
(
UASManager
::
instance
()
->
getActiveUAS
())
{
...
...
@@ -159,11 +155,33 @@ void ApmHardwareConfig::activeUASSet(UASInterface *uas)
{
return
;
}
if
(
uas
->
getSystemType
()
==
MAV_TYPE_FIXED_WING
)
{
connect
(
ui
.
manditoryHardware
,
SIGNAL
(
toggled
(
bool
)),
ui
.
compassButton
,
SLOT
(
setShown
(
bool
)));
connect
(
ui
.
manditoryHardware
,
SIGNAL
(
toggled
(
bool
)),
ui
.
arduPlaneLevelButton
,
SLOT
(
setShown
(
bool
)));
connect
(
ui
.
manditoryHardware
,
SIGNAL
(
toggled
(
bool
)),
ui
.
radioCalibrateButton
,
SLOT
(
setShown
(
bool
)));
connect
(
ui
.
optionalHardwareButton
,
SIGNAL
(
toggled
(
bool
)),
ui
.
airspeedButton
,
SLOT
(
setShown
(
bool
)));
}
else
if
(
uas
->
getSystemType
()
==
MAV_TYPE_QUADROTOR
)
{
connect
(
ui
.
manditoryHardware
,
SIGNAL
(
toggled
(
bool
)),
ui
.
frameTypeButton
,
SLOT
(
setShown
(
bool
)));
connect
(
ui
.
manditoryHardware
,
SIGNAL
(
toggled
(
bool
)),
ui
.
compassButton
,
SLOT
(
setShown
(
bool
)));
connect
(
ui
.
manditoryHardware
,
SIGNAL
(
toggled
(
bool
)),
ui
.
accelCalibrateButton
,
SLOT
(
setShown
(
bool
)));
connect
(
ui
.
manditoryHardware
,
SIGNAL
(
toggled
(
bool
)),
ui
.
radioCalibrateButton
,
SLOT
(
setShown
(
bool
)));
}
else
if
(
uas
->
getSystemType
()
==
MAV_TYPE_GROUND_ROVER
)
{
connect
(
ui
.
manditoryHardware
,
SIGNAL
(
toggled
(
bool
)),
ui
.
compassButton
,
SLOT
(
setShown
(
bool
)));
connect
(
ui
.
manditoryHardware
,
SIGNAL
(
toggled
(
bool
)),
ui
.
radioCalibrateButton
,
SLOT
(
setShown
(
bool
)));
}
else
{
connect
(
ui
.
manditoryHardware
,
SIGNAL
(
toggled
(
bool
)),
ui
.
compassButton
,
SLOT
(
setShown
(
bool
)));
connect
(
ui
.
manditoryHardware
,
SIGNAL
(
toggled
(
bool
)),
ui
.
radioCalibrateButton
,
SLOT
(
setShown
(
bool
)));
}
ui
.
firmwareButton
->
setVisible
(
true
);
ui
.
manditoryHardware
->
setVisible
(
true
);
ui
.
manditoryHardware
->
setChecked
(
fals
e
);
ui
.
manditoryHardware
->
setChecked
(
tru
e
);
ui
.
optionalHardwareButton
->
setVisible
(
true
);
ui
.
optionalHardwareButton
->
setChecked
(
false
);
ui
.
radio3DRButton
->
setVisible
(
false
);
ui
.
antennaTrackerButton
->
setVisible
(
false
);
ui
.
optionalHardwareButton
->
setChecked
(
true
);
}
src/ui/configuration/ApmHardwareConfig.h
View file @
4cd86dec
...
...
@@ -48,6 +48,7 @@ This file is part of the QGROUNDCONTROL project
#include
"OsdConfig.h"
#include
"CameraGimbalConfig.h"
#include
"AntennaTrackerConfig.h"
#include
"ApmPlaneLevel.h"
class
ApmHardwareConfig
:
public
QWidget
{
...
...
@@ -70,6 +71,7 @@ private:
OsdConfig
*
osdConfig
;
CameraGimbalConfig
*
cameraGimbalConfig
;
AntennaTrackerConfig
*
antennaTrackerConfig
;
ApmPlaneLevel
*
planeLevel
;
private
slots
:
void
activeUASSet
(
UASInterface
*
uas
);
void
activateStackedWidget
();
...
...
src/ui/configuration/ApmHardwareConfig.ui
View file @
4cd86dec
...
...
@@ -43,7 +43,7 @@
<x>
0
</x>
<y>
0
</y>
<width>
156
</width>
<height>
6
35
</height>
<height>
6
76
</height>
</rect>
</property>
<layout
class=
"QVBoxLayout"
name=
"verticalLayout_12"
>
...
...
@@ -129,6 +129,25 @@
</property>
</widget>
</item>
<item>
<widget
class=
"QPushButton"
name=
"arduPlaneLevelButton"
>
<property
name=
"minimumSize"
>
<size>
<width>
0
</width>
<height>
35
</height>
</size>
</property>
<property
name=
"layoutDirection"
>
<enum>
Qt::LeftToRight
</enum>
</property>
<property
name=
"autoFillBackground"
>
<bool>
false
</bool>
</property>
<property
name=
"text"
>
<string>
ArduPlane Level
</string>
</property>
</widget>
</item>
<item>
<widget
class=
"QPushButton"
name=
"radioCalibrateButton"
>
<property
name=
"minimumSize"
>
...
...
src/ui/configuration/ApmPlaneLevel.cc
0 → 100644
View file @
4cd86dec
#include
"ApmPlaneLevel.h"
#include
<QMessageBox>
ApmPlaneLevel
::
ApmPlaneLevel
(
QWidget
*
parent
)
:
AP2ConfigWidget
(
parent
)
{
ui
.
setupUi
(
this
);
connect
(
ui
.
levelPushButton
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
levelClicked
()));
connect
(
ui
.
manualLevelCheckBox
,
SIGNAL
(
toggled
(
bool
)),
this
,
SLOT
(
manualCheckBoxToggled
(
bool
)));
}
ApmPlaneLevel
::~
ApmPlaneLevel
()
{
}
void
ApmPlaneLevel
::
levelClicked
()
{
QMessageBox
::
information
(
0
,
"Warning"
,
"Be sure the plane is completly level, then click ok"
);
MAV_CMD
command
=
MAV_CMD_PREFLIGHT_CALIBRATION
;
int
confirm
=
0
;
float
param1
=
1
;
float
param2
=
0
;
float
param3
=
1
;
float
param4
=
0
;
float
param5
=
0
;
float
param6
=
0
;
float
param7
=
0
;
int
component
=
1
;
m_uas
->
executeCommand
(
command
,
confirm
,
param1
,
param2
,
param3
,
param4
,
param5
,
param6
,
param7
,
component
);
QMessageBox
::
information
(
0
,
"Warning"
,
"Leveling completed"
);
}
void
ApmPlaneLevel
::
manualCheckBoxToggled
(
bool
checked
)
{
if
(
!
m_uas
)
{
return
;
}
if
(
checked
)
{
m_uas
->
getParamManager
()
->
setParameter
(
1
,
"MANUAL_LEVEL"
,
1
);
}
else
{
m_uas
->
getParamManager
()
->
setParameter
(
1
,
"MANUAL_LEVEL"
,
0
);
}
}
void
ApmPlaneLevel
::
parameterChanged
(
int
uas
,
int
component
,
QString
parameterName
,
QVariant
value
)
{
if
(
parameterName
==
"MANUAL_LEVEL"
)
{
if
(
value
.
toInt
()
==
1
)
{
ui
.
manualLevelCheckBox
->
setChecked
(
true
);
}
else
{
ui
.
manualLevelCheckBox
->
setChecked
(
false
);
}
}
}
src/ui/configuration/ApmPlaneLevel.h
0 → 100644
View file @
4cd86dec
#ifndef APMPLANELEVEL_H
#define APMPLANELEVEL_H
#include
<QWidget>
#include
"ui_ApmPlaneLevel.h"
#include
"AP2ConfigWidget.h"
class
ApmPlaneLevel
:
public
AP2ConfigWidget
{
Q_OBJECT
public:
explicit
ApmPlaneLevel
(
QWidget
*
parent
=
0
);
~
ApmPlaneLevel
();
private
slots
:
void
parameterChanged
(
int
uas
,
int
component
,
QString
parameterName
,
QVariant
value
);
void
levelClicked
();
void
manualCheckBoxToggled
(
bool
checked
);
private:
Ui
::
ApmPlaneLevel
ui
;
};
#endif // APMPLANELEVEL_H
src/ui/configuration/ApmPlaneLevel.ui
0 → 100644
View file @
4cd86dec
<?xml version="1.0" encoding="UTF-8"?>
<ui
version=
"4.0"
>
<class>
ApmPlaneLevel
</class>
<widget
class=
"QWidget"
name=
"ApmPlaneLevel"
>
<property
name=
"geometry"
>
<rect>
<x>
0
</x>
<y>
0
</y>
<width>
400
</width>
<height>
300
</height>
</rect>
</property>
<property
name=
"windowTitle"
>
<string>
Form
</string>
</property>
<widget
class=
"QLabel"
name=
"label"
>
<property
name=
"geometry"
>
<rect>
<x>
10
</x>
<y>
10
</y>
<width>
141
</width>
<height>
31
</height>
</rect>
</property>
<property
name=
"text"
>
<string>
<
h2
>
ArduPlane Level
<
/h2
>
</string>
</property>
</widget>
<widget
class=
"QLabel"
name=
"label_2"
>
<property
name=
"geometry"
>
<rect>
<x>
50
</x>
<y>
70
</y>
<width>
271
</width>
<height>
41
</height>
</rect>
</property>
<property
name=
"text"
>
<string>
By Default your plane will autolevel on every boot.
To disable this action you need to turn on manual
level and perform a level to calibrate the accel offsets.
</string>
</property>
</widget>
<widget
class=
"QLabel"
name=
"label_3"
>
<property
name=
"geometry"
>
<rect>
<x>
50
</x>
<y>
150
</y>
<width>
291
</width>
<height>
16
</height>
</rect>
</property>
<property
name=
"text"
>
<string>
Level your plane and click Level to set default accel offsets
</string>
</property>
</widget>
<widget
class=
"QPushButton"
name=
"levelPushButton"
>
<property
name=
"geometry"
>
<rect>
<x>
160
</x>
<y>
180
</y>
<width>
75
</width>
<height>
23
</height>
</rect>
</property>
<property
name=
"text"
>
<string>
Level
</string>
</property>
</widget>
<widget
class=
"QGroupBox"
name=
"groupBox"
>
<property
name=
"geometry"
>
<rect>
<x>
120
</x>
<y>
230
</y>
<width>
151
</width>
<height>
51
</height>
</rect>
</property>
<property
name=
"title"
>
<string>
For advanced users ONLY
</string>
</property>
<widget
class=
"QCheckBox"
name=
"manualLevelCheckBox"
>
<property
name=
"geometry"
>
<rect>
<x>
30
</x>
<y>
20
</y>
<width>
91
</width>
<height>
17
</height>
</rect>
</property>
<property
name=
"text"
>
<string>
Manual Level
</string>
</property>
</widget>
</widget>
</widget>
<resources/>
<connections/>
</ui>
src/ui/configuration/ApmSoftwareConfig.cc
View file @
4cd86dec
This diff is collapsed.
Click to expand it.
src/ui/configuration/ApmSoftwareConfig.h
View file @
4cd86dec
...
...
@@ -10,7 +10,9 @@
#include
"FailSafeConfig.h"
#include
"AdvancedParamConfig.h"
#include
"ArduCopterPidConfig.h"
#include
"ArduPlanePidConfig.h"
#include
"ArduRoverPidConfig.h"
#include
"AdvParameterList.h"
#include
"UASInterface.h"
#include
"UASManager.h"
...
...
@@ -32,7 +34,10 @@ private:
GeoFenceConfig
*
geoFenceConfig
;
FailSafeConfig
*
failSafeConfig
;
AdvancedParamConfig
*
advancedParamConfig
;
ArduCopterPidConfig
*
arduCoperPidConfig
;
ArduCopterPidConfig
*
arduCopterPidConfig
;
ArduPlanePidConfig
*
arduPlanePidConfig
;
ArduRoverPidConfig
*
arduRoverPidConfig
;
AdvParameterList
*
advParameterList
;
QMap
<
QObject
*
,
QWidget
*>
buttonToConfigWidgetMap
;
};
...
...
src/ui/configuration/ApmSoftwareConfig.ui
View file @
4cd86dec
...
...
@@ -6,221 +6,204 @@
<rect>
<x>
0
</x>
<y>
0
</y>
<width>
718
</width>
<height>
531
</height>
<width>
853
</width>
<height>
619
</height>
</rect>
</property>
<property
name=
"windowTitle"
>
<string>
Form
</string>
</property>
<widget
class=
"QScrollArea"
name=
"scrollArea_6"
>
<property
name=
"geometry"
>
<rect>
<x>
20
</x>
<y>
10
</y>
<width>
175
</width>
<height>
531
</height>
</rect>
</property>
<property
name=
"minimumSize"
>
<size>
<width>
175
</width>
<height>
0
</height>
</size>
</property>
<property
name=
"maximumSize"
>
<size>
<width>
175
</width>
<height>
16777215
</height>
</size>
</property>
<property
name=
"widgetResizable"
>
<bool>
true
</bool>
</property>
<widget
class=
"QWidget"
name=
"scrollAreaWidgetContents_3"
>
<property
name=
"geometry"
>
<rect>
<x>
0
</x>
<y>
0
</y>
<width>
173
</width>
<height>
529
</height>
</rect>
</property>
<layout
class=
"QVBoxLayout"
name=
"verticalLayout_12"
>
<item>
<layout
class=
"QVBoxLayout"
name=
"navBarLayout"
>
<property
name=
"sizeConstraint"
>
<enum>
QLayout::SetMinAndMaxSize
</enum>
</property>
<layout
class=
"QHBoxLayout"
name=
"horizontalLayout"
>
<item>
<widget
class=
"QScrollArea"
name=
"scrollArea_6"
>
<property
name=
"minimumSize"
>
<size>
<width>
175
</width>
<height>
0
</height>
</size>
</property>
<property
name=
"maximumSize"
>
<size>
<width>
175
</width>
<height>
16777215
</height>
</size>
</property>
<property
name=
"widgetResizable"
>
<bool>
true
</bool>
</property>
<widget
class=
"QWidget"
name=
"scrollAreaWidgetContents_3"
>
<property
name=
"geometry"
>
<rect>
<x>
0
</x>
<y>
0
</y>
<width>
173
</width>
<height>
599
</height>
</rect>
</property>
<layout
class=
"QVBoxLayout"
name=
"verticalLayout_12"
>
<item>
<widget
class=
"QPushButton"
name=
"plannerConfigButton"
>
<property
name=
"minimumSize"
>
<size>
<width>
100
</width>
<height>
35
</height>
</size>
</property>
<property
name=
"text"
>
<string>
APM Planner 2.0 Config
</string>
</property>
</widget>
</item>
<item>
<widget
class=
"QPushButton"
name=
"basicPidsButton"
>
<property
name=
"minimumSize"
>
<size>
<width>
0
</width>
<height>
35
</height>
</size>
</property>
<property
name=
"text"
>
<string>
Basic Pids
</string>
</property>
<property
name=
"checkable"
>
<bool>
false
</bool>
</property>
</widget>
</item>
<item>
<widget
class=
"QPushButton"
name=
"flightModesButton"
>
<property
name=
"minimumSize"
>
<size>
<width>
0
</width>
<height>
35
</height>
</size>
</property>
<property
name=
"text"
>
<string>
Flight Modes
</string>
</property>
<property
name=
"checkable"
>
<bool>
false
</bool>
</property>
</widget>
</item>
<item>
<widget
class=
"QPushButton"
name=
"standardParamButton"
>
<property
name=
"minimumSize"
>
<size>
<width>
0
</width>
<height>
35
</height>
</size>
</property>
<property
name=
"text"
>
<string>
Standard Params
</string>
</property>
<property
name=
"checkable"
>
<bool>
false
</bool>
</property>
</widget>
</item>
<item>
<widget
class=
"QPushButton"
name=
"geoFenceButton"
>
<property
name=
"minimumSize"
>
<size>
<width>
0
</width>
<height>
35
</height>
</size>
</property>
<property
name=
"text"
>
<string>
GeoFence
</string>
</property>
<property
name=
"checkable"
>
<bool>
false
</bool>
</property>
</widget>
</item>
<item>
<widget
class=
"QPushButton"
name=
"failSafeButton"
>
<property
name=
"minimumSize"
>
<size>
<width>
0
</width>
<height>
35
</height>
</size>
</property>
<property
name=
"text"
>
<string>
FailSafe
</string>
</property>
<property
name=
"checkable"
>
<bool>
false
</bool>
</property>
</widget>
</item>
<item>
<widget
class=
"QPushButton"
name=
"advancedParamButton"
>
<property
name=
"minimumSize"
>
<size>
<width>
0
</width>
<height>
35
</height>
</size>
</property>
<property
name=
"text"
>
<string>
Advanced Params
</string>
</property>
<property
name=
"checkable"
>
<bool>
false
</bool>
</property>
</widget>
</item>
<item>
<widget
class=
"QPushButton"
name=
"advParamListButton"
>
<property
name=
"minimumSize"
>
<size>
<width>
0
</width>
<height>
35
</height>
</size>
</property>
<property
name=
"text"
>
<string>
Adv Parameter List
</string>
</property>
<property
name=
"checkable"
>
<bool>
false
</bool>
</property>
</widget>
</item>
<item>
<widget
class=
"QPushButton"
name=
"arduCoperPidButton"
>
<property
name=
"minimumSize"
>
<size>
<width>
0
</width>
<height>
35
</height>
</size>
</property>
<property
name=
"text"
>
<string>
ArduCoper Pids
</string>
</property>
<property
name=
"checkable"
>
<bool>
false
</bool>
</property>
</widget>
</item>
<item>
<spacer
name=
"verticalSpacer"
>
<property
name=
"orientation"
>
<enum>
Qt::Vertical
</enum>
</property>
<property
name=
"sizeHint"
stdset=
"0"
>
<size>
<width>
20
</width>
<height>
40
</height>
</size>
</property>
</spacer>
<layout
class=
"QVBoxLayout"
name=
"navBarLayout"
>
<property
name=
"sizeConstraint"
>
<enum>
QLayout::SetMinAndMaxSize
</enum>
</property>
<item>
<widget
class=
"QPushButton"
name=
"plannerConfigButton"
>
<property
name=
"minimumSize"
>
<size>
<width>
100
</width>
<height>
35
</height>
</size>
</property>
<property
name=
"text"
>
<string>
APM Planner 2.0 Config
</string>
</property>
</widget>
</item>
<item>
<widget
class=
"QPushButton"
name=
"flightModesButton"
>
<property
name=
"minimumSize"
>
<size>
<width>
0
</width>
<height>
35
</height>
</size>
</property>
<property
name=
"text"
>
<string>
Flight Modes
</string>
</property>
<property
name=
"checkable"
>
<bool>
false
</bool>
</property>
</widget>
</item>
<item>
<widget
class=
"QPushButton"
name=
"standardParamButton"
>
<property
name=
"minimumSize"
>
<size>
<width>
0
</width>
<height>
35
</height>
</size>
</property>
<property
name=
"text"
>
<string>
Standard Params
</string>
</property>
<property
name=
"checkable"
>
<bool>
false
</bool>
</property>
</widget>
</item>
<item>
<widget
class=
"QPushButton"
name=
"failSafeButton"
>
<property
name=
"minimumSize"
>
<size>
<width>
0
</width>
<height>
35
</height>
</size>
</property>
<property
name=
"text"
>
<string>
FailSafe
</string>
</property>
<property
name=
"checkable"
>
<bool>
false
</bool>
</property>
</widget>
</item>
<item>
<widget
class=
"QPushButton"
name=
"advancedParamButton"
>
<property
name=
"minimumSize"
>
<size>
<width>
0
</width>
<height>
35
</height>
</size>
</property>
<property
name=
"text"
>
<string>
Advanced Params
</string>
</property>
<property
name=
"checkable"
>
<bool>
false
</bool>
</property>
</widget>
</item>
<item>
<widget
class=
"QPushButton"
name=
"advParamListButton"
>
<property
name=
"minimumSize"
>
<size>
<width>
0
</width>
<height>
35
</height>
</size>
</property>
<property
name=
"text"
>
<string>
Adv Parameter List
</string>
</property>
<property
name=
"checkable"
>
<bool>
false
</bool>
</property>
</widget>
</item>
<item>
<widget
class=
"QPushButton"
name=
"arduCopterPidButton"
>
<property
name=
"minimumSize"
>
<size>
<width>
0
</width>
<height>
35
</height>
</size>
</property>
<property
name=
"text"
>
<string>
ArduCopter Pids
</string>
</property>
<property
name=
"checkable"
>
<bool>
false
</bool>
</property>
</widget>
</item>
<item>
<widget
class=
"QPushButton"
name=
"arduPlanePidButton"
>
<property
name=
"minimumSize"
>
<size>
<width>
0
</width>
<height>
35
</height>
</size>
</property>
<property
name=
"text"
>
<string>
ArduPlane Pids
</string>
</property>
</widget>
</item>
<item>
<widget
class=
"QPushButton"
name=
"arduRoverPidButton"
>
<property
name=
"minimumSize"
>
<size>
<width>
0
</width>
<height>
35
</height>
</size>
</property>
<property
name=
"text"
>
<string>
ArduRover Pids
</string>
</property>
</widget>
</item>
<item>
<spacer
name=
"verticalSpacer"
>
<property
name=
"orientation"
>
<enum>
Qt::Vertical
</enum>
</property>
<property
name=
"sizeHint"
stdset=
"0"
>
<size>
<width>
20
</width>
<height>
40
</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</item>
</layout>
</widget>
</widget>
<widget
class=
"QStackedWidget"
name=
"stackedWidget"
>
<property
name=
"geometry"
>
<rect>
<x>
220
</x>
<y>
20
</y>
<width>
471
</width>
<height>
491
</height>
</rect>
</property>
</widget>
</widget>
</widget>
</item>
<item>
<widget
class=
"QStackedWidget"
name=
"stackedWidget"
/>
</item>
</layout>
</widget>
<resources/>
<connections/>
...
...
src/ui/configuration/ArduCopterPidConfig.cc
View file @
4cd86dec
#include
"ArduCopterPidConfig.h"
#include
"ui_ArduCopterPidConfig.h"
ArduCopterPidConfig
::
ArduCopterPidConfig
(
QWidget
*
parent
)
:
QWidget
(
parent
),
ui
(
new
Ui
::
ArduCopterPidConfig
)
ArduCopterPidConfig
::
ArduCopterPidConfig
(
QWidget
*
parent
)
:
AP2ConfigWidget
(
parent
)
{
ui
->
setupUi
(
this
);
ui
.
setupUi
(
this
);
nameToBoxMap
[
"STB_RLL_P"
]
=
ui
.
stabilPitchPSpinBox
;
nameToBoxMap
[
"STB_PIT_P"
]
=
ui
.
stabilRollPSpinBox
;
nameToBoxMap
[
"STB_YAW_P"
]
=
ui
.
stabilYawPSpinBox
;
nameToBoxMap
[
"HLD_LAT_P"
]
=
ui
.
loiterPidPSpinBox
;
nameToBoxMap
[
"RATE_RLL_P"
]
=
ui
.
rateRollPSpinBox
;
nameToBoxMap
[
"RATE_RLL_I"
]
=
ui
.
rateRollISpinBox
;
nameToBoxMap
[
"RATE_RLL_D"
]
=
ui
.
rateRollDSpinBox
;
nameToBoxMap
[
"RATE_RLL_IMAX"
]
=
ui
.
rateRollIMAXSpinBox
;
nameToBoxMap
[
"RATE_PIT_P"
]
=
ui
.
ratePitchPSpinBox
;
nameToBoxMap
[
"RATE_PIT_I"
]
=
ui
.
ratePitchISpinBox
;
nameToBoxMap
[
"RATE_PIT_D"
]
=
ui
.
ratePitchDSpinBox
;
nameToBoxMap
[
"RATE_PIT_IMAX"
]
=
ui
.
ratePitchIMAXSpinBox
;
nameToBoxMap
[
"RATE_YAW_P"
]
=
ui
.
rateYawPSpinBox
;
nameToBoxMap
[
"RATE_YAW_I"
]
=
ui
.
rateYawISpinBox
;
nameToBoxMap
[
"RATE_YAW_D"
]
=
ui
.
rateYawDSpinBox
;
nameToBoxMap
[
"RATE_YAW_IMAX"
]
=
ui
.
rateYawIMAXSpinBox
;
nameToBoxMap
[
"LOITER_LAT_P"
]
=
ui
.
rateLoiterPSpinBox
;
nameToBoxMap
[
"LOITER_LAT_I"
]
=
ui
.
rateLoiterISpinBox
;
nameToBoxMap
[
"LOITER_LAT_D"
]
=
ui
.
rateLoiterDSpinBox
;
nameToBoxMap
[
"LOITER_LAT_IMAX"
]
=
ui
.
rateLoiterIMAXSpinBox
;
nameToBoxMap
[
"THR_ACCEL_P"
]
=
ui
.
throttleAccelPSpinBox
;
nameToBoxMap
[
"THR_ACCEL_I"
]
=
ui
.
throttleAccelISpinBox
;
nameToBoxMap
[
"THR_ACCEL_D"
]
=
ui
.
throttleAccelDSpinBox
;
nameToBoxMap
[
"THR_ACCEL_IMAX"
]
=
ui
.
throttleAccelIMAXSpinBox
;
nameToBoxMap
[
"THR_RATE_P"
]
=
ui
.
throttleRatePSpinBox
;
nameToBoxMap
[
"THR_RATE_D"
]
=
ui
.
throttleDateDSpinBox
;
nameToBoxMap
[
"THR_ALT_P"
]
=
ui
.
altitudeHoldPSpinBox
;
nameToBoxMap
[
"WPNAV_SPEED"
]
=
ui
.
wpNavLoiterSpeedSpinBox
;
nameToBoxMap
[
"WPNAV_RADIUS"
]
=
ui
.
wpNavRadiusSpinBox
;
nameToBoxMap
[
"WPNAV_SPEED_DN"
]
=
ui
.
wpNavSpeedDownSpinBox
;
nameToBoxMap
[
"WPNAV_LOIT_SPEED"
]
=
ui
.
wpNavSpeedSpinBox
;
nameToBoxMap
[
"WPNAV_SPEED_UP"
]
=
ui
.
wpNavSpeedUpSpinBox
;
nameToBoxMap
[
"TUNE_HIGH"
]
=
ui
.
ch6MaxSpinBox
;
nameToBoxMap
[
"TUNE_LOW"
]
=
ui
.
ch6MinSpinBox
;
connect
(
ui
.
writePushButton
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
writeButtonClicked
()));
connect
(
ui
.
refreshPushButton
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
refreshButtonClicked
()));
ch6ValueToTextList
.
append
(
QPair
<
int
,
QString
>
(
0
,
"CH6_NONE"
));
ch6ValueToTextList
.
append
(
QPair
<
int
,
QString
>
(
1
,
"CH6_STABILIZE_KP"
));
ch6ValueToTextList
.
append
(
QPair
<
int
,
QString
>
(
2
,
"CH6_STABILIZE_KI"
));
ch6ValueToTextList
.
append
(
QPair
<
int
,
QString
>
(
3
,
"CH6_YAW_KP"
));
ch6ValueToTextList
.
append
(
QPair
<
int
,
QString
>
(
24
,
"CH6_YAW_KI"
));
ch6ValueToTextList
.
append
(
QPair
<
int
,
QString
>
(
4
,
"CH6_RATE_KP"
));
ch6ValueToTextList
.
append
(
QPair
<
int
,
QString
>
(
5
,
"CH6_RATE_KI"
));
ch6ValueToTextList
.
append
(
QPair
<
int
,
QString
>
(
6
,
"CH6_YAW_RATE_KP"
));
ch6ValueToTextList
.
append
(
QPair
<
int
,
QString
>
(
26
,
"CH6_YAW_RATE_KD"
));
ch6ValueToTextList
.
append
(
QPair
<
int
,
QString
>
(
7
,
"CH6_THROTTLE_KP"
));
ch6ValueToTextList
.
append
(
QPair
<
int
,
QString
>
(
9
,
"CH6_RELAY"
));
ch6ValueToTextList
.
append
(
QPair
<
int
,
QString
>
(
10
,
"CH6_WP_SPEED"
));
ch6ValueToTextList
.
append
(
QPair
<
int
,
QString
>
(
12
,
"CH6_LOITER_KP"
));
ch6ValueToTextList
.
append
(
QPair
<
int
,
QString
>
(
13
,
"CH6_HELI_EXTERNAL_GYRO"
));
ch6ValueToTextList
.
append
(
QPair
<
int
,
QString
>
(
14
,
"CH6_THR_HOLD_KP"
));
ch6ValueToTextList
.
append
(
QPair
<
int
,
QString
>
(
17
,
"CH6_OPTFLOW_KP"
));
ch6ValueToTextList
.
append
(
QPair
<
int
,
QString
>
(
18
,
"CH6_OPTFLOW_KI"
));
ch6ValueToTextList
.
append
(
QPair
<
int
,
QString
>
(
19
,
"CH6_OPTFLOW_KD"
));
ch6ValueToTextList
.
append
(
QPair
<
int
,
QString
>
(
21
,
"CH6_RATE_KD"
));
ch6ValueToTextList
.
append
(
QPair
<
int
,
QString
>
(
22
,
"CH6_LOITER_RATE_KP"
));
ch6ValueToTextList
.
append
(
QPair
<
int
,
QString
>
(
23
,
"CH6_LOITER_RATE_KD"
));
ch6ValueToTextList
.
append
(
QPair
<
int
,
QString
>
(
25
,
"CH6_ACRO_KP"
));
ch6ValueToTextList
.
append
(
QPair
<
int
,
QString
>
(
27
,
"CH6_LOITER_KI"
));
ch6ValueToTextList
.
append
(
QPair
<
int
,
QString
>
(
28
,
"CH6_LOITER_RATE_KI"
));
ch6ValueToTextList
.
append
(
QPair
<
int
,
QString
>
(
29
,
"CH6_STABILIZE_KD"
));
ch6ValueToTextList
.
append
(
QPair
<
int
,
QString
>
(
30
,
"CH6_AHRS_YAW_KP"
));
ch6ValueToTextList
.
append
(
QPair
<
int
,
QString
>
(
31
,
"CH6_AHRS_KP"
));
ch6ValueToTextList
.
append
(
QPair
<
int
,
QString
>
(
32
,
"CH6_INAV_TC"
));
ch6ValueToTextList
.
append
(
QPair
<
int
,
QString
>
(
33
,
"CH6_THROTTLE_KI"
));
ch6ValueToTextList
.
append
(
QPair
<
int
,
QString
>
(
34
,
"CH6_THR_ACCEL_KP"
));
ch6ValueToTextList
.
append
(
QPair
<
int
,
QString
>
(
35
,
"CH6_THR_ACCEL_KI"
));
ch6ValueToTextList
.
append
(
QPair
<
int
,
QString
>
(
36
,
"CH6_THR_ACCEL_KD"
));
ch6ValueToTextList
.
append
(
QPair
<
int
,
QString
>
(
38
,
"CH6_DECLINATION"
));
ch6ValueToTextList
.
append
(
QPair
<
int
,
QString
>
(
39
,
"CH6_CIRCLE_RATE"
));
for
(
int
i
=
0
;
i
<
ch6ValueToTextList
.
size
();
i
++
)
{
ui
.
ch6OptComboBox
->
addItem
(
ch6ValueToTextList
[
i
].
second
);
}
ch7ValueToTextList
.
append
(
QPair
<
int
,
QString
>
(
0
,
"Do nothing"
));
ch7ValueToTextList
.
append
(
QPair
<
int
,
QString
>
(
2
,
"Flip"
));
ch7ValueToTextList
.
append
(
QPair
<
int
,
QString
>
(
3
,
"Simple mode"
));
ch7ValueToTextList
.
append
(
QPair
<
int
,
QString
>
(
4
,
"RTL"
));
ch7ValueToTextList
.
append
(
QPair
<
int
,
QString
>
(
5
,
"Save Trim"
));
ch7ValueToTextList
.
append
(
QPair
<
int
,
QString
>
(
7
,
"Save WP"
));
ch7ValueToTextList
.
append
(
QPair
<
int
,
QString
>
(
8
,
"Multi Mode"
));
ch7ValueToTextList
.
append
(
QPair
<
int
,
QString
>
(
9
,
"Camera Trigger"
));
ch7ValueToTextList
.
append
(
QPair
<
int
,
QString
>
(
10
,
"Sonar"
));
ch7ValueToTextList
.
append
(
QPair
<
int
,
QString
>
(
11
,
"Fence"
));
ch7ValueToTextList
.
append
(
QPair
<
int
,
QString
>
(
12
,
"ResetToArmedYaw"
));
for
(
int
i
=
0
;
i
<
ch7ValueToTextList
.
size
();
i
++
)
{
ui
.
ch7OptComboBox
->
addItem
(
ch7ValueToTextList
[
i
].
second
);
}
ch8ValueToTextList
.
append
(
QPair
<
int
,
QString
>
(
0
,
"Do nothing"
));
ch8ValueToTextList
.
append
(
QPair
<
int
,
QString
>
(
2
,
"Flip"
));
ch8ValueToTextList
.
append
(
QPair
<
int
,
QString
>
(
3
,
"Simple mode"
));
ch8ValueToTextList
.
append
(
QPair
<
int
,
QString
>
(
4
,
"RTL"
));
ch8ValueToTextList
.
append
(
QPair
<
int
,
QString
>
(
5
,
"Save Trim"
));
ch8ValueToTextList
.
append
(
QPair
<
int
,
QString
>
(
7
,
"Save WP"
));
ch8ValueToTextList
.
append
(
QPair
<
int
,
QString
>
(
8
,
"Multi Mode"
));
ch8ValueToTextList
.
append
(
QPair
<
int
,
QString
>
(
9
,
"Camera Trigger"
));
ch8ValueToTextList
.
append
(
QPair
<
int
,
QString
>
(
10
,
"Sonar"
));
ch8ValueToTextList
.
append
(
QPair
<
int
,
QString
>
(
11
,
"Fence"
));
ch8ValueToTextList
.
append
(
QPair
<
int
,
QString
>
(
12
,
"ResetToArmedYaw"
));
for
(
int
i
=
0
;
i
<
ch8ValueToTextList
.
size
();
i
++
)
{
ui
.
ch8OptComboBox
->
addItem
(
ch8ValueToTextList
[
i
].
second
);
}
}
ArduCopterPidConfig
::~
ArduCopterPidConfig
()
{
delete
ui
;
}
void
ArduCopterPidConfig
::
parameterChanged
(
int
uas
,
int
component
,
QString
parameterName
,
QVariant
value
)
{
if
(
nameToBoxMap
.
contains
(
parameterName
))
{
nameToBoxMap
[
parameterName
]
->
setValue
(
value
.
toDouble
());
}
else
if
(
parameterName
==
"TUNE"
)
{
for
(
int
i
=
0
;
i
<
ch6ValueToTextList
.
size
();
i
++
)
{
if
(
ch6ValueToTextList
[
i
].
first
==
value
.
toInt
())
{
ui
.
ch6OptComboBox
->
setCurrentIndex
(
i
);
}
}
}
else
if
(
parameterName
==
"CH7_OPT"
)
{
for
(
int
i
=
0
;
i
<
ch7ValueToTextList
.
size
();
i
++
)
{
if
(
ch7ValueToTextList
[
i
].
first
==
value
.
toInt
())
{
ui
.
ch7OptComboBox
->
setCurrentIndex
(
i
);
}
}
}
else
if
(
parameterName
==
"CH8_OPT"
)
{
for
(
int
i
=
0
;
i
<
ch8ValueToTextList
.
size
();
i
++
)
{
if
(
ch8ValueToTextList
[
i
].
first
==
value
.
toInt
())
{
ui
.
ch8OptComboBox
->
setCurrentIndex
(
i
);
}
}
}
}
void
ArduCopterPidConfig
::
writeButtonClicked
()
{
if
(
!
m_uas
)
{
return
;
}
for
(
QMap
<
QString
,
QDoubleSpinBox
*>::
const_iterator
i
=
nameToBoxMap
.
constBegin
();
i
!=
nameToBoxMap
.
constEnd
();
i
++
)
{
m_uas
->
getParamManager
()
->
setParameter
(
1
,
i
.
key
(),
i
.
value
()
->
value
());
}
m_uas
->
getParamManager
()
->
setParameter
(
1
,
"TUNE"
,
ch8ValueToTextList
[
ui
.
ch6OptComboBox
->
currentIndex
()].
first
);
m_uas
->
getParamManager
()
->
setParameter
(
1
,
"CH7_OPT"
,
ch7ValueToTextList
[
ui
.
ch7OptComboBox
->
currentIndex
()].
first
);
m_uas
->
getParamManager
()
->
setParameter
(
1
,
"CH8_OPT"
,
ch8ValueToTextList
[
ui
.
ch8OptComboBox
->
currentIndex
()].
first
);
}
void
ArduCopterPidConfig
::
refreshButtonClicked
()
{
if
(
!
m_uas
)
{
return
;
}
for
(
QMap
<
QString
,
QDoubleSpinBox
*>::
const_iterator
i
=
nameToBoxMap
.
constBegin
();
i
!=
nameToBoxMap
.
constEnd
();
i
++
)
{
m_uas
->
getParamManager
()
->
requestParameterUpdate
(
1
,
i
.
key
());
}
m_uas
->
getParamManager
()
->
requestParameterUpdate
(
1
,
"TUNE"
);
m_uas
->
getParamManager
()
->
requestParameterUpdate
(
1
,
"CH7_OPT"
);
m_uas
->
getParamManager
()
->
requestParameterUpdate
(
1
,
"CH8_OPT"
);
}
src/ui/configuration/ArduCopterPidConfig.h
View file @
4cd86dec
...
...
@@ -2,21 +2,27 @@
#define ARDUCOPTERPIDCONFIG_H
#include
<QWidget>
#include
"ui_ArduCopterPidConfig.h"
namespace
Ui
{
class
ArduCopterPidConfig
;
}
#include
"AP2ConfigWidget.h"
class
ArduCopterPidConfig
:
public
Q
Widget
class
ArduCopterPidConfig
:
public
AP2Config
Widget
{
Q_OBJECT
public:
explicit
ArduCopterPidConfig
(
QWidget
*
parent
=
0
);
~
ArduCopterPidConfig
();
private
slots
:
void
writeButtonClicked
();
void
refreshButtonClicked
();
void
parameterChanged
(
int
uas
,
int
component
,
QString
parameterName
,
QVariant
value
);
private:
Ui
::
ArduCopterPidConfig
*
ui
;
QList
<
QPair
<
int
,
QString
>
>
ch6ValueToTextList
;
QList
<
QPair
<
int
,
QString
>
>
ch7ValueToTextList
;
QList
<
QPair
<
int
,
QString
>
>
ch8ValueToTextList
;
QMap
<
QString
,
QDoubleSpinBox
*>
nameToBoxMap
;
Ui
::
ArduCopterPidConfig
ui
;
};
#endif // ARDUCOPTERPIDCONFIG_H
Prev
1
2
3
Next
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment