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
0c45b7f0
Commit
0c45b7f0
authored
Jul 09, 2013
by
Michael Carpenter
Browse files
Initial implementation of FailSafe configuration
parent
3e383c01
Changes
3
Show whitespace changes
Inline
Side-by-side
src/ui/configuration/FailSafeConfig.cc
View file @
0c45b7f0
#include
"FailSafeConfig.h"
FailSafeConfig
::
FailSafeConfig
(
QWidget
*
parent
)
:
Q
Widget
(
parent
)
FailSafeConfig
::
FailSafeConfig
(
QWidget
*
parent
)
:
AP2Config
Widget
(
parent
)
{
ui
.
setupUi
(
this
);
ui
.
radio1In
->
setName
(
"Radio 1"
);
ui
.
radio1In
->
setMin
(
800
);
ui
.
radio1In
->
setMax
(
2200
);
ui
.
radio1In
->
setOrientation
(
Qt
::
Horizontal
);
ui
.
radio2In
->
setName
(
"Radio 2"
);
ui
.
radio2In
->
setMin
(
800
);
ui
.
radio2In
->
setMax
(
2200
);
ui
.
radio2In
->
setOrientation
(
Qt
::
Horizontal
);
ui
.
radio3In
->
setName
(
"Radio 3"
);
ui
.
radio3In
->
setMin
(
800
);
ui
.
radio3In
->
setMax
(
2200
);
ui
.
radio3In
->
setOrientation
(
Qt
::
Horizontal
);
ui
.
radio4In
->
setName
(
"Radio 4"
);
ui
.
radio4In
->
setMin
(
800
);
ui
.
radio4In
->
setMax
(
2200
);
ui
.
radio4In
->
setOrientation
(
Qt
::
Horizontal
);
ui
.
radio5In
->
setName
(
"Radio 5"
);
ui
.
radio5In
->
setMin
(
800
);
ui
.
radio5In
->
setMax
(
2200
);
ui
.
radio5In
->
setOrientation
(
Qt
::
Horizontal
);
ui
.
radio6In
->
setName
(
"Radio 6"
);
ui
.
radio6In
->
setMin
(
800
);
ui
.
radio6In
->
setMax
(
2200
);
ui
.
radio6In
->
setOrientation
(
Qt
::
Horizontal
);
ui
.
radio7In
->
setName
(
"Radio 7"
);
ui
.
radio7In
->
setMin
(
800
);
ui
.
radio7In
->
setMax
(
2200
);
ui
.
radio7In
->
setOrientation
(
Qt
::
Horizontal
);
ui
.
radio8In
->
setName
(
"Radio 8"
);
ui
.
radio8In
->
setMin
(
800
);
ui
.
radio8In
->
setMax
(
2200
);
ui
.
radio8In
->
setOrientation
(
Qt
::
Horizontal
);
ui
.
radio1Out
->
setName
(
"Radio 1"
);
ui
.
radio1Out
->
setMin
(
800
);
ui
.
radio1Out
->
setMax
(
2200
);
ui
.
radio1Out
->
setOrientation
(
Qt
::
Horizontal
);
ui
.
radio2Out
->
setName
(
"Radio 2"
);
ui
.
radio2Out
->
setMin
(
800
);
ui
.
radio2Out
->
setMax
(
2200
);
ui
.
radio2Out
->
setOrientation
(
Qt
::
Horizontal
);
ui
.
radio3Out
->
setName
(
"Radio 3"
);
ui
.
radio3Out
->
setMin
(
800
);
ui
.
radio3Out
->
setMax
(
2200
);
ui
.
radio3Out
->
setOrientation
(
Qt
::
Horizontal
);
ui
.
radio4Out
->
setName
(
"Radio 4"
);
ui
.
radio4Out
->
setMin
(
800
);
ui
.
radio4Out
->
setMax
(
2200
);
ui
.
radio4Out
->
setOrientation
(
Qt
::
Horizontal
);
ui
.
radio5Out
->
setName
(
"Radio 5"
);
ui
.
radio5Out
->
setMin
(
800
);
ui
.
radio5Out
->
setMax
(
2200
);
ui
.
radio5Out
->
setOrientation
(
Qt
::
Horizontal
);
ui
.
radio6Out
->
setName
(
"Radio 6"
);
ui
.
radio6Out
->
setMin
(
800
);
ui
.
radio6Out
->
setMax
(
2200
);
ui
.
radio6Out
->
setOrientation
(
Qt
::
Horizontal
);
ui
.
radio7Out
->
setName
(
"Radio 7"
);
ui
.
radio7Out
->
setMin
(
800
);
ui
.
radio7Out
->
setMax
(
2200
);
ui
.
radio7Out
->
setOrientation
(
Qt
::
Horizontal
);
ui
.
radio8Out
->
setName
(
"Radio 8"
);
ui
.
radio8Out
->
setMin
(
800
);
ui
.
radio8Out
->
setMax
(
2200
);
ui
.
radio8Out
->
setOrientation
(
Qt
::
Horizontal
);
ui
.
throttleFailSafeComboBox
->
addItem
(
"Disable"
);
ui
.
throttleFailSafeComboBox
->
addItem
(
"Enabled - Always TRL"
);
ui
.
throttleFailSafeComboBox
->
addItem
(
"Enabled - Continue in auto"
);
}
FailSafeConfig
::~
FailSafeConfig
()
{
}
void
FailSafeConfig
::
activeUASSet
(
UASInterface
*
uas
)
{
AP2ConfigWidget
::
activeUASSet
(
uas
);
connect
(
uas
,
SIGNAL
(
remoteControlChannelRawChanged
(
int
,
float
)),
this
,
SLOT
(
remoteControlChannelRawChanges
(
int
,
float
)));
connect
(
uas
,
SIGNAL
(
hilActuatorsChanged
(
uint64_t
,
float
,
float
,
float
,
float
,
float
,
float
,
float
,
float
)),
this
,
SLOT
(
hilActuatorsChanged
(
uint64_t
,
float
,
float
,
float
,
float
,
float
,
float
,
float
,
float
)));
connect
(
uas
,
SIGNAL
(
armingChanged
(
bool
)),
this
,
SLOT
(
armingChanged
(
bool
)));
}
void
FailSafeConfig
::
parameterChanged
(
int
uas
,
int
component
,
QString
parameterName
,
QVariant
value
)
{
//Arducopter
if
(
parameterName
==
"FS_THR_ENABLE"
)
{
ui
.
throttleFailSafeComboBox
->
setCurrentIndex
(
value
.
toInt
());
}
else
if
(
parameterName
==
"FS_THR_VALUE"
)
{
ui
.
throttlePwmSpinBox
->
setValue
(
value
.
toFloat
());
}
else
if
(
parameterName
==
"FS_BATT_ENABLE"
)
{
if
(
value
.
toInt
()
==
0
)
{
ui
.
batteryFailCheckBox
->
setChecked
(
false
);
}
else
{
ui
.
batteryFailCheckBox
->
setChecked
(
true
);
}
}
else
if
(
parameterName
==
"LOW_VOLT"
)
{
ui
.
batteryVoltSpinBox
->
setValue
(
value
.
toFloat
());
}
//Arduplane
else
if
(
parameterName
==
"THR_FAILSAFE"
)
{
if
(
value
.
toInt
()
==
0
)
{
ui
.
throttleCheckBox
->
setChecked
(
false
);
}
else
{
ui
.
throttleCheckBox
->
setChecked
(
true
);
}
}
else
if
(
parameterName
==
"THR_FS_VALUE"
)
{
ui
.
throttlePwmSpinBox
->
setValue
(
value
.
toFloat
());
}
else
if
(
parameterName
==
"THR_FS_ACTION"
)
{
if
(
value
.
toInt
()
==
0
)
{
ui
.
throttleActionCheckBox
->
setChecked
(
false
);
}
else
{
ui
.
throttleActionCheckBox
->
setChecked
(
true
);
}
}
else
if
(
parameterName
==
"FS_GCS_ENABL"
)
{
if
(
value
.
toInt
()
==
0
)
{
ui
.
gcsCheckBox
->
setChecked
(
false
);
}
else
{
ui
.
gcsCheckBox
->
setChecked
(
true
);
}
}
else
if
(
parameterName
==
"FS_SHORT_ACTN"
)
{
if
(
value
.
toInt
()
==
0
)
{
ui
.
fsShortCheckBox
->
setChecked
(
false
);
}
else
{
ui
.
fsShortCheckBox
->
setChecked
(
true
);
}
}
else
if
(
parameterName
==
"FS_LONG_ACTN"
)
{
if
(
value
.
toInt
()
==
0
)
{
ui
.
fsLongCheckBox
->
setChecked
(
false
);
}
else
{
ui
.
fsLongCheckBox
->
setChecked
(
true
);
}
}
}
void
FailSafeConfig
::
armingChanged
(
bool
armed
)
{
if
(
armed
)
{
ui
.
armedLabel
->
setText
(
"<h1>ARMED</h1>"
);
}
else
{
ui
.
armedLabel
->
setText
(
"<h1>DISARMED</h1>"
);
}
}
void
FailSafeConfig
::
remoteControlChannelRawChanges
(
int
chan
,
float
value
)
{
if
(
chan
==
0
)
{
ui
.
radio1In
->
setValue
(
value
);
}
else
if
(
chan
==
1
)
{
ui
.
radio2In
->
setValue
(
value
);
}
else
if
(
chan
==
2
)
{
ui
.
radio3In
->
setValue
(
value
);
}
else
if
(
chan
==
3
)
{
ui
.
radio4In
->
setValue
(
value
);
}
else
if
(
chan
==
4
)
{
ui
.
radio5In
->
setValue
(
value
);
}
else
if
(
chan
==
5
)
{
ui
.
radio6In
->
setValue
(
value
);
}
else
if
(
chan
==
6
)
{
ui
.
radio7In
->
setValue
(
value
);
}
else
if
(
chan
==
7
)
{
ui
.
radio8In
->
setValue
(
value
);
}
}
void
FailSafeConfig
::
hilActuatorsChanged
(
uint64_t
time
,
float
act1
,
float
act2
,
float
act3
,
float
act4
,
float
act5
,
float
act6
,
float
act7
,
float
act8
)
{
ui
.
radio1Out
->
setValue
(
act1
);
ui
.
radio2Out
->
setValue
(
act2
);
ui
.
radio3Out
->
setValue
(
act3
);
ui
.
radio4Out
->
setValue
(
act4
);
ui
.
radio5Out
->
setValue
(
act5
);
ui
.
radio6Out
->
setValue
(
act6
);
ui
.
radio7Out
->
setValue
(
act7
);
ui
.
radio8Out
->
setValue
(
act8
);
}
src/ui/configuration/FailSafeConfig.h
View file @
0c45b7f0
...
...
@@ -3,15 +3,20 @@
#include
<QWidget>
#include
"ui_FailSafeConfig.h"
class
FailSafeConfig
:
public
Q
Widget
#include
"AP2ConfigWidget.h"
class
FailSafeConfig
:
public
AP2Config
Widget
{
Q_OBJECT
public:
explicit
FailSafeConfig
(
QWidget
*
parent
=
0
);
~
FailSafeConfig
();
private
slots
:
void
activeUASSet
(
UASInterface
*
uas
);
void
remoteControlChannelRawChanges
(
int
chan
,
float
value
);
void
hilActuatorsChanged
(
uint64_t
time
,
float
act1
,
float
act2
,
float
act3
,
float
act4
,
float
act5
,
float
act6
,
float
act7
,
float
act8
);
void
armingChanged
(
bool
armed
);
void
parameterChanged
(
int
uas
,
int
component
,
QString
parameterName
,
QVariant
value
);
private:
Ui
::
FailSafeConfig
ui
;
};
...
...
src/ui/configuration/FailSafeConfig.ui
View file @
0c45b7f0
...
...
@@ -6,8 +6,8 @@
<rect>
<x>
0
</x>
<y>
0
</y>
<width>
400
</width>
<height>
300
</height>
<width>
822
</width>
<height>
536
</height>
</rect>
</property>
<property
name=
"windowTitle"
>
...
...
@@ -26,7 +26,427 @@
<string>
<
h2
>
Fail Safe
<
/h2
>
</string>
</property>
</widget>
<widget
class=
"QWidget"
name=
"verticalLayoutWidget"
>
<property
name=
"geometry"
>
<rect>
<x>
20
</x>
<y>
70
</y>
<width>
252
</width>
<height>
441
</height>
</rect>
</property>
<layout
class=
"QVBoxLayout"
name=
"verticalLayout"
>
<item>
<widget
class=
"QGCRadioChannelDisplay"
name=
"radio1In"
native=
"true"
>
<property
name=
"minimumSize"
>
<size>
<width>
250
</width>
<height>
40
</height>
</size>
</property>
<property
name=
"maximumSize"
>
<size>
<width>
250
</width>
<height>
40
</height>
</size>
</property>
</widget>
</item>
<item>
<widget
class=
"QGCRadioChannelDisplay"
name=
"radio2In"
native=
"true"
>
<property
name=
"minimumSize"
>
<size>
<width>
250
</width>
<height>
40
</height>
</size>
</property>
<property
name=
"maximumSize"
>
<size>
<width>
250
</width>
<height>
40
</height>
</size>
</property>
</widget>
</item>
<item>
<widget
class=
"QGCRadioChannelDisplay"
name=
"radio3In"
native=
"true"
>
<property
name=
"minimumSize"
>
<size>
<width>
250
</width>
<height>
40
</height>
</size>
</property>
<property
name=
"maximumSize"
>
<size>
<width>
250
</width>
<height>
40
</height>
</size>
</property>
</widget>
</item>
<item>
<widget
class=
"QGCRadioChannelDisplay"
name=
"radio4In"
native=
"true"
>
<property
name=
"minimumSize"
>
<size>
<width>
250
</width>
<height>
40
</height>
</size>
</property>
<property
name=
"maximumSize"
>
<size>
<width>
250
</width>
<height>
40
</height>
</size>
</property>
</widget>
</item>
<item>
<widget
class=
"QGCRadioChannelDisplay"
name=
"radio5In"
native=
"true"
>
<property
name=
"minimumSize"
>
<size>
<width>
250
</width>
<height>
40
</height>
</size>
</property>
<property
name=
"maximumSize"
>
<size>
<width>
250
</width>
<height>
40
</height>
</size>
</property>
</widget>
</item>
<item>
<widget
class=
"QGCRadioChannelDisplay"
name=
"radio6In"
native=
"true"
>
<property
name=
"minimumSize"
>
<size>
<width>
250
</width>
<height>
40
</height>
</size>
</property>
<property
name=
"maximumSize"
>
<size>
<width>
250
</width>
<height>
40
</height>
</size>
</property>
</widget>
</item>
<item>
<widget
class=
"QGCRadioChannelDisplay"
name=
"radio7In"
native=
"true"
>
<property
name=
"minimumSize"
>
<size>
<width>
250
</width>
<height>
40
</height>
</size>
</property>
<property
name=
"maximumSize"
>
<size>
<width>
250
</width>
<height>
40
</height>
</size>
</property>
</widget>
</item>
<item>
<widget
class=
"QGCRadioChannelDisplay"
name=
"radio8In"
native=
"true"
>
<property
name=
"minimumSize"
>
<size>
<width>
250
</width>
<height>
40
</height>
</size>
</property>
<property
name=
"maximumSize"
>
<size>
<width>
250
</width>
<height>
40
</height>
</size>
</property>
</widget>
</item>
</layout>
</widget>
<widget
class=
"QWidget"
name=
"verticalLayoutWidget_2"
>
<property
name=
"geometry"
>
<rect>
<x>
300
</x>
<y>
70
</y>
<width>
252
</width>
<height>
441
</height>
</rect>
</property>
<layout
class=
"QVBoxLayout"
name=
"verticalLayout_2"
>
<item>
<widget
class=
"QGCRadioChannelDisplay"
name=
"radio1Out"
native=
"true"
>
<property
name=
"minimumSize"
>
<size>
<width>
250
</width>
<height>
40
</height>
</size>
</property>
<property
name=
"maximumSize"
>
<size>
<width>
250
</width>
<height>
40
</height>
</size>
</property>
</widget>
</item>
<item>
<widget
class=
"QGCRadioChannelDisplay"
name=
"radio2Out"
native=
"true"
>
<property
name=
"minimumSize"
>
<size>
<width>
250
</width>
<height>
40
</height>
</size>
</property>
<property
name=
"maximumSize"
>
<size>
<width>
250
</width>
<height>
40
</height>
</size>
</property>
</widget>
</item>
<item>
<widget
class=
"QGCRadioChannelDisplay"
name=
"radio3Out"
native=
"true"
>
<property
name=
"minimumSize"
>
<size>
<width>
250
</width>
<height>
40
</height>
</size>
</property>
<property
name=
"maximumSize"
>
<size>
<width>
250
</width>
<height>
40
</height>
</size>
</property>
</widget>
</item>
<item>
<widget
class=
"QGCRadioChannelDisplay"
name=
"radio4Out"
native=
"true"
>
<property
name=
"minimumSize"
>
<size>
<width>
250
</width>
<height>
40
</height>
</size>
</property>
<property
name=
"maximumSize"
>
<size>
<width>
250
</width>
<height>
40
</height>
</size>
</property>
</widget>
</item>
<item>
<widget
class=
"QGCRadioChannelDisplay"
name=
"radio5Out"
native=
"true"
>
<property
name=
"minimumSize"
>
<size>
<width>
250
</width>
<height>
40
</height>
</size>
</property>
<property
name=
"maximumSize"
>
<size>
<width>
250
</width>
<height>
40
</height>
</size>
</property>
</widget>
</item>
<item>
<widget
class=
"QGCRadioChannelDisplay"
name=
"radio6Out"
native=
"true"
>
<property
name=
"minimumSize"
>
<size>
<width>
250
</width>
<height>
40
</height>
</size>
</property>
<property
name=
"maximumSize"
>
<size>
<width>
250
</width>
<height>
40
</height>
</size>
</property>
</widget>
</item>
<item>
<widget
class=
"QGCRadioChannelDisplay"
name=
"radio7Out"
native=
"true"
>
<property
name=
"minimumSize"
>
<size>
<width>
250
</width>
<height>
40
</height>
</size>
</property>
<property
name=
"maximumSize"
>
<size>
<width>
250
</width>
<height>
40
</height>
</size>
</property>
</widget>
</item>
<item>
<widget
class=
"QGCRadioChannelDisplay"
name=
"radio8Out"
native=
"true"
>
<property
name=
"minimumSize"
>
<size>
<width>
250
</width>
<height>
40
</height>
</size>
</property>
<property
name=
"maximumSize"
>
<size>
<width>
250
</width>
<height>
40
</height>
</size>
</property>
</widget>
</item>
</layout>
</widget>
<widget
class=
"QGroupBox"
name=
"groupBox"
>
<property
name=
"geometry"
>
<rect>
<x>
570
</x>
<y>
60
</y>
<width>
181
</width>
<height>
181
</height>
</rect>
</property>
<property
name=
"title"
>
<string>
Status
</string>
</property>
<layout
class=
"QVBoxLayout"
name=
"verticalLayout_3"
>
<item>
<widget
class=
"QLabel"
name=
"modeLabel"
>
<property
name=
"text"
>
<string>
TextLabel
</string>
</property>
</widget>
</item>
<item>
<widget
class=
"QLabel"
name=
"armedLabel"
>
<property
name=
"text"
>
<string>
TextLabel
</string>
</property>
</widget>
</item>
<item>
<widget
class=
"QLabel"
name=
"gpsLabel"
>
<property
name=
"text"
>
<string>
TextLabel
</string>
</property>
</widget>
</item>
</layout>
</widget>
<widget
class=
"QGroupBox"
name=
"groupBox_2"
>
<property
name=
"geometry"
>
<rect>
<x>
570
</x>
<y>
250
</y>
<width>
161
</width>
<height>
261
</height>
</rect>
</property>
<property
name=
"title"
>
<string>
Failsafe Options
</string>
</property>
<layout
class=
"QVBoxLayout"
name=
"verticalLayout_4"
>
<item>
<widget
class=
"QCheckBox"
name=
"throttleCheckBox"
>
<property
name=
"text"
>
<string>
Throttle FailSafe
</string>
</property>
</widget>
</item>
<item>
<widget
class=
"QComboBox"
name=
"throttleFailSafeComboBox"
/>
</item>
<item>
<layout
class=
"QHBoxLayout"
name=
"horizontalLayout_2"
>
<item>
<widget
class=
"QLabel"
name=
"label_5"
>
<property
name=
"text"
>
<string>
FS Pwm
</string>
</property>
</widget>
</item>
<item>
<widget
class=
"QSpinBox"
name=
"throttlePwmSpinBox"
>
<property
name=
"maximum"
>
<number>
3000
</number>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget
class=
"QCheckBox"
name=
"throttleActionCheckBox"
>
<property
name=
"text"
>
<string>
Throttle FailSafe Action
</string>
</property>
</widget>
</item>
<item>
<widget
class=
"QCheckBox"
name=
"gcsCheckBox"
>
<property
name=
"text"
>
<string>
GCS FailSafe
</string>
</property>
</widget>
</item>
<item>
<widget
class=
"QCheckBox"
name=
"fsShortCheckBox"
>
<property
name=
"text"
>
<string>
FailSafe Short (1 sec)
</string>
</property>
</widget>
</item>
<item>
<widget
class=
"QCheckBox"
name=
"fsLongCheckBox"
>
<property
name=
"text"
>
<string>
FailSafe Long (20 sec)
</string>
</property>
</widget>
</item>
<item>
<widget
class=
"QCheckBox"
name=
"batteryFailCheckBox"
>
<property
name=
"text"
>
<string>
Battery Failsafe
</string>
</property>
</widget>
</item>
<item>
<layout
class=
"QHBoxLayout"
name=
"horizontalLayout"
>
<item>
<widget
class=
"QLabel"
name=
"label_6"
>
<property
name=
"text"
>
<string>
Low Battery
</string>
</property>
</widget>
</item>
<item>
<widget
class=
"QDoubleSpinBox"
name=
"batteryVoltSpinBox"
>
<property
name=
"maximum"
>
<double>
100.000000000000000
</double>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</widget>
<customwidgets>
<customwidget>
<class>
QGCRadioChannelDisplay
</class>
<extends>
QWidget
</extends>
<header>
ui/designer/QGCRadioChannelDisplay.h
</header>
<container>
1
</container>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>
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