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
7aa5d4f6
Commit
7aa5d4f6
authored
Feb 16, 2018
by
Gus Grubba
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Collecting briefing advisories
parent
f4731132
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
83 additions
and
33 deletions
+83
-33
AirMapAdvisoryManager.cc
src/Airmap/AirMapAdvisoryManager.cc
+5
-5
AirMapAdvisoryManager.h
src/Airmap/AirMapAdvisoryManager.h
+3
-2
AirMapFlightPlanManager.cc
src/Airmap/AirMapFlightPlanManager.cc
+37
-3
AirMapFlightPlanManager.h
src/Airmap/AirMapFlightPlanManager.h
+10
-4
AirspaceControl.qml
src/Airmap/AirspaceControl.qml
+2
-2
AirspaceAdvisoryProvider.h
src/AirspaceManagement/AirspaceAdvisoryProvider.h
+2
-2
AirspaceFlightPlanProvider.h
src/AirspaceManagement/AirspaceFlightPlanProvider.h
+24
-15
No files found.
src/Airmap/AirMapAdvisoryManager.cc
View file @
7aa5d4f6
...
...
@@ -69,7 +69,7 @@ AirMapAdvisoryManager::_requestAdvisories()
return
;
}
_valid
=
false
;
_a
irspac
es
.
clearAndDeleteContents
();
_a
dvisori
es
.
clearAndDeleteContents
();
Status
::
GetStatus
::
Parameters
params
;
params
.
longitude
=
_lastRoiCenter
.
longitude
();
params
.
latitude
=
_lastRoiCenter
.
latitude
();
...
...
@@ -89,13 +89,13 @@ AirMapAdvisoryManager::_requestAdvisories()
pAdvisory
->
_name
=
QString
::
fromStdString
(
advisory
.
airspace
.
name
());
pAdvisory
->
_type
=
(
AirspaceAdvisory
::
AdvisoryType
)(
int
)
advisory
.
airspace
.
type
();
pAdvisory
->
_color
=
(
AirspaceAdvisoryProvider
::
AdvisoryColor
)(
int
)
advisory
.
color
;
_a
irspac
es
.
append
(
pAdvisory
);
_a
dvisori
es
.
append
(
pAdvisory
);
qCDebug
(
AirMapManagerLog
)
<<
"Adding advisory"
<<
pAdvisory
->
name
();
}
//-- Sort in order of color (priority)
_a
irspac
es
.
beginReset
();
std
::
sort
(
_a
irspaces
.
objectList
()
->
begin
(),
_airspac
es
.
objectList
()
->
end
(),
adv_sort
);
_a
irspac
es
.
endReset
();
_a
dvisori
es
.
beginReset
();
std
::
sort
(
_a
dvisories
.
objectList
()
->
begin
(),
_advisori
es
.
objectList
()
->
end
(),
adv_sort
);
_a
dvisori
es
.
endReset
();
_valid
=
true
;
}
else
{
qCDebug
(
AirMapManagerLog
)
<<
"Advisories Request Failed"
;
...
...
src/Airmap/AirMapAdvisoryManager.h
View file @
7aa5d4f6
...
...
@@ -30,6 +30,7 @@ class AirMapAdvisory : public AirspaceAdvisory
{
Q_OBJECT
friend
class
AirMapAdvisoryManager
;
friend
class
AirMapFlightPlanManager
;
public:
AirMapAdvisory
(
QObject
*
parent
=
NULL
);
QString
id
()
override
{
return
_id
;
}
...
...
@@ -55,7 +56,7 @@ public:
AirMapAdvisoryManager
(
AirMapSharedState
&
shared
,
QObject
*
parent
=
nullptr
);
bool
valid
()
override
{
return
_valid
;
}
AdvisoryColor
airspaceColor
()
override
{
return
_airspaceColor
;
}
QmlObjectListModel
*
a
irspaces
()
override
{
return
&
_airspac
es
;
}
QmlObjectListModel
*
a
dvisories
()
override
{
return
&
_advisori
es
;
}
void
setROI
(
const
QGeoCoordinate
&
center
,
double
radiusMeters
)
override
;
signals:
void
error
(
const
QString
&
what
,
const
QString
&
airmapdMessage
,
const
QString
&
airmapdDetails
);
...
...
@@ -66,6 +67,6 @@ private:
double
_lastRadius
;
AirMapSharedState
&
_shared
;
QGeoCoordinate
_lastRoiCenter
;
QmlObjectListModel
_a
irspac
es
;
QmlObjectListModel
_a
dvisori
es
;
AdvisoryColor
_airspaceColor
;
};
src/Airmap/AirMapFlightPlanManager.cc
View file @
7aa5d4f6
...
...
@@ -10,6 +10,7 @@
#include "AirMapFlightPlanManager.h"
#include "AirMapManager.h"
#include "AirMapRulesetsManager.h"
#include "AirMapAdvisoryManager.h"
#include "QGCApplication.h"
#include "MissionController.h"
...
...
@@ -76,7 +77,7 @@ AirMapFlightPlanManager::createFlightPlan(MissionController* missionController)
return
;
}
//-- TODO: Check if there is an ongoing flight plan and do something about it
//-- TODO: Check if there is an ongoing flight plan and do something about it
(Delete it?)
_createPlan
=
true
;
if
(
!
_controller
)
{
_controller
=
missionController
;
...
...
@@ -120,6 +121,7 @@ AirMapFlightPlanManager::_createFlightPlan()
qCDebug
(
AirMapManagerLog
)
<<
"Flight Start:"
<<
_flightStartTime
;
qCDebug
(
AirMapManagerLog
)
<<
"Flight End: "
<<
_flightEndTime
;
//-- Not Yet
return
;
if
(
_pilotID
==
""
)
{
...
...
@@ -220,6 +222,9 @@ AirMapFlightPlanManager::_uploadFlightPlan()
void
AirMapFlightPlanManager
::
_updateFlightPlan
()
{
//-- TODO: This is broken as the parameters for updating the plan have
// little to do with those used when creating it.
qCDebug
(
AirMapManagerLog
)
<<
"Updating flight plan"
;
_state
=
State
::
FlightUpdate
;
std
::
weak_ptr
<
LifetimeChecker
>
isAlive
(
_instance
);
...
...
@@ -230,8 +235,6 @@ AirMapFlightPlanManager::_updateFlightPlan()
params
.
authorization
=
login_token
.
toStdString
();
params
.
flight_plan
.
id
=
_flightPlan
.
toStdString
();
params
.
flight_plan
.
pilot
.
id
=
_pilotID
.
toStdString
();
//-- TODO: This is broken as the parameters for updating the plan have
// little to do with those used when creating it.
params
.
flight_plan
.
altitude_agl
.
max
=
_flight
.
maxAltitude
;
params
.
flight_plan
.
buffer
=
2.
f
;
params
.
flight_plan
.
takeoff
.
latitude
=
_flight
.
takeoffCoord
.
latitude
();
...
...
@@ -280,6 +283,16 @@ AirMapFlightPlanManager::_updateFlightPlan()
});
}
//-----------------------------------------------------------------------------
static
bool
adv_sort
(
QObject
*
a
,
QObject
*
b
)
{
AirMapAdvisory
*
aa
=
qobject_cast
<
AirMapAdvisory
*>
(
a
);
AirMapAdvisory
*
bb
=
qobject_cast
<
AirMapAdvisory
*>
(
b
);
if
(
!
aa
||
!
bb
)
return
false
;
return
(
int
)
aa
->
color
()
>
(
int
)
bb
->
color
();
}
//-----------------------------------------------------------------------------
void
AirMapFlightPlanManager
::
_pollBriefing
()
...
...
@@ -298,6 +311,27 @@ AirMapFlightPlanManager::_pollBriefing()
if
(
result
)
{
const
FlightPlan
::
Briefing
&
briefing
=
result
.
value
();
qCDebug
(
AirMapManagerLog
)
<<
"Flight polling/briefing response"
;
//-- Collect advisories
_valid
=
false
;
_advisories
.
clearAndDeleteContents
();
const
std
::
vector
<
Status
::
Advisory
>
advisories
=
briefing
.
airspace
.
advisories
;
_airspaceColor
=
(
AirspaceAdvisoryProvider
::
AdvisoryColor
)(
int
)
briefing
.
airspace
.
color
;
for
(
const
auto
&
advisory
:
advisories
)
{
AirMapAdvisory
*
pAdvisory
=
new
AirMapAdvisory
(
this
);
pAdvisory
->
_id
=
QString
::
fromStdString
(
advisory
.
airspace
.
id
());
pAdvisory
->
_name
=
QString
::
fromStdString
(
advisory
.
airspace
.
name
());
pAdvisory
->
_type
=
(
AirspaceAdvisory
::
AdvisoryType
)(
int
)
advisory
.
airspace
.
type
();
pAdvisory
->
_color
=
(
AirspaceAdvisoryProvider
::
AdvisoryColor
)(
int
)
advisory
.
color
;
_advisories
.
append
(
pAdvisory
);
qCDebug
(
AirMapManagerLog
)
<<
"Adding briefing advisory"
<<
pAdvisory
->
name
();
}
//-- Sort in order of color (priority)
_advisories
.
beginReset
();
std
::
sort
(
_advisories
.
objectList
()
->
begin
(),
_advisories
.
objectList
()
->
end
(),
adv_sort
);
_advisories
.
endReset
();
_valid
=
true
;
emit
advisoryChanged
();
//-- Evaluate briefing status
bool
rejected
=
false
;
bool
accepted
=
false
;
bool
pending
=
false
;
...
...
src/Airmap/AirMapFlightPlanManager.h
View file @
7aa5d4f6
...
...
@@ -26,10 +26,13 @@ class AirMapFlightPlanManager : public AirspaceFlightPlanProvider, public Lifeti
public:
AirMapFlightPlanManager
(
AirMapSharedState
&
shared
,
QObject
*
parent
=
nullptr
);
PermitStatus
flightPermitStatus
()
const
override
{
return
_flightPermitStatus
;
}
QString
flightID
()
{
return
_flightPlan
;
}
QDateTime
flightStartTime
()
const
override
{
return
_flightStartTime
;
}
QDateTime
flightEndTime
()
const
override
{
return
_flightEndTime
;
}
PermitStatus
flightPermitStatus
()
const
override
{
return
_flightPermitStatus
;
}
QString
flightID
()
{
return
_flightPlan
;
}
QDateTime
flightStartTime
()
const
override
{
return
_flightStartTime
;
}
QDateTime
flightEndTime
()
const
override
{
return
_flightEndTime
;
}
bool
valid
()
override
{
return
_valid
;
}
QmlObjectListModel
*
advisories
()
override
{
return
&
_advisories
;
}
AirspaceAdvisoryProvider
::
AdvisoryColor
airspaceColor
()
override
{
return
_airspaceColor
;
}
void
createFlightPlan
(
MissionController
*
missionController
)
override
;
void
setFlightStartTime
(
QDateTime
start
)
override
;
...
...
@@ -76,9 +79,12 @@ private:
QString
_pilotID
;
///< Pilot ID in the form "auth0|abc123"
MissionController
*
_controller
=
nullptr
;
bool
_createPlan
=
true
;
bool
_valid
=
false
;
QDateTime
_flightStartTime
;
QDateTime
_flightEndTime
;
QmlObjectListModel
_advisories
;
AirspaceAdvisoryProvider
::
AdvisoryColor
_airspaceColor
;
AirspaceFlightPlanProvider
::
PermitStatus
_flightPermitStatus
=
AirspaceFlightPlanProvider
::
PermitUnknown
;
};
...
...
src/Airmap/AirspaceControl.qml
View file @
7aa5d4f6
...
...
@@ -166,7 +166,7 @@ Item {
color
:
_textColor
}
QGCLabel
{
text
:
_validAdvisories
?
QGroundControl
.
airspaceManager
.
advisories
.
a
irspac
es
.
count
+
qsTr
(
"
Advisories
"
)
:
""
text
:
_validAdvisories
?
QGroundControl
.
airspaceManager
.
advisories
.
a
dvisori
es
.
count
+
qsTr
(
"
Advisories
"
)
:
""
color
:
_textColor
visible
:
_validAdvisories
font.pointSize
:
ScreenTools
.
smallFontPointSize
...
...
@@ -317,7 +317,7 @@ Item {
anchors.right
:
parent
.
right
anchors.left
:
parent
.
left
Repeater
{
model
:
_validAdvisories
?
QGroundControl
.
airspaceManager
.
advisories
.
a
irspac
es
:
[]
model
:
_validAdvisories
?
QGroundControl
.
airspaceManager
.
advisories
.
a
dvisori
es
:
[]
delegate
:
AirspaceRegulation
{
regTitle
:
object
.
typeStr
regText
:
object
.
name
...
...
src/AirspaceManagement/AirspaceAdvisoryProvider.h
View file @
7aa5d4f6
...
...
@@ -39,11 +39,11 @@ public:
Q_PROPERTY
(
bool
valid
READ
valid
NOTIFY
advisoryChanged
)
Q_PROPERTY
(
AdvisoryColor
airspaceColor
READ
airspaceColor
NOTIFY
advisoryChanged
)
Q_PROPERTY
(
QmlObjectListModel
*
a
irspaces
READ
airspaces
NOTIFY
advisoryChanged
)
Q_PROPERTY
(
QmlObjectListModel
*
a
dvisories
READ
advisories
NOTIFY
advisoryChanged
)
virtual
bool
valid
()
=
0
;
///< Current data is valid
virtual
AdvisoryColor
airspaceColor
()
=
0
;
///< Aispace overall color
virtual
QmlObjectListModel
*
a
irspaces
()
=
0
;
///< List of AirspaceAdvisory
virtual
QmlObjectListModel
*
a
dvisories
()
=
0
;
///< List of AirspaceAdvisory
/**
* Set region of interest that should be queried. When finished, the advisoryChanged() signal will be emmited.
...
...
src/AirspaceManagement/AirspaceFlightPlanProvider.h
View file @
7aa5d4f6
...
...
@@ -14,6 +14,9 @@
* Create and maintain a flight plan
*/
#include "AirspaceAdvisoryProvider.h"
#include "QmlObjectListModel.h"
#include <QObject>
#include <QDateTime>
...
...
@@ -34,24 +37,30 @@ public:
Q_ENUM
(
PermitStatus
)
AirspaceFlightPlanProvider
(
QObject
*
parent
=
nullptr
);
virtual
~
AirspaceFlightPlanProvider
()
{}
Q_PROPERTY
(
PermitStatus
flightPermitStatus
READ
flightPermitStatus
NOTIFY
flightPermitStatusChanged
)
///< State of flight permission
Q_PROPERTY
(
QDateTime
flightStartTime
READ
flightStartTime
WRITE
setFlightStartTime
NOTIFY
flightStartTimeChanged
)
///< Start of flight
Q_PROPERTY
(
QDateTime
flightEndTime
READ
flightEndTime
WRITE
setFlightEndTime
NOTIFY
flightEndTimeChanged
)
///< End of flight
AirspaceFlightPlanProvider
(
QObject
*
parent
=
nullptr
);
virtual
~
AirspaceFlightPlanProvider
()
{}
virtual
PermitStatus
flightPermitStatus
()
const
{
return
PermitUnknown
;
}
virtual
QDateTime
flightStartTime
()
const
=
0
;
virtual
QDateTime
flightEndTime
()
const
=
0
;
Q_PROPERTY
(
PermitStatus
flightPermitStatus
READ
flightPermitStatus
NOTIFY
flightPermitStatusChanged
)
///< State of flight permission
Q_PROPERTY
(
QDateTime
flightStartTime
READ
flightStartTime
WRITE
setFlightStartTime
NOTIFY
flightStartTimeChanged
)
///< Start of flight
Q_PROPERTY
(
QDateTime
flightEndTime
READ
flightEndTime
WRITE
setFlightEndTime
NOTIFY
flightEndTimeChanged
)
///< End of flight
Q_PROPERTY
(
bool
valid
READ
valid
NOTIFY
advisoryChanged
)
Q_PROPERTY
(
QmlObjectListModel
*
advisories
READ
advisories
NOTIFY
advisoryChanged
)
Q_PROPERTY
(
AirspaceAdvisoryProvider
::
AdvisoryColor
airspaceColor
READ
airspaceColor
NOTIFY
advisoryChanged
)
virtual
void
setFlightStartTime
(
QDateTime
start
)
=
0
;
virtual
void
setFlightEndTime
(
QDateTime
end
)
=
0
;
virtual
void
createFlightPlan
(
MissionController
*
missionController
)
=
0
;
virtual
PermitStatus
flightPermitStatus
()
const
{
return
PermitUnknown
;
}
virtual
QDateTime
flightStartTime
()
const
=
0
;
virtual
QDateTime
flightEndTime
()
const
=
0
;
virtual
bool
valid
()
=
0
;
///< Current advisory list is valid
virtual
QmlObjectListModel
*
advisories
()
=
0
;
///< List of AirspaceAdvisory
virtual
AirspaceAdvisoryProvider
::
AdvisoryColor
airspaceColor
()
=
0
;
///< Aispace overall color
virtual
void
setFlightStartTime
(
QDateTime
start
)
=
0
;
virtual
void
setFlightEndTime
(
QDateTime
end
)
=
0
;
virtual
void
createFlightPlan
(
MissionController
*
missionController
)
=
0
;
signals:
void
flightPermitStatusChanged
();
void
flightStartTimeChanged
();
void
flightEndTimeChanged
();
void
flightPermitStatusChanged
();
void
flightStartTimeChanged
();
void
flightEndTimeChanged
();
void
advisoryChanged
();
};
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