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
719189e9
Commit
719189e9
authored
Feb 16, 2018
by
Gus Grubba
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Start work on create/update flight plan from mission
parent
066699f3
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
48 additions
and
3 deletions
+48
-3
AirMapManager.cc
src/Airmap/AirMapManager.cc
+7
-0
AirMapManager.h
src/Airmap/AirMapManager.h
+1
-0
AirspaceManager.h
src/AirspaceManagement/AirspaceManager.h
+7
-1
MissionController.cc
src/MissionManager/MissionController.cc
+28
-2
MissionController.h
src/MissionManager/MissionController.h
+5
-0
No files found.
src/Airmap/AirMapManager.cc
View file @
719189e9
...
...
@@ -153,3 +153,10 @@ AirMapManager::_instantiateAirspaceRestrictionProvider()
connect
(
airspaces
,
&
AirMapRestrictionManager
::
error
,
this
,
&
AirMapManager
::
_error
);
return
airspaces
;
}
//-----------------------------------------------------------------------------
void
AirMapManager
::
createFlight
(
MissionController
*
missionController
)
{
Q_UNUSED
(
missionController
);
}
src/Airmap/AirMapManager.h
View file @
719189e9
...
...
@@ -45,6 +45,7 @@ public:
QString
providerName
()
const
override
{
return
QString
(
"AirMap"
);
}
AirspaceVehicleManager
*
instantiateVehicle
(
const
Vehicle
&
vehicle
)
override
;
void
createFlight
(
MissionController
*
missionController
)
override
;
protected:
AirspaceRulesetsProvider
*
_instantiateRulesetsProvider
()
override
;
...
...
src/AirspaceManagement/AirspaceManager.h
View file @
719189e9
...
...
@@ -40,6 +40,7 @@ class AirspaceRulesetsProvider;
class
AirspaceVehicleManager
;
class
AirspaceAdvisoryProvider
;
class
AirspaceRestrictionProvider
;
class
MissionController
;
Q_DECLARE_LOGGING_CATEGORY
(
AirspaceManagementLog
)
...
...
@@ -61,7 +62,7 @@ public:
Q_PROPERTY
(
AirspaceRestrictionProvider
*
airspaces
READ
airspaces
CONSTANT
)
Q_PROPERTY
(
bool
airspaceVisible
READ
airspaceVisible
WRITE
setAirspaceVisible
NOTIFY
airspaceVisibleChanged
)
Q_INVOKABLE
void
setROI
(
QGeoCoordinate
center
,
double
radius
);
Q_INVOKABLE
void
setROI
(
QGeoCoordinate
center
,
double
radius
);
AirspaceWeatherInfoProvider
*
weatherInfo
()
{
return
_weatherProvider
;
}
AirspaceAdvisoryProvider
*
advisories
()
{
return
_advisories
;
}
...
...
@@ -80,6 +81,11 @@ public:
*/
virtual
AirspaceVehicleManager
*
instantiateVehicle
(
const
Vehicle
&
vehicle
)
=
0
;
/**
* Create/upload a flight from a mission.
*/
virtual
void
createFlight
(
MissionController
*
missionController
)
=
0
;
signals:
void
airspaceVisibleChanged
();
...
...
src/MissionManager/MissionController.cc
View file @
719189e9
...
...
@@ -199,6 +199,13 @@ 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
()
->
createFlight
(
this
);
}
#endif
}
_itemsRequested
=
false
;
}
...
...
@@ -361,6 +368,13 @@ int MissionController::insertSimpleMissionItem(QGeoCoordinate coordinate, int i)
_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
()
->
createFlight
(
this
);
}
#endif
return
newItem
->
sequenceNumber
();
}
...
...
@@ -447,6 +461,13 @@ 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
()
->
createFlight
(
this
);
}
#endif
return
newItem
->
sequenceNumber
();
}
...
...
@@ -1997,6 +2018,7 @@ void MissionController::setCurrentPlanViewIndex(int sequenceNumber, bool force)
void
MissionController
::
_updateTimeout
()
{
QGeoCoordinate
takeoffCoordinate
;
QGCGeoBoundingCube
boundingCube
;
double
north
=
0.0
;
double
south
=
180.0
;
...
...
@@ -2010,9 +2032,11 @@ void MissionController::_updateTimeout()
SimpleMissionItem
*
pSimpleItem
=
qobject_cast
<
SimpleMissionItem
*>
(
item
);
if
(
pSimpleItem
)
{
switch
(
pSimpleItem
->
command
())
{
case
MAV_CMD_NAV_TAKEOFF
:
takeoffCoordinate
=
pSimpleItem
->
coordinate
();
// Fall through
case
MAV_CMD_NAV_WAYPOINT
:
case
MAV_CMD_NAV_LAND
:
case
MAV_CMD_NAV_TAKEOFF
:
if
(
pSimpleItem
->
coordinate
().
isValid
())
{
double
lat
=
pSimpleItem
->
coordinate
().
latitude
()
+
90.0
;
double
lon
=
pSimpleItem
->
coordinate
().
longitude
()
+
180.0
;
...
...
@@ -2047,8 +2071,10 @@ void MissionController::_updateTimeout()
boundingCube
=
QGCGeoBoundingCube
(
QGeoCoordinate
(
north
-
90.0
,
west
-
180.0
,
minAlt
),
QGeoCoordinate
(
south
-
90.0
,
east
-
180.0
,
maxAlt
));
if
(
_travelBoundingCube
!=
boundingCube
)
{
if
(
_travelBoundingCube
!=
boundingCube
||
_takeoffCoordinate
!=
takeoffCoordinate
)
{
_takeoffCoordinate
=
takeoffCoordinate
;
_travelBoundingCube
=
boundingCube
;
emit
missionBoundingCubeChanged
();
qCDebug
(
MissionControllerLog
)
<<
"Bounding cube:"
<<
_travelBoundingCube
.
pointNW
<<
_travelBoundingCube
.
pointSE
;
}
}
...
...
src/MissionManager/MissionController.h
View file @
719189e9
...
...
@@ -125,6 +125,9 @@ public:
bool
loadJsonFile
(
QFile
&
file
,
QString
&
errorString
);
bool
loadTextFile
(
QFile
&
file
,
QString
&
errorString
);
QGCGeoBoundingCube
travelBoundingCube
()
{
return
_travelBoundingCube
;
}
QGeoCoordinate
takeoffCoordinate
()
{
return
_takeoffCoordinate
;
}
// Overrides from PlanElementController
bool
supported
(
void
)
const
final
{
return
true
;
}
void
start
(
bool
editMode
)
final
;
...
...
@@ -192,6 +195,7 @@ signals:
void
currentMissionIndexChanged
(
int
currentMissionIndex
);
void
currentPlanViewIndexChanged
(
void
);
void
currentPlanViewItemChanged
(
void
);
void
missionBoundingCubeChanged
(
void
);
private
slots
:
void
_newMissionItemsAvailableFromVehicle
(
bool
removeAllRequested
);
...
...
@@ -263,6 +267,7 @@ private:
VisualMissionItem
*
_currentPlanViewItem
;
QTimer
_updateTimer
;
QGCGeoBoundingCube
_travelBoundingCube
;
QGeoCoordinate
_takeoffCoordinate
;
static
const
char
*
_settingsGroup
;
...
...
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