Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Q
qgroundcontrol
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Valentin Platzgummer
qgroundcontrol
Commits
a1eda05f
Commit
a1eda05f
authored
Jul 10, 2013
by
Michael Carpenter
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
More implementation of FailSafe configuration
parent
0c45b7f0
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
174 additions
and
0 deletions
+174
-0
FailSafeConfig.cc
src/ui/configuration/FailSafeConfig.cc
+166
-0
FailSafeConfig.h
src/ui/configuration/FailSafeConfig.h
+8
-0
No files found.
src/ui/configuration/FailSafeConfig.cc
View file @
a1eda05f
...
...
@@ -73,6 +73,128 @@ FailSafeConfig::FailSafeConfig(QWidget *parent) : AP2ConfigWidget(parent)
ui
.
throttleFailSafeComboBox
->
addItem
(
"Disable"
);
ui
.
throttleFailSafeComboBox
->
addItem
(
"Enabled - Always TRL"
);
ui
.
throttleFailSafeComboBox
->
addItem
(
"Enabled - Continue in auto"
);
connect
(
ui
.
batteryFailCheckBox
,
SIGNAL
(
clicked
(
bool
)),
this
,
SLOT
(
batteryFailChecked
(
bool
)));
connect
(
ui
.
fsLongCheckBox
,
SIGNAL
(
clicked
(
bool
)),
this
,
SLOT
(
fsLongClicked
(
bool
)));
connect
(
ui
.
fsShortCheckBox
,
SIGNAL
(
clicked
(
bool
)),
this
,
SLOT
(
fsShortClicked
(
bool
)));
connect
(
ui
.
gcsCheckBox
,
SIGNAL
(
clicked
(
bool
)),
this
,
SLOT
(
gcsChecked
(
bool
)));
connect
(
ui
.
throttleActionCheckBox
,
SIGNAL
(
clicked
(
bool
)),
this
,
SLOT
(
throttleActionChecked
(
bool
)));
connect
(
ui
.
throttleCheckBox
,
SIGNAL
(
clicked
(
bool
)),
this
,
SLOT
(
throttleChecked
(
bool
)));
connect
(
ui
.
throttlePwmSpinBox
,
SIGNAL
(
editingFinished
()),
this
,
SLOT
(
throttlePwmChanged
()));
connect
(
ui
.
throttleFailSafeComboBox
,
SIGNAL
(
currentIndexChanged
(
int
)),
this
,
SLOT
(
throttleFailSafeChanged
(
int
)));
}
void
FailSafeConfig
::
gcsChecked
(
bool
checked
)
{
if
(
!
m_uas
)
{
return
;
}
if
(
checked
)
{
m_uas
->
setParameter
(
1
,
"FS_GCS_ENABL"
,
1
);
}
else
{
m_uas
->
setParameter
(
1
,
"FS_GCS_ENABL"
,
0
);
}
}
void
FailSafeConfig
::
throttleActionChecked
(
bool
checked
)
{
if
(
!
m_uas
)
{
return
;
}
if
(
checked
)
{
m_uas
->
setParameter
(
1
,
"THR_FS_ACTION"
,
1
);
}
else
{
m_uas
->
setParameter
(
1
,
"THR_FS_ACTION"
,
0
);
}
}
void
FailSafeConfig
::
throttleChecked
(
bool
checked
)
{
if
(
!
m_uas
)
{
return
;
}
if
(
checked
)
{
m_uas
->
setParameter
(
1
,
"THR_FAILSAFE"
,
1
);
}
else
{
m_uas
->
setParameter
(
1
,
"THR_FAILSAFE"
,
0
);
}
}
void
FailSafeConfig
::
throttlePwmChanged
()
{
if
(
!
m_uas
)
{
return
;
}
m_uas
->
setParameter
(
1
,
"THR_FS_VALUE"
,
ui
.
throttlePwmSpinBox
->
value
());
}
void
FailSafeConfig
::
throttleFailSafeChanged
(
int
index
)
{
if
(
!
m_uas
)
{
return
;
}
m_uas
->
setParameter
(
1
,
"FS_THR_ENABLE"
,
index
);
}
void
FailSafeConfig
::
fsLongClicked
(
bool
checked
)
{
if
(
!
m_uas
)
{
return
;
}
if
(
checked
)
{
m_uas
->
setParameter
(
1
,
"FS_LONG_ACTN"
,
1
);
}
else
{
m_uas
->
setParameter
(
1
,
"FS_LONG_ACTN"
,
0
);
}
}
void
FailSafeConfig
::
fsShortClicked
(
bool
checked
)
{
if
(
!
m_uas
)
{
return
;
}
if
(
checked
)
{
m_uas
->
setParameter
(
1
,
"FS_SHORT_ACTN"
,
1
);
}
else
{
m_uas
->
setParameter
(
1
,
"FS_SHORT_ACTN"
,
0
);
}
}
void
FailSafeConfig
::
batteryFailChecked
(
bool
checked
)
{
if
(
!
m_uas
)
{
return
;
}
if
(
checked
)
{
m_uas
->
setParameter
(
1
,
"FS_BATT_ENABLE"
,
1
);
}
else
{
m_uas
->
setParameter
(
1
,
"FS_BATT_ENABLE"
,
0
);
}
}
FailSafeConfig
::~
FailSafeConfig
()
...
...
@@ -84,6 +206,50 @@ void FailSafeConfig::activeUASSet(UASInterface *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
)));
if
(
uas
->
getSystemType
()
==
MAV_TYPE_FIXED_WING
)
{
ui
.
batteryFailCheckBox
->
setVisible
(
false
);
ui
.
throttleFailSafeComboBox
->
setVisible
(
false
);
ui
.
batteryVoltSpinBox
->
setVisible
(
false
);
ui
.
label_6
->
setVisible
(
false
);
ui
.
throttlePwmSpinBox
->
setVisible
(
true
);
//Both
ui
.
throttleCheckBox
->
setVisible
(
true
);
ui
.
throttleActionCheckBox
->
setVisible
(
true
);
ui
.
gcsCheckBox
->
setVisible
(
true
);
ui
.
fsLongCheckBox
->
setVisible
(
true
);
ui
.
fsShortCheckBox
->
setVisible
(
true
);
}
else
if
(
uas
->
getSystemType
()
==
MAV_TYPE_QUADROTOR
)
{
ui
.
batteryFailCheckBox
->
setVisible
(
true
);
ui
.
throttleFailSafeComboBox
->
setVisible
(
true
);
ui
.
batteryVoltSpinBox
->
setVisible
(
true
);
ui
.
label_6
->
setVisible
(
true
);
ui
.
throttlePwmSpinBox
->
setVisible
(
true
);
//Both
ui
.
throttleCheckBox
->
setVisible
(
false
);
ui
.
throttleActionCheckBox
->
setVisible
(
false
);
ui
.
gcsCheckBox
->
setVisible
(
false
);
ui
.
fsLongCheckBox
->
setVisible
(
false
);
ui
.
fsShortCheckBox
->
setVisible
(
false
);
}
else
{
//Show all, just in case
ui
.
batteryFailCheckBox
->
setVisible
(
true
);
ui
.
throttleFailSafeComboBox
->
setVisible
(
true
);
ui
.
batteryVoltSpinBox
->
setVisible
(
true
);
ui
.
throttlePwmSpinBox
->
setVisible
(
true
);
//Both
ui
.
throttleCheckBox
->
setVisible
(
true
);
ui
.
throttleActionCheckBox
->
setVisible
(
true
);
ui
.
gcsCheckBox
->
setVisible
(
true
);
ui
.
fsLongCheckBox
->
setVisible
(
true
);
ui
.
fsShortCheckBox
->
setVisible
(
true
);
}
}
void
FailSafeConfig
::
parameterChanged
(
int
uas
,
int
component
,
QString
parameterName
,
QVariant
value
)
{
...
...
src/ui/configuration/FailSafeConfig.h
View file @
a1eda05f
...
...
@@ -17,6 +17,14 @@ private slots:
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
);
void
batteryFailChecked
(
bool
checked
);
void
fsLongClicked
(
bool
checked
);
void
fsShortClicked
(
bool
checked
);
void
gcsChecked
(
bool
checked
);
void
throttleActionChecked
(
bool
checked
);
void
throttleChecked
(
bool
checked
);
void
throttlePwmChanged
();
void
throttleFailSafeChanged
(
int
index
);
private:
Ui
::
FailSafeConfig
ui
;
};
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a 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