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
b20f9be0
Commit
b20f9be0
authored
Feb 24, 2018
by
Gus Grubba
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Wiring brief "Flight Features"
parent
d21752cb
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
89 additions
and
17 deletions
+89
-17
AirMapFlightPlanManager.cc
src/Airmap/AirMapFlightPlanManager.cc
+17
-5
AirMapFlightPlanManager.h
src/Airmap/AirMapFlightPlanManager.h
+2
-0
AirspaceControl.qml
src/Airmap/AirspaceControl.qml
+19
-2
FlightFeature.qml
src/Airmap/FlightFeature.qml
+49
-10
AirspaceFlightPlanProvider.h
src/AirspaceManagement/AirspaceFlightPlanProvider.h
+2
-0
No files found.
src/Airmap/AirMapFlightPlanManager.cc
View file @
b20f9be0
...
...
@@ -159,6 +159,7 @@ AirMapFlightPlanManager::_createFlightPlan()
if
(
result
)
{
_pilotID
=
QString
::
fromStdString
(
result
.
value
().
id
);
qCDebug
(
AirMapManagerLog
)
<<
"Got Pilot ID:"
<<
_pilotID
;
_state
=
State
::
Idle
;
_uploadFlightPlan
();
}
else
{
_flightPermitStatus
=
AirspaceFlightPlanProvider
::
PermitNone
;
...
...
@@ -257,9 +258,10 @@ AirMapFlightPlanManager::_uploadFlightPlan()
if
(
result
)
{
_flightPlan
=
QString
::
fromStdString
(
result
.
value
().
id
);
qCDebug
(
AirMapManagerLog
)
<<
"Flight plan created:"
<<
_flightPlan
;
_state
=
State
::
FlightPolling
;
_state
=
State
::
Idle
;
_pollBriefing
();
}
else
{
_state
=
State
::
Idle
;
QString
description
=
QString
::
fromStdString
(
result
.
error
().
description
()
?
result
.
error
().
description
().
get
()
:
""
);
emit
error
(
"Flight Plan creation failed"
,
QString
::
fromStdString
(
result
.
error
().
message
()),
description
);
}
...
...
@@ -332,10 +334,11 @@ AirMapFlightPlanManager::_updateFlightPlan()
if
(
!
isAlive
.
lock
())
return
;
if
(
_state
!=
State
::
FlightUpdate
)
return
;
if
(
result
)
{
_state
=
State
::
Idle
;
qCDebug
(
AirMapManagerLog
)
<<
"Flight plan updated:"
<<
_flightPlan
;
_state
=
State
::
FlightPolling
;
_pollBriefing
();
}
else
{
_state
=
State
::
Idle
;
QString
description
=
QString
::
fromStdString
(
result
.
error
().
description
()
?
result
.
error
().
description
().
get
()
:
""
);
emit
error
(
"Flight Plan creation failed"
,
QString
::
fromStdString
(
result
.
error
().
message
()),
description
);
}
...
...
@@ -367,10 +370,12 @@ rules_sort(QObject* a, QObject* b)
void
AirMapFlightPlanManager
::
_pollBriefing
()
{
if
(
_state
!=
State
::
FlightPolling
)
{
qCWarning
(
AirMapManagerLog
)
<<
"AirMapFlightPlanManager::_pollBriefing: not in polling state"
;
if
(
_state
!=
State
::
Idle
)
{
qCWarning
(
AirMapManagerLog
)
<<
"AirMapFlightPlanManager::_pollBriefing: not idle"
<<
(
int
)
_state
;
_pollTimer
.
start
(
500
);
return
;
}
_state
=
State
::
FlightPolling
;
FlightPlans
::
RenderBriefing
::
Parameters
params
;
params
.
authorization
=
_shared
.
loginToken
().
toStdString
();
params
.
id
=
_flightPlan
.
toStdString
();
...
...
@@ -405,6 +410,7 @@ AirMapFlightPlanManager::_pollBriefing()
_rulesInfo
.
clearAndDeleteContents
();
_rulesReview
.
clearAndDeleteContents
();
_rulesFollowing
.
clearAndDeleteContents
();
_briefFeatures
.
clear
();
for
(
const
auto
&
ruleset
:
briefing
.
evaluation
.
rulesets
)
{
AirMapRuleSet
*
pRuleSet
=
new
AirMapRuleSet
(
this
);
pRuleSet
->
_id
=
QString
::
fromStdString
(
ruleset
.
id
);
...
...
@@ -415,6 +421,10 @@ AirMapFlightPlanManager::_pollBriefing()
for
(
const
auto
&
feature
:
rule
.
features
)
{
AirMapRuleFeature
*
pFeature
=
new
AirMapRuleFeature
(
feature
,
this
);
pRule
->
_features
.
append
(
pFeature
);
if
(
rule
.
status
==
RuleSet
::
Rule
::
Status
::
missing_info
)
{
_briefFeatures
.
append
(
pFeature
);
qCDebug
(
AirMapManagerLog
)
<<
"Adding briefing feature"
<<
pFeature
->
name
()
<<
pFeature
->
description
()
<<
pFeature
->
type
();
}
}
pRuleSet
->
_rules
.
append
(
pRule
);
//-- Rules separated by status for presentation
...
...
@@ -478,14 +488,15 @@ AirMapFlightPlanManager::_pollBriefing()
_state
=
State
::
Idle
;
}
else
if
(
pending
)
{
//-- Wait until we send the next polling request
_state
=
State
::
Idle
;
_pollTimer
.
setSingleShot
(
true
);
_pollTimer
.
start
(
2000
);
}
}
else
{
_state
=
State
::
Idle
;
QString
description
=
QString
::
fromStdString
(
result
.
error
().
description
()
?
result
.
error
().
description
().
get
()
:
""
);
emit
error
(
"Brief Request failed"
,
QString
::
fromStdString
(
result
.
error
().
message
()),
description
);
_state
=
State
::
Idle
;
}
});
}
...
...
@@ -513,6 +524,7 @@ AirMapFlightPlanManager::_deleteFlightPlan()
qCDebug
(
AirMapManagerLog
)
<<
"Flight plan deleted"
;
_state
=
State
::
Idle
;
}
else
{
_state
=
State
::
Idle
;
QString
description
=
QString
::
fromStdString
(
result
.
error
().
description
()
?
result
.
error
().
description
().
get
()
:
""
);
emit
error
(
"Flight Plan deletion failed"
,
QString
::
fromStdString
(
result
.
error
().
message
()),
description
);
}
...
...
src/Airmap/AirMapFlightPlanManager.h
View file @
b20f9be0
...
...
@@ -43,6 +43,7 @@ public:
QmlObjectListModel
*
rulesInfo
()
override
{
return
&
_rulesInfo
;
}
QmlObjectListModel
*
rulesReview
()
override
{
return
&
_rulesReview
;
}
QmlObjectListModel
*
rulesFollowing
()
override
{
return
&
_rulesFollowing
;
}
QmlObjectListModel
*
briefFeatures
()
override
{
return
&
_briefFeatures
;
}
void
startFlightPlanning
(
PlanMasterController
*
planController
)
override
;
void
setFlightStartTime
(
QDateTime
start
)
override
;
...
...
@@ -100,6 +101,7 @@ private:
QmlObjectListModel
_rulesInfo
;
QmlObjectListModel
_rulesReview
;
QmlObjectListModel
_rulesFollowing
;
QmlObjectListModel
_briefFeatures
;
AirspaceAdvisoryProvider
::
AdvisoryColor
_airspaceColor
;
AirspaceFlightPlanProvider
::
PermitStatus
_flightPermitStatus
=
AirspaceFlightPlanProvider
::
PermitNone
;
...
...
src/Airmap/AirspaceControl.qml
View file @
b20f9be0
...
...
@@ -55,6 +55,18 @@ Item {
return
_colorGray
;
}
function
hasBriefRules
()
{
if
(
QGroundControl
.
airspaceManager
.
flightPlan
.
rulesViolation
.
count
>
0
)
return
true
;
if
(
QGroundControl
.
airspaceManager
.
flightPlan
.
rulesInfo
.
count
>
0
)
return
true
;
if
(
QGroundControl
.
airspaceManager
.
flightPlan
.
rulesReview
.
count
>
0
)
return
true
;
if
(
QGroundControl
.
airspaceManager
.
flightPlan
.
rulesFollowing
.
count
>
0
)
return
true
;
return
false
;
}
on_AirspaceColorChanged
:
{
if
(
_validAdvisories
)
{
if
(
QGroundControl
.
airspaceManager
.
advisories
.
airspaceColor
===
AirspaceAdvisoryProvider
.
Yellow
)
{
...
...
@@ -692,10 +704,14 @@ Item {
Item
{
width
:
1
;
height
:
ScreenTools
.
defaultFontPixelHeight
*
0.25
;
}
QGCLabel
{
text
:
qsTr
(
"
Flight Context
"
)
visible
:
QGroundControl
.
airspaceManager
.
flightPlan
.
briefFeatures
.
count
>
0
}
Repeater
{
model
:
[
1
,
2
,
3
,
4
,
5
,
6
]
delegate
:
FlightFeature
{
model
:
QGroundControl
.
airspaceManager
.
flightPlan
.
briefFeatures
visible
:
QGroundControl
.
airspaceManager
.
flightPlan
.
briefFeatures
.
count
>
0
delegate
:
FlightFeature
{
feature
:
object
visible
:
object
&&
object
.
type
!==
AirspaceRuleFeature
.
Unknown
&&
object
.
description
!==
""
&&
object
.
name
!==
""
anchors.right
:
parent
.
right
anchors.left
:
parent
.
left
}
...
...
@@ -798,6 +814,7 @@ Item {
Item
{
width
:
1
;
height
:
ScreenTools
.
defaultFontPixelHeight
*
0.25
;
}
QGCLabel
{
text
:
qsTr
(
"
Rules & Compliance
"
)
visible
:
hasBriefRules
()
}
ExclusiveGroup
{
id
:
ruleGroup
}
ComplianceRules
{
...
...
src/Airmap/FlightFeature.qml
View file @
b20f9be0
...
...
@@ -5,32 +5,71 @@ import QtQuick.Dialogs 1.2
import
QtQml
2.2
import
QGroundControl
1.0
import
QGroundControl
.
ScreenTools
1.0
import
QGroundControl
.
Airmap
1.0
import
QGroundControl
.
Airspace
1.0
import
QGroundControl
.
Controls
1.0
import
QGroundControl
.
Palette
1.0
import
QGroundControl
.
Airmap
1.0
import
QGroundControl
.
ScreenTools
1.0
import
QGroundControl
.
SettingsManager
1.0
Rectangle
{
id
:
_root
height
:
questionCol
.
height
+
(
ScreenTools
.
defaultFontPixelHeight
*
1.25
)
color
:
qgcPal
.
windowShade
property
var
feature
:
null
QGCPalette
{
id
:
qgcPal
colorGroupEnabled
:
enabled
}
Column
{
id
:
questionCol
spacing
:
ScreenTools
.
defaultFontPixelHeight
*
0.5
anchors.centerIn
:
parent
id
:
questionCol
spacing
:
ScreenTools
.
defaultFontPixelHeight
*
0.5
anchors.margins
:
ScreenTools
.
defaultFontPixelWidth
anchors.right
:
parent
.
right
anchors.left
:
parent
.
left
anchors.verticalCenter
:
parent
.
verticalCenter
QGCLabel
{
text
:
"
Question?
"
anchors.left
:
questionText
.
left
text
:
feature
.
description
anchors.right
:
parent
.
right
anchors.left
:
parent
.
left
wrapMode
:
Text
.
WordWrap
visible
:
feature
.
type
!==
AirspaceRuleFeature
.
Boolean
}
QGCTextField
{
id
:
questionText
width
:
_root
.
width
-
(
ScreenTools
.
defaultFontPixelWidth
*
2
)
anchors.horizontalCenter
:
parent
.
horizontalCenter
text
:
feature
.
value
?
feature
.
value
:
""
visible
:
feature
.
type
!==
AirspaceRuleFeature
.
Boolean
anchors.right
:
parent
.
right
anchors.left
:
parent
.
left
inputMethodHints
:
feature
.
type
===
AirspaceRuleFeature
.
Float
?
Qt
.
ImhFormattedNumbersOnly
:
Qt
.
ImhNone
onAccepted
:
{
feature
.
value
=
parseFloat
(
text
)
}
onEditingFinished
:
{
feature
.
value
=
parseFloat
(
text
)
}
}
Item
{
height
:
Math
.
max
(
checkBox
.
height
,
label
.
height
)
anchors.right
:
parent
.
right
anchors.left
:
parent
.
left
visible
:
feature
.
type
===
AirspaceRuleFeature
.
Boolean
QGCCheckBox
{
id
:
checkBox
text
:
""
checked
:
feature
.
value
?
feature
.
value
:
false
onClicked
:
feature
.
value
=
checked
anchors.left
:
parent
.
left
anchors.verticalCenter
:
parent
.
verticalCenter
}
QGCLabel
{
id
:
label
text
:
feature
.
description
anchors.right
:
parent
.
right
anchors.left
:
checkBox
.
right
anchors.leftMargin
:
ScreenTools
.
defaultFontPixelWidth
*
0.5
wrapMode
:
Text
.
WordWrap
anchors.verticalCenter
:
parent
.
verticalCenter
}
}
}
}
src/AirspaceManagement/AirspaceFlightPlanProvider.h
View file @
b20f9be0
...
...
@@ -53,6 +53,7 @@ public:
Q_PROPERTY
(
QmlObjectListModel
*
rulesInfo
READ
rulesInfo
NOTIFY
rulesChanged
)
Q_PROPERTY
(
QmlObjectListModel
*
rulesReview
READ
rulesReview
NOTIFY
rulesChanged
)
Q_PROPERTY
(
QmlObjectListModel
*
rulesFollowing
READ
rulesFollowing
NOTIFY
rulesChanged
)
Q_PROPERTY
(
QmlObjectListModel
*
briefFeatures
READ
briefFeatures
NOTIFY
rulesChanged
)
virtual
PermitStatus
flightPermitStatus
()
const
{
return
PermitNone
;
}
virtual
QDateTime
flightStartTime
()
const
=
0
;
...
...
@@ -67,6 +68,7 @@ public:
virtual
QmlObjectListModel
*
rulesInfo
()
=
0
;
///< List of AirspaceRule need more information
virtual
QmlObjectListModel
*
rulesReview
()
=
0
;
///< List of AirspaceRule should review
virtual
QmlObjectListModel
*
rulesFollowing
()
=
0
;
///< List of AirspaceRule following
virtual
QmlObjectListModel
*
briefFeatures
()
=
0
;
///< List of AirspaceRule in violation
virtual
void
setFlightStartTime
(
QDateTime
start
)
=
0
;
virtual
void
setFlightEndTime
(
QDateTime
end
)
=
0
;
...
...
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