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
98088b35
Commit
98088b35
authored
Feb 22, 2018
by
Gus Grubba
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make PlanMasterController in charge of initializing Airspace flight planning.
parent
abab26cc
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
47 additions
and
46 deletions
+47
-46
AirMapFlightPlanManager.cc
src/Airmap/AirMapFlightPlanManager.cc
+29
-16
AirMapFlightPlanManager.h
src/Airmap/AirMapFlightPlanManager.h
+5
-4
AirspaceFlightPlanProvider.h
src/AirspaceManagement/AirspaceFlightPlanProvider.h
+2
-2
AirspaceManager.h
src/AirspaceManagement/AirspaceManager.h
+1
-0
MissionController.cc
src/MissionManager/MissionController.cc
+0
-22
PlanMasterController.cc
src/MissionManager/PlanMasterController.cc
+10
-2
No files found.
src/Airmap/AirMapFlightPlanManager.cc
View file @
98088b35
...
...
@@ -12,8 +12,9 @@
#include "AirMapRulesetsManager.h"
#include "AirMapAdvisoryManager.h"
#include "QGCApplication.h"
#include "SettingsManager.h"
#include "
Mission
Controller.h"
#include "
PlanMaster
Controller.h"
#include "QGCMAVLink.h"
#include "airmap/pilots.h"
...
...
@@ -72,7 +73,7 @@ AirMapFlightPlanManager::setFlightEndTime(QDateTime end)
//-----------------------------------------------------------------------------
void
AirMapFlightPlanManager
::
createFlightPlan
(
MissionController
*
missio
nController
)
AirMapFlightPlanManager
::
startFlightPlanning
(
PlanMasterController
*
pla
nController
)
{
if
(
!
_shared
.
client
())
{
qCDebug
(
AirMapManagerLog
)
<<
"No AirMap client instance. Will not create a flight"
;
...
...
@@ -85,11 +86,10 @@ AirMapFlightPlanManager::createFlightPlan(MissionController* missionController)
}
//-- TODO: Check if there is an ongoing flight plan and do something about it (Delete it?)
_createPlan
=
true
;
if
(
!
_controller
)
{
_controller
=
missionController
;
if
(
!
_planController
)
{
_planController
=
planController
;
//-- Get notified of mission changes
connect
(
missionController
,
&
MissionController
::
missionBoundingCubeChanged
,
this
,
&
AirMapFlightPlanManager
::
_missionChanged
);
connect
(
planController
->
missionController
()
,
&
MissionController
::
missionBoundingCubeChanged
,
this
,
&
AirMapFlightPlanManager
::
_missionChanged
);
}
}
...
...
@@ -100,18 +100,21 @@ AirMapFlightPlanManager::_createFlightPlan()
_flight
.
reset
();
//-- Get flight bounding cube and prepare (box) polygon
QGCGeoBoundingCube
bc
=
_planController
->
missionController
()
->
travelBoundingCube
();
if
(
!
bc
.
area
())
{
//-- TODO: If single point, we need to set a point and a radius instead
return
;
}
//-- TODO: If single point, we need to set a point and a radius instead
QGCGeoBoundingCube
bc
=
_controller
->
travelBoundingCube
();
_flight
.
maxAltitude
=
fmax
(
bc
.
pointNW
.
altitude
(),
bc
.
pointSE
.
altitude
());
_flight
.
takeoffCoord
=
_
controller
->
takeoffCoordinate
();
_flight
.
takeoffCoord
=
_
planController
->
missionController
()
->
takeoffCoordinate
();
_flight
.
coords
=
bc
.
polygon2D
();
//-- Flight Date/Time
if
(
_flightStartTime
.
isNull
()
||
_flightStartTime
<
QDateTime
::
currentDateTime
())
{
_flightStartTime
=
QDateTime
::
currentDateTime
().
addSecs
(
5
*
60
);
emit
flightStartTimeChanged
();
}
if
(
_flightEndTime
.
isNull
()
||
_flightEndTime
<
_flightStartTime
)
{
_flightEndTime
=
_flightStartTime
.
addSecs
(
30
*
60
);
emit
flightEndTimeChanged
();
...
...
@@ -469,11 +472,21 @@ AirMapFlightPlanManager::_deleteFlightPlan()
void
AirMapFlightPlanManager
::
_missionChanged
()
{
//-- Are we enabled?
if
(
!
qgcApp
()
->
toolbox
()
->
settingsManager
()
->
airMapSettings
()
->
enableAirMap
()
->
rawValue
().
toBool
())
{
return
;
}
//-- Do we have a license?
if
(
!
_shared
.
hasAPIKey
())
{
return
;
}
//-- Creating a new flight plan?
if
(
_createPlan
)
{
_createPlan
=
false
;
_createFlightPlan
();
if
(
_state
==
State
::
Idle
)
{
if
(
_flightPlan
.
isEmpty
())
{
_createFlightPlan
();
}
else
{
//-- Plan is being modified
// _updateFlightPlan();
}
}
//-- Plan is being modified
// _updateFlightPlan();
}
src/Airmap/AirMapFlightPlanManager.h
View file @
98088b35
...
...
@@ -18,6 +18,8 @@
#include <QList>
#include <QGeoCoordinate>
class
PlanMasterController
;
//-----------------------------------------------------------------------------
/// class to upload a flight
class
AirMapFlightPlanManager
:
public
AirspaceFlightPlanProvider
,
public
LifetimeChecker
...
...
@@ -36,7 +38,7 @@ public:
QmlObjectListModel
*
ruleSets
()
override
{
return
&
_rulesets
;
}
AirspaceAdvisoryProvider
::
AdvisoryColor
airspaceColor
()
override
{
return
_airspaceColor
;
}
void
createFlightPlan
(
MissionController
*
missio
nController
)
override
;
void
startFlightPlanning
(
PlanMasterController
*
pla
nController
)
override
;
void
setFlightStartTime
(
QDateTime
start
)
override
;
void
setFlightEndTime
(
QDateTime
end
)
override
;
...
...
@@ -45,7 +47,7 @@ signals:
private
slots
:
void
_pollBriefing
();
void
_missionChanged
();
void
_missionChanged
();
private:
void
_uploadFlightPlan
();
...
...
@@ -79,8 +81,7 @@ private:
QTimer
_pollTimer
;
///< timer to poll for approval check
QString
_flightPlan
;
///< Current flight plan
QString
_pilotID
;
///< Pilot ID in the form "auth0|abc123"
MissionController
*
_controller
=
nullptr
;
bool
_createPlan
=
true
;
PlanMasterController
*
_planController
=
nullptr
;
bool
_valid
=
false
;
QDateTime
_flightStartTime
;
QDateTime
_flightEndTime
;
...
...
src/AirspaceManagement/AirspaceFlightPlanProvider.h
View file @
98088b35
...
...
@@ -20,7 +20,7 @@
#include <QObject>
#include <QDateTime>
class
Mission
Controller
;
class
PlanMaster
Controller
;
//-----------------------------------------------------------------------------
class
AirspaceFlightPlanProvider
:
public
QObject
...
...
@@ -58,7 +58,7 @@ public:
virtual
void
setFlightStartTime
(
QDateTime
start
)
=
0
;
virtual
void
setFlightEndTime
(
QDateTime
end
)
=
0
;
virtual
void
createFlightPlan
(
MissionController
*
missio
nController
)
=
0
;
virtual
void
startFlightPlanning
(
PlanMasterController
*
pla
nController
)
=
0
;
signals:
void
flightPermitStatusChanged
();
...
...
src/AirspaceManagement/AirspaceManager.h
View file @
98088b35
...
...
@@ -40,6 +40,7 @@ class AirspaceRestrictionProvider;
class
AirspaceRulesetsProvider
;
class
AirspaceVehicleManager
;
class
AirspaceWeatherInfoProvider
;
class
PlanMasterController
;
class
QGCApplication
;
class
Vehicle
;
...
...
src/MissionManager/MissionController.cc
View file @
98088b35
...
...
@@ -199,13 +199,6 @@ void MissionController::_newMissionItemsAvailableFromVehicle(bool removeAllReque
_initAllVisualItems
();
_updateContainsItems
();
emit
newItemsFromVehicle
();
//-- If airspace management enabled, create new flight
#if defined(QGC_AIRMAP_ENABLED)
if
(
qgcApp
()
->
toolbox
()
->
settingsManager
()
->
airMapSettings
()
->
enableAirMap
()
->
rawValue
().
toBool
())
{
qgcApp
()
->
toolbox
()
->
airspaceManager
()
->
flightPlan
()
->
createFlightPlan
(
this
);
}
#endif
}
_itemsRequested
=
false
;
}
...
...
@@ -367,14 +360,6 @@ int MissionController::insertSimpleMissionItem(QGeoCoordinate coordinate, int i)
_visualItems
->
insert
(
i
,
newItem
);
_recalcAll
();
//-- If airspace management enabled and this is the first item, create new flight
#if defined(QGC_AIRMAP_ENABLED)
if
(
_visualItems
->
count
()
==
2
&&
qgcApp
()
->
toolbox
()
->
settingsManager
()
->
airMapSettings
()
->
enableAirMap
()
->
rawValue
().
toBool
())
{
qgcApp
()
->
toolbox
()
->
airspaceManager
()
->
flightPlan
()
->
createFlightPlan
(
this
);
}
#endif
return
newItem
->
sequenceNumber
();
}
...
...
@@ -461,13 +446,6 @@ int MissionController::insertComplexMissionItem(QString itemName, QGeoCoordinate
_visualItems
->
insert
(
i
,
newItem
);
_recalcAll
();
//-- If airspace management enabled and this is the first item, create new flight
#if defined(QGC_AIRMAP_ENABLED)
if
(
_visualItems
->
count
()
==
2
&&
qgcApp
()
->
toolbox
()
->
settingsManager
()
->
airMapSettings
()
->
enableAirMap
()
->
rawValue
().
toBool
())
{
qgcApp
()
->
toolbox
()
->
airspaceManager
()
->
flightPlan
()
->
createFlightPlan
(
this
);
}
#endif
return
newItem
->
sequenceNumber
();
}
...
...
src/MissionManager/PlanMasterController.cc
View file @
98088b35
...
...
@@ -71,6 +71,13 @@ void PlanMasterController::start(bool editMode)
connect
(
_multiVehicleMgr
,
&
MultiVehicleManager
::
activeVehicleChanged
,
this
,
&
PlanMasterController
::
_activeVehicleChanged
);
_activeVehicleChanged
(
_multiVehicleMgr
->
activeVehicle
());
#if defined(QGC_AIRMAP_ENABLED)
//-- This assumes there is one single instance of PlanMasterController in edit mode.
if
(
editMode
)
{
qgcApp
()
->
toolbox
()
->
airspaceManager
()
->
flightPlan
()
->
startFlightPlanning
(
this
);
}
#endif
}
void
PlanMasterController
::
startStaticActiveVehicle
(
Vehicle
*
vehicle
)
...
...
@@ -123,6 +130,7 @@ void PlanMasterController::_activeVehicleChanged(Vehicle* activeVehicle)
connect
(
_managerVehicle
->
geoFenceManager
(),
&
GeoFenceManager
::
sendComplete
,
this
,
&
PlanMasterController
::
_sendGeoFenceComplete
);
connect
(
_managerVehicle
->
rallyPointManager
(),
&
RallyPointManager
::
sendComplete
,
this
,
&
PlanMasterController
::
_sendRallyPointsComplete
);
}
if
(
newOffline
!=
_offline
)
{
_offline
=
newOffline
;
emit
offlineEditingChanged
(
newOffline
);
...
...
@@ -169,7 +177,7 @@ void PlanMasterController::loadFromVehicle(void)
}
else
if
(
syncInProgress
())
{
qCWarning
(
PlanMasterControllerLog
)
<<
"PlanMasterController::loadFromVehicle called while syncInProgress"
;
}
else
{
_loadGeoFence
=
true
;
_loadGeoFence
=
true
;
_syncInProgress
=
true
;
emit
syncInProgressChanged
(
true
);
qCDebug
(
PlanMasterControllerLog
)
<<
"PlanMasterController::loadFromVehicle _missionController.loadFromVehicle"
;
...
...
@@ -504,7 +512,7 @@ void PlanMasterController::_showPlanFromManagerVehicle(void)
_managerVehicle
->
forceInitialPlanRequestComplete
();
}
// The crazy if structure is to handle the load prop
o
gating by itself through the system
// The crazy if structure is to handle the load prop
a
gating by itself through the system
if
(
!
_missionController
.
showPlanFromManagerVehicle
())
{
if
(
!
_geoFenceController
.
showPlanFromManagerVehicle
())
{
_rallyPointController
.
showPlanFromManagerVehicle
();
...
...
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