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
ba37ee4c
Commit
ba37ee4c
authored
Mar 07, 2018
by
Gus Grubba
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updating airmapd with its fixes for flight plan updates.
parent
bdb044df
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
67 additions
and
65 deletions
+67
-65
flight_plan.h
libs/airmapd/include/airmap/flight_plan.h
+9
-7
libairmap-qt.0.dylib
libs/airmapd/macOS/Qt.5.9/libairmap-qt.0.dylib
+0
-0
AirMapFlightPlanManager.cc
src/Airmap/AirMapFlightPlanManager.cc
+54
-56
AirMapFlightPlanManager.h
src/Airmap/AirMapFlightPlanManager.h
+2
-0
AirMapManager.cc
src/Airmap/AirMapManager.cc
+2
-2
No files found.
libs/airmapd/include/airmap/flight_plan.h
View file @
ba37ee4c
...
@@ -53,6 +53,8 @@ struct FlightPlan {
...
@@ -53,6 +53,8 @@ struct FlightPlan {
Geometry
geometry
;
///< The geometry describing the flight.
Geometry
geometry
;
///< The geometry describing the flight.
DateTime
start_time
;
///< Point in time when the flight will start/was started.
DateTime
start_time
;
///< Point in time when the flight will start/was started.
DateTime
end_time
;
///< Point in time when the fligth will end.
DateTime
end_time
;
///< Point in time when the fligth will end.
std
::
vector
<
RuleSet
::
Id
>
rulesets
;
///< RuleSets that apply to this flight plan.
std
::
unordered_map
<
std
::
string
,
RuleSet
::
Feature
::
Value
>
features
;
///< Additional properties of the planned flight.
};
};
}
// namespace airmap
}
// namespace airmap
...
...
libs/airmapd/macOS/Qt.5.9/libairmap-qt.0.dylib
View file @
ba37ee4c
No preview for this file type
src/Airmap/AirMapFlightPlanManager.cc
View file @
ba37ee4c
...
@@ -17,11 +17,11 @@
...
@@ -17,11 +17,11 @@
#include "PlanMasterController.h"
#include "PlanMasterController.h"
#include "QGCMAVLink.h"
#include "QGCMAVLink.h"
#include "airmap/pilots.h"
#include "airmap/flights.h"
#include "airmap/date_time.h"
#include "airmap/date_time.h"
#include "airmap/flight_plans.h"
#include "airmap/flight_plans.h"
#include "airmap/flights.h"
#include "airmap/geometry.h"
#include "airmap/geometry.h"
#include "airmap/pilots.h"
using
namespace
airmap
;
using
namespace
airmap
;
...
@@ -413,39 +413,16 @@ AirMapFlightPlanManager::_createFlightPlan()
...
@@ -413,39 +413,16 @@ AirMapFlightPlanManager::_createFlightPlan()
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
void
void
AirMapFlightPlanManager
::
_up
loadFlightPlan
(
)
AirMapFlightPlanManager
::
_up
dateRulesAndFeatures
(
std
::
vector
<
RuleSet
::
Id
>&
rulesets
,
std
::
unordered_map
<
std
::
string
,
RuleSet
::
Feature
::
Value
>&
features
)
{
{
qCDebug
(
AirMapManagerLog
)
<<
"Uploading flight plan. State:"
<<
(
int
)
_state
;
if
(
_state
!=
State
::
Idle
)
{
QTimer
::
singleShot
(
100
,
this
,
&
AirMapFlightPlanManager
::
_uploadFlightPlan
);
return
;
}
_state
=
State
::
FlightUpload
;
std
::
weak_ptr
<
LifetimeChecker
>
isAlive
(
_instance
);
_shared
.
doRequestWithLogin
([
this
,
isAlive
](
const
QString
&
login_token
)
{
if
(
!
isAlive
.
lock
())
return
;
if
(
_state
!=
State
::
FlightUpload
)
return
;
FlightPlans
::
Create
::
Parameters
params
;
params
.
max_altitude
=
_flight
.
maxAltitude
;
params
.
min_altitude
=
0.0
;
params
.
buffer
=
2.
f
;
params
.
latitude
=
_flight
.
takeoffCoord
.
latitude
();
params
.
longitude
=
_flight
.
takeoffCoord
.
longitude
();
params
.
pilot
.
id
=
_pilotID
.
toStdString
();
quint64
start
=
QDateTime
::
currentDateTimeUtc
().
toMSecsSinceEpoch
();
quint64
end
=
start
+
60
*
30
*
1000
;
params
.
start_time
=
airmap
::
from_milliseconds_since_epoch
(
airmap
::
Milliseconds
{(
long
long
)
start
});
params
.
end_time
=
airmap
::
from_milliseconds_since_epoch
(
airmap
::
Milliseconds
{(
long
long
)
end
});
//-- Rules
AirMapRulesetsManager
*
pRulesMgr
=
dynamic_cast
<
AirMapRulesetsManager
*>
(
qgcApp
()
->
toolbox
()
->
airspaceManager
()
->
ruleSets
());
AirMapRulesetsManager
*
pRulesMgr
=
dynamic_cast
<
AirMapRulesetsManager
*>
(
qgcApp
()
->
toolbox
()
->
airspaceManager
()
->
ruleSets
());
if
(
pRulesMgr
)
{
if
(
pRulesMgr
)
{
for
(
int
rs
=
0
;
rs
<
pRulesMgr
->
ruleSets
()
->
count
();
rs
++
)
{
for
(
int
rs
=
0
;
rs
<
pRulesMgr
->
ruleSets
()
->
count
();
rs
++
)
{
AirMapRuleSet
*
ruleSet
=
qobject_cast
<
AirMapRuleSet
*>
(
pRulesMgr
->
ruleSets
()
->
get
(
rs
));
AirMapRuleSet
*
ruleSet
=
qobject_cast
<
AirMapRuleSet
*>
(
pRulesMgr
->
ruleSets
()
->
get
(
rs
));
//-- If this ruleset is selected
//-- If this ruleset is selected
if
(
ruleSet
&&
ruleSet
->
selected
())
{
if
(
ruleSet
&&
ruleSet
->
selected
())
{
params
.
rulesets
.
push_back
(
ruleSet
->
id
().
toStdString
());
rulesets
.
push_back
(
ruleSet
->
id
().
toStdString
());
//-- Features within each rule
//-- Features within each rule
/*
for
(
int
r
=
0
;
r
<
ruleSet
->
rules
()
->
count
();
r
++
)
{
for
(
int
r
=
0
;
r
<
ruleSet
->
rules
()
->
count
();
r
++
)
{
AirMapRule
*
rule
=
qobject_cast
<
AirMapRule
*>
(
ruleSet
->
rules
()
->
get
(
r
));
AirMapRule
*
rule
=
qobject_cast
<
AirMapRule
*>
(
ruleSet
->
rules
()
->
get
(
r
));
if
(
rule
)
{
if
(
rule
)
{
...
@@ -454,18 +431,18 @@ AirMapFlightPlanManager::_uploadFlightPlan()
...
@@ -454,18 +431,18 @@ AirMapFlightPlanManager::_uploadFlightPlan()
if
(
feature
&&
feature
->
value
().
isValid
())
{
if
(
feature
&&
feature
->
value
().
isValid
())
{
switch
(
feature
->
type
())
{
switch
(
feature
->
type
())
{
case
AirspaceRuleFeature
:
:
Boolean
:
case
AirspaceRuleFeature
:
:
Boolean
:
params.
features[feature->name().toStdString()] = RuleSet::Feature::Value(feature->value().toBool());
features
[
feature
->
name
().
toStdString
()]
=
RuleSet
::
Feature
::
Value
(
feature
->
value
().
toBool
());
break
;
break
;
case
AirspaceRuleFeature
:
:
Float
:
case
AirspaceRuleFeature
:
:
Float
:
//-- Sanity check for floats
//-- Sanity check for floats
if
(
isfinite
(
feature
->
value
().
toFloat
()))
{
if
(
isfinite
(
feature
->
value
().
toFloat
()))
{
params.
features[feature->name().toStdString()] = RuleSet::Feature::Value(feature->value().toFloat());
features
[
feature
->
name
().
toStdString
()]
=
RuleSet
::
Feature
::
Value
(
feature
->
value
().
toFloat
());
}
}
break
;
break
;
case
AirspaceRuleFeature
:
:
String
:
case
AirspaceRuleFeature
:
:
String
:
//-- Skip empty responses
//-- Skip empty responses
if
(
!
feature
->
value
().
toString
().
isEmpty
())
{
if
(
!
feature
->
value
().
toString
().
isEmpty
())
{
params.
features[feature->name().toStdString()] = RuleSet::Feature::Value(feature->value().toString().toStdString());
features
[
feature
->
name
().
toStdString
()]
=
RuleSet
::
Feature
::
Value
(
feature
->
value
().
toString
().
toStdString
());
}
}
break
;
break
;
default:
default:
...
@@ -475,10 +452,38 @@ AirMapFlightPlanManager::_uploadFlightPlan()
...
@@ -475,10 +452,38 @@ AirMapFlightPlanManager::_uploadFlightPlan()
}
}
}
}
}
}
*/
}
}
}
}
}
}
}
//-----------------------------------------------------------------------------
void
AirMapFlightPlanManager
::
_uploadFlightPlan
()
{
qCDebug
(
AirMapManagerLog
)
<<
"Uploading flight plan. State:"
<<
(
int
)
_state
;
if
(
_state
!=
State
::
Idle
)
{
QTimer
::
singleShot
(
100
,
this
,
&
AirMapFlightPlanManager
::
_uploadFlightPlan
);
return
;
}
_state
=
State
::
FlightUpload
;
std
::
weak_ptr
<
LifetimeChecker
>
isAlive
(
_instance
);
_shared
.
doRequestWithLogin
([
this
,
isAlive
](
const
QString
&
login_token
)
{
if
(
!
isAlive
.
lock
())
return
;
if
(
_state
!=
State
::
FlightUpload
)
return
;
FlightPlans
::
Create
::
Parameters
params
;
params
.
max_altitude
=
_flight
.
maxAltitude
;
params
.
min_altitude
=
0.0
;
params
.
buffer
=
2.
f
;
params
.
latitude
=
_flight
.
takeoffCoord
.
latitude
();
params
.
longitude
=
_flight
.
takeoffCoord
.
longitude
();
params
.
pilot
.
id
=
_pilotID
.
toStdString
();
quint64
start
=
QDateTime
::
currentDateTimeUtc
().
toMSecsSinceEpoch
();
quint64
end
=
start
+
60
*
30
*
1000
;
params
.
start_time
=
airmap
::
from_milliseconds_since_epoch
(
airmap
::
Milliseconds
{(
long
long
)
start
});
params
.
end_time
=
airmap
::
from_milliseconds_since_epoch
(
airmap
::
Milliseconds
{(
long
long
)
end
});
//-- Rules & Features
_updateRulesAndFeatures
(
params
.
rulesets
,
params
.
features
);
//-- Geometry: polygon
//-- Geometry: polygon
Geometry
::
Polygon
polygon
;
Geometry
::
Polygon
polygon
;
for
(
const
auto
&
qcoord
:
_flight
.
coords
)
{
for
(
const
auto
&
qcoord
:
_flight
.
coords
)
{
...
@@ -535,6 +540,10 @@ AirMapFlightPlanManager::_updateFlightPlan()
...
@@ -535,6 +540,10 @@ AirMapFlightPlanManager::_updateFlightPlan()
_flightPlan
.
buffer
=
2.
f
;
_flightPlan
.
buffer
=
2.
f
;
_flightPlan
.
takeoff
.
latitude
=
_flight
.
takeoffCoord
.
latitude
();
_flightPlan
.
takeoff
.
latitude
=
_flight
.
takeoffCoord
.
latitude
();
_flightPlan
.
takeoff
.
longitude
=
_flight
.
takeoffCoord
.
longitude
();
_flightPlan
.
takeoff
.
longitude
=
_flight
.
takeoffCoord
.
longitude
();
//-- Rules & Features
_flightPlan
.
rulesets
.
clear
();
_flightPlan
.
features
.
clear
();
_updateRulesAndFeatures
(
_flightPlan
.
rulesets
,
_flightPlan
.
features
);
//-- Geometry: polygon
//-- Geometry: polygon
Geometry
::
Polygon
polygon
;
Geometry
::
Polygon
polygon
;
for
(
const
auto
&
qcoord
:
_flight
.
coords
)
{
for
(
const
auto
&
qcoord
:
_flight
.
coords
)
{
...
@@ -544,17 +553,6 @@ AirMapFlightPlanManager::_updateFlightPlan()
...
@@ -544,17 +553,6 @@ AirMapFlightPlanManager::_updateFlightPlan()
polygon
.
outer_ring
.
coordinates
.
push_back
(
coord
);
polygon
.
outer_ring
.
coordinates
.
push_back
(
coord
);
}
}
_flightPlan
.
geometry
=
Geometry
(
polygon
);
_flightPlan
.
geometry
=
Geometry
(
polygon
);
//-- Rules
/*
AirMapRulesetsManager* pRulesMgr = dynamic_cast<AirMapRulesetsManager*>(qgcApp()->toolbox()->airspaceManager()->ruleSets());
if(pRulesMgr) {
foreach(QString ruleset, pRulesMgr->rulesetsIDs()) {
params.flight_plan.rulesets.push_back(ruleset.toStdString());
}
}
*/
_state
=
State
::
FlightUpdate
;
_state
=
State
::
FlightUpdate
;
std
::
weak_ptr
<
LifetimeChecker
>
isAlive
(
_instance
);
std
::
weak_ptr
<
LifetimeChecker
>
isAlive
(
_instance
);
_shared
.
doRequestWithLogin
([
this
,
isAlive
](
const
QString
&
login_token
)
{
_shared
.
doRequestWithLogin
([
this
,
isAlive
](
const
QString
&
login_token
)
{
...
...
src/Airmap/AirMapFlightPlanManager.h
View file @
ba37ee4c
...
@@ -20,6 +20,7 @@
...
@@ -20,6 +20,7 @@
#include "airmap/flight.h"
#include "airmap/flight.h"
#include "airmap/flight_plan.h"
#include "airmap/flight_plan.h"
#include "airmap/ruleset.h"
class
PlanMasterController
;
class
PlanMasterController
;
...
@@ -112,6 +113,7 @@ private slots:
...
@@ -112,6 +113,7 @@ private slots:
private:
private:
void
_createFlightPlan
();
void
_createFlightPlan
();
bool
_collectFlightDtata
();
bool
_collectFlightDtata
();
void
_updateRulesAndFeatures
(
std
::
vector
<
airmap
::
RuleSet
::
Id
>&
rulesets
,
std
::
unordered_map
<
std
::
string
,
airmap
::
RuleSet
::
Feature
::
Value
>&
features
);
private:
private:
enum
class
State
{
enum
class
State
{
...
...
src/Airmap/AirMapManager.cc
View file @
ba37ee4c
...
@@ -37,8 +37,8 @@ AirMapManager::AirMapManager(QGCApplication* app, QGCToolbox* toolbox)
...
@@ -37,8 +37,8 @@ AirMapManager::AirMapManager(QGCApplication* app, QGCToolbox* toolbox)
{
{
_logger
=
std
::
make_shared
<
qt
::
Logger
>
();
_logger
=
std
::
make_shared
<
qt
::
Logger
>
();
qt
::
register_types
();
// TODO: still needed?
qt
::
register_types
();
// TODO: still needed?
_logger
->
logging_category
().
setEnabled
(
QtDebugMsg
,
fals
e
);
_logger
->
logging_category
().
setEnabled
(
QtDebugMsg
,
tru
e
);
_logger
->
logging_category
().
setEnabled
(
QtInfoMsg
,
fals
e
);
_logger
->
logging_category
().
setEnabled
(
QtInfoMsg
,
tru
e
);
_logger
->
logging_category
().
setEnabled
(
QtWarningMsg
,
false
);
_logger
->
logging_category
().
setEnabled
(
QtWarningMsg
,
false
);
_dispatchingLogger
=
std
::
make_shared
<
qt
::
DispatchingLogger
>
(
_logger
);
_dispatchingLogger
=
std
::
make_shared
<
qt
::
DispatchingLogger
>
(
_logger
);
connect
(
&
_shared
,
&
AirMapSharedState
::
error
,
this
,
&
AirMapManager
::
_error
);
connect
(
&
_shared
,
&
AirMapSharedState
::
error
,
this
,
&
AirMapManager
::
_error
);
...
...
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