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
2842dd68
Commit
2842dd68
authored
Feb 17, 2018
by
Gus Grubba
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update airmapd
Collect rulesets from briefing
parent
7aa5d4f6
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
205 additions
and
20 deletions
+205
-20
advisory.h
libs/airmapd/include/airmap/advisory.h
+128
-0
client.h
libs/airmapd/include/airmap/client.h
+4
-0
client.h
libs/airmapd/include/airmap/qt/client.h
+1
-0
libairmap-qt.0.dylib
libs/airmapd/macOS/Qt.5.9/libairmap-qt.0.dylib
+0
-0
AirMapFlightPlanManager.cc
src/Airmap/AirMapFlightPlanManager.cc
+32
-1
AirMapFlightPlanManager.h
src/Airmap/AirMapFlightPlanManager.h
+4
-1
AirMapRulesetsManager.cc
src/Airmap/AirMapRulesetsManager.cc
+10
-0
AirMapRulesetsManager.h
src/Airmap/AirMapRulesetsManager.h
+10
-6
AirspaceFlightPlanProvider.h
src/AirspaceManagement/AirspaceFlightPlanProvider.h
+5
-3
AirspaceRulesetsProvider.h
src/AirspaceManagement/AirspaceRulesetsProvider.h
+11
-9
No files found.
libs/airmapd/include/airmap/advisory.h
0 → 100644
View file @
2842dd68
#ifndef AIRMAP_ADVISORY_H_
#define AIRMAP_ADVISORY_H_
#include <airmap/airspace.h>
#include <airmap/date_time.h>
#include <airmap/do_not_copy_or_move.h>
#include <airmap/error.h>
#include <airmap/flight_plan.h>
#include <airmap/geometry.h>
#include <airmap/optional.h>
#include <airmap/outcome.h>
#include <airmap/ruleset.h>
#include <airmap/status.h>
#include <cstdint>
#include <functional>
#include <iosfwd>
#include <string>
#include <vector>
namespace
airmap
{
/// Advisory provides functionality to query airspace and weather information about
/// a geographic area.
class
Advisory
:
DoNotCopyOrMove
{
public:
/// Advisory bundles together airspace information and its evaluation in terms
/// good to fly/needs information or feedback/conflict.
struct
AirspaceAdvisory
{
Status
::
Advisory
advisory
;
/// Airspace information.
Status
::
Color
color
;
/// The evaluation of the airspace.
std
::
string
rule_id
;
/// The id of the ruleset.
std
::
string
ruleset_id
;
/// The id of the rule.
};
/// Wind bundles up attributes describing a wind conditions.
struct
Wind
{
std
::
uint32_t
heading
=
0
;
///< The heading in [°].
float
speed
=
0
.
0
;
///< The speed in [°].
std
::
uint32_t
gusting
=
0
;
};
/// Weather bundles up attributes describing a weather condition.
struct
Weather
{
std
::
string
condition
;
///< The overall weather condition.
std
::
string
icon
;
///< The icon or class of icon that should be used for display purposes.
Wind
wind
;
///< The details about the current wind conditions.
float
temperature
=
0
.
0
;
///< The temperature in [°C].
float
humidity
=
0
.
0
;
float
visibility
=
0
.
0
;
///< Visibility in [m].
float
precipitation
=
0
.
0
;
///< The probability of precipitation in [%].
std
::
string
timezone
;
///< The timezone of the weather location.
DateTime
time
;
///< Timestamp of the weather report.
float
dew_point
=
0
.
0
;
///< The current dew point.
float
mslp
=
0
.
0
;
///< The Median Sea Level Pressure in [mbar].
};
/// ForId bundles up types to ease interaction
/// with Advisory::for_id.
struct
ForId
{
/// Parameters bundles up input parameters.
struct
Parameters
{
Optional
<
DateTime
>
start
;
///< Search for advisories before this time.
Optional
<
DateTime
>
end
;
///< Search for advisories after this time.
FlightPlan
::
Id
id
;
///< Search for advisories relating to this flight plan.
};
/// Result models the outcome of calling Advisory::for_id.
using
Result
=
Outcome
<
std
::
vector
<
AirspaceAdvisory
>
,
Error
>
;
/// Callback describes the function signature of the callback that is
/// invoked when a call to Advisory::for_id finishes.
using
Callback
=
std
::
function
<
void
(
const
Result
&
)
>
;
};
/// Search bundles up types to ease interaction
/// with Advisory::search.
struct
Search
{
/// Parameters bundles up input parameters.
struct
Parameters
{
Required
<
Geometry
>
geometry
;
///< Evaluate rulesets intersecting this geometry.
Required
<
std
::
string
>
rulesets
;
///< Evaluate these rulesets.
Optional
<
DateTime
>
start
;
///< Search for advisories after this time.
Optional
<
DateTime
>
end
;
///< Search for advisories before this time.
};
/// Result models the outcome of calling Advisory::search.
using
Result
=
Outcome
<
std
::
vector
<
AirspaceAdvisory
>
,
Error
>
;
/// Callback describes the function signature of the callback that is
/// invoked when a call to Advisory::_search finishes.
using
Callback
=
std
::
function
<
void
(
const
Result
&
)
>
;
};
/// ReportWeather bundles up types to ease interaction
/// with Advisory::report_weather.
struct
ReportWeather
{
/// Parameters bundles up input parameters.
struct
Parameters
{
float
latitude
;
///< The latitude component of the takeoff point in [°].
float
longitude
;
///< The longitude component of the takeoff point in [°].
Optional
<
DateTime
>
start
;
///< Search for weather data after this time.
Optional
<
DateTime
>
end
;
///< Search for weather data before this time.
};
/// Result models the outcome of calling Advisory::report_weather.
using
Result
=
Outcome
<
Weather
,
Error
>
;
/// Callback describes the function signature of the callback that is
/// invoked when a call to Advisory::report_weather finishes.
using
Callback
=
std
::
function
<
void
(
const
Result
&
)
>
;
};
/// for_id searches flight advisories for a flight plan and reports
/// results back to 'cb'.
virtual
void
for_id
(
const
ForId
::
Parameters
&
parameters
,
const
ForId
::
Callback
&
cb
)
=
0
;
/// search searches flight advisories for 'parameters' and reports
/// results back to 'cb'.
virtual
void
search
(
const
Search
::
Parameters
&
parameters
,
const
Search
::
Callback
&
cb
)
=
0
;
/// report_weather gets the current weather conditions and reports
/// results back to 'cb'.
virtual
void
report_weather
(
const
ReportWeather
::
Parameters
&
parameters
,
const
ReportWeather
::
Callback
&
cb
)
=
0
;
protected:
/// @cond
Advisory
()
=
default
;
/// @endcond
};
}
// namespace airmap
#endif // AIRMAP_ADVISORY_H_
libs/airmapd/include/airmap/client.h
View file @
2842dd68
...
...
@@ -15,6 +15,7 @@
namespace
airmap
{
class
Advisory
;
class
Aircrafts
;
class
Airspaces
;
class
Authenticator
;
...
...
@@ -102,6 +103,9 @@ class Client : DoNotCopyOrMove {
/// authenticator returns the Authenticator implementation provided by the client.
virtual
Authenticator
&
authenticator
()
=
0
;
/// advisory returns the Advisory implementation provided by the client.
virtual
Advisory
&
advisory
()
=
0
;
/// aircrafts returns the Aircrafts implementation provided by the client.
virtual
Aircrafts
&
aircrafts
()
=
0
;
...
...
libs/airmapd/include/airmap/qt/client.h
View file @
2842dd68
...
...
@@ -36,6 +36,7 @@ class Client : public QObject, public airmap::Client {
// From airmap::Client
Authenticator
&
authenticator
()
override
;
Advisory
&
advisory
()
override
;
Aircrafts
&
aircrafts
()
override
;
Airspaces
&
airspaces
()
override
;
FlightPlans
&
flight_plans
()
override
;
...
...
libs/airmapd/macOS/Qt.5.9/libairmap-qt.0.dylib
View file @
2842dd68
No preview for this file type
src/Airmap/AirMapFlightPlanManager.cc
View file @
2842dd68
...
...
@@ -35,6 +35,13 @@ AirMapFlightPlanManager::AirMapFlightPlanManager(AirMapSharedState& shared, QObj
_flightEndTime
=
_flightStartTime
.
addSecs
(
30
*
60
);
}
//-----------------------------------------------------------------------------
AirMapFlightPlanManager
::~
AirMapFlightPlanManager
()
{
_advisories
.
deleteListAndContents
();
_rulesets
.
deleteListAndContents
();
}
//-----------------------------------------------------------------------------
void
AirMapFlightPlanManager
::
setFlightStartTime
(
QDateTime
start
)
...
...
@@ -122,7 +129,7 @@ AirMapFlightPlanManager::_createFlightPlan()
qCDebug
(
AirMapManagerLog
)
<<
"Flight End: "
<<
_flightEndTime
;
//-- Not Yet
return
;
//
return;
if
(
_pilotID
==
""
)
{
//-- Need to get the pilot id before uploading the flight plan
...
...
@@ -293,6 +300,16 @@ adv_sort(QObject* a, QObject* b)
return
(
int
)
aa
->
color
()
>
(
int
)
bb
->
color
();
}
//-----------------------------------------------------------------------------
static
bool
rules_sort
(
QObject
*
a
,
QObject
*
b
)
{
AirMapRule
*
aa
=
qobject_cast
<
AirMapRule
*>
(
a
);
AirMapRule
*
bb
=
qobject_cast
<
AirMapRule
*>
(
b
);
if
(
!
aa
||
!
bb
)
return
false
;
return
(
int
)
aa
->
status
()
>
(
int
)
bb
->
status
();
}
//-----------------------------------------------------------------------------
void
AirMapFlightPlanManager
::
_pollBriefing
()
...
...
@@ -330,6 +347,20 @@ AirMapFlightPlanManager::_pollBriefing()
std
::
sort
(
_advisories
.
objectList
()
->
begin
(),
_advisories
.
objectList
()
->
end
(),
adv_sort
);
_advisories
.
endReset
();
_valid
=
true
;
//-- Collect Rulesets
for
(
const
auto
&
ruleset
:
briefing
.
evaluation
.
rulesets
)
{
AirMapRuleSet
*
pRuleSet
=
new
AirMapRuleSet
(
this
);
pRuleSet
->
_id
=
QString
::
fromStdString
(
ruleset
.
id
);
//-- Iterate Rules
for
(
const
auto
&
rule
:
ruleset
.
rules
)
{
AirMapRule
*
pRule
=
new
AirMapRule
(
rule
,
this
);
pRuleSet
->
_rules
.
append
(
pRule
);
}
//-- Sort rules by relevance order
std
::
sort
(
pRuleSet
->
_rules
.
objectList
()
->
begin
(),
pRuleSet
->
_rules
.
objectList
()
->
end
(),
rules_sort
);
_rulesets
.
append
(
pRuleSet
);
qCDebug
(
AirMapManagerLog
)
<<
"Adding briefing ruleset"
<<
pRuleSet
->
id
();
}
emit
advisoryChanged
();
//-- Evaluate briefing status
bool
rejected
=
false
;
...
...
src/Airmap/AirMapFlightPlanManager.h
View file @
2842dd68
...
...
@@ -24,7 +24,8 @@ class AirMapFlightPlanManager : public AirspaceFlightPlanProvider, public Lifeti
{
Q_OBJECT
public:
AirMapFlightPlanManager
(
AirMapSharedState
&
shared
,
QObject
*
parent
=
nullptr
);
AirMapFlightPlanManager
(
AirMapSharedState
&
shared
,
QObject
*
parent
=
nullptr
);
~
AirMapFlightPlanManager
();
PermitStatus
flightPermitStatus
()
const
override
{
return
_flightPermitStatus
;
}
QString
flightID
()
{
return
_flightPlan
;
}
...
...
@@ -32,6 +33,7 @@ public:
QDateTime
flightEndTime
()
const
override
{
return
_flightEndTime
;
}
bool
valid
()
override
{
return
_valid
;
}
QmlObjectListModel
*
advisories
()
override
{
return
&
_advisories
;
}
QmlObjectListModel
*
ruleSets
()
override
{
return
&
_rulesets
;
}
AirspaceAdvisoryProvider
::
AdvisoryColor
airspaceColor
()
override
{
return
_airspaceColor
;
}
void
createFlightPlan
(
MissionController
*
missionController
)
override
;
...
...
@@ -83,6 +85,7 @@ private:
QDateTime
_flightStartTime
;
QDateTime
_flightEndTime
;
QmlObjectListModel
_advisories
;
QmlObjectListModel
_rulesets
;
AirspaceAdvisoryProvider
::
AdvisoryColor
_airspaceColor
;
AirspaceFlightPlanProvider
::
PermitStatus
_flightPermitStatus
=
AirspaceFlightPlanProvider
::
PermitUnknown
;
...
...
src/Airmap/AirMapRulesetsManager.cc
View file @
2842dd68
...
...
@@ -60,6 +60,12 @@ AirMapRule::AirMapRule(const airmap::RuleSet::Rule& rule, QObject* parent)
{
}
//-----------------------------------------------------------------------------
AirMapRule
::~
AirMapRule
()
{
_features
.
deleteListAndContents
();
}
//-----------------------------------------------------------------------------
AirspaceRule
::
Status
AirMapRule
::
status
()
...
...
@@ -162,6 +168,10 @@ void AirMapRulesetsManager::setROI(const QGeoCoordinate& center)
//-- Iterate Rules
for
(
const
auto
&
rule
:
ruleset
.
rules
)
{
AirMapRule
*
pRule
=
new
AirMapRule
(
rule
,
this
);
//-- Iterate Rule Features
//-- TODO: Rule features don't make sense as they are
pRuleSet
->
_rules
.
append
(
pRule
);
}
//-- Sort rules by display order
...
...
src/Airmap/AirMapRulesetsManager.h
View file @
2842dd68
...
...
@@ -51,16 +51,19 @@ class AirMapRule : public AirspaceRule
Q_OBJECT
public:
AirMapRule
(
QObject
*
parent
=
NULL
);
AirMapRule
(
const
airmap
::
RuleSet
::
Rule
&
rule
,
QObject
*
parent
=
NULL
);
AirMapRule
(
QObject
*
parent
=
NULL
);
AirMapRule
(
const
airmap
::
RuleSet
::
Rule
&
rule
,
QObject
*
parent
=
NULL
);
~
AirMapRule
();
int
order
()
{
return
(
int
)
_rule
.
display_order
;
}
Status
status
()
override
;
QString
shortText
()
override
{
return
QString
::
fromStdString
(
_rule
.
short_text
);
}
QString
description
()
override
{
return
QString
::
fromStdString
(
_rule
.
description
);
}
int
order
()
{
return
(
int
)
_rule
.
display_order
;
}
Status
status
()
override
;
QString
shortText
()
override
{
return
QString
::
fromStdString
(
_rule
.
short_text
);
}
QString
description
()
override
{
return
QString
::
fromStdString
(
_rule
.
description
);
}
QmlObjectListModel
*
features
()
override
{
return
&
_features
;
}
private:
airmap
::
RuleSet
::
Rule
_rule
;
QmlObjectListModel
_features
;
};
//-----------------------------------------------------------------------------
...
...
@@ -68,6 +71,7 @@ class AirMapRuleSet : public AirspaceRuleSet
{
Q_OBJECT
friend
class
AirMapRulesetsManager
;
friend
class
AirMapFlightPlanManager
;
public:
AirMapRuleSet
(
QObject
*
parent
=
NULL
);
~
AirMapRuleSet
();
...
...
src/AirspaceManagement/AirspaceFlightPlanProvider.h
View file @
2842dd68
...
...
@@ -45,14 +45,16 @@ public:
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
(
QmlObjectListModel
*
ruleSets
READ
ruleSets
NOTIFY
advisoryChanged
)
Q_PROPERTY
(
AirspaceAdvisoryProvider
::
AdvisoryColor
airspaceColor
READ
airspaceColor
NOTIFY
advisoryChanged
)
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
bool
valid
()
=
0
;
///< Current advisory list is valid
virtual
QmlObjectListModel
*
advisories
()
=
0
;
///< List of AirspaceAdvisory
virtual
QmlObjectListModel
*
ruleSets
()
=
0
;
///< List of AirspaceRuleSet
virtual
AirspaceAdvisoryProvider
::
AdvisoryColor
airspaceColor
()
=
0
;
///< Aispace overall color
virtual
void
setFlightStartTime
(
QDateTime
start
)
=
0
;
virtual
void
setFlightEndTime
(
QDateTime
end
)
=
0
;
...
...
src/AirspaceManagement/AirspaceRulesetsProvider.h
View file @
2842dd68
...
...
@@ -81,24 +81,26 @@ class AirspaceRule : public QObject
public:
enum
Status
{
Unknown
,
///< The status of the rule is unknown.
Conflicting
,
///< The rule is conflicting.
NotConflicting
,
///< The rule is not conflicting, all good to go.
MissingInfo
,
///< The evaluation requires further information.
Informational
///< The rule is of informational nature.
NotConflicting
,
///< The rule is not conflicting, all good to go.
Informational
,
///< The rule is of informational nature.
Unknown
,
///< The status of the rule is unknown.
};
Q_ENUM
(
Status
)
AirspaceRule
(
QObject
*
parent
=
NULL
);
Q_PROPERTY
(
Status
status
READ
status
CONSTANT
)
Q_PROPERTY
(
QString
shortText
READ
shortText
CONSTANT
)
Q_PROPERTY
(
QString
description
READ
description
CONSTANT
)
Q_PROPERTY
(
Status
status
READ
status
CONSTANT
)
Q_PROPERTY
(
QString
shortText
READ
shortText
CONSTANT
)
Q_PROPERTY
(
QString
description
READ
description
CONSTANT
)
Q_PROPERTY
(
QmlObjectListModel
*
features
READ
features
CONSTANT
)
virtual
Status
status
()
=
0
;
virtual
QString
shortText
()
=
0
;
virtual
QString
description
()
=
0
;
virtual
Status
status
()
=
0
;
virtual
QString
shortText
()
=
0
;
virtual
QString
description
()
=
0
;
virtual
QmlObjectListModel
*
features
()
=
0
;
///< List of AirspaceRuleFeature
};
//-----------------------------------------------------------------------------
...
...
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