Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Q
qgroundcontrol
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Valentin Platzgummer
qgroundcontrol
Commits
587df7a2
Commit
587df7a2
authored
7 years ago
by
Beat Küng
Browse files
Options
Downloads
Patches
Plain Diff
GeoFenceManager: upload AirMap polygons
This is just to test, will need much better integration
parent
ca2c3722
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/MissionManager/AirMapManager.h
+2
-0
2 additions, 0 deletions
src/MissionManager/AirMapManager.h
src/MissionManager/GeoFenceManager.cc
+27
-0
27 additions, 0 deletions
src/MissionManager/GeoFenceManager.cc
src/MissionManager/GeoFenceManager.h
+2
-0
2 additions, 0 deletions
src/MissionManager/GeoFenceManager.h
with
31 additions
and
0 deletions
src/MissionManager/AirMapManager.h
+
2
−
0
View file @
587df7a2
...
@@ -40,6 +40,8 @@ public:
...
@@ -40,6 +40,8 @@ public:
Q_PROPERTY
(
QVariantList
polygon
MEMBER
_polygon
CONSTANT
)
Q_PROPERTY
(
QVariantList
polygon
MEMBER
_polygon
CONSTANT
)
const
QVariantList
&
getPolygon
()
const
{
return
_polygon
;
}
private
:
private
:
QVariantList
_polygon
;
QVariantList
_polygon
;
};
};
...
...
This diff is collapsed.
Click to expand it.
src/MissionManager/GeoFenceManager.cc
+
27
−
0
View file @
587df7a2
...
@@ -11,6 +11,7 @@
...
@@ -11,6 +11,7 @@
#include
"Vehicle.h"
#include
"Vehicle.h"
#include
"QmlObjectListModel.h"
#include
"QmlObjectListModel.h"
#include
"ParameterManager.h"
#include
"ParameterManager.h"
#include
"QGCApplication.h"
#include
"QGCMapPolygon.h"
#include
"QGCMapPolygon.h"
#include
"QGCMapCircle.h"
#include
"QGCMapCircle.h"
...
@@ -20,6 +21,7 @@ GeoFenceManager::GeoFenceManager(Vehicle* vehicle)
...
@@ -20,6 +21,7 @@ GeoFenceManager::GeoFenceManager(Vehicle* vehicle)
:
_vehicle
(
vehicle
)
:
_vehicle
(
vehicle
)
,
_planManager
(
vehicle
,
MAV_MISSION_TYPE_FENCE
)
,
_planManager
(
vehicle
,
MAV_MISSION_TYPE_FENCE
)
,
_firstParamLoadComplete
(
false
)
,
_firstParamLoadComplete
(
false
)
,
_airmapManager
(
qgcApp
()
->
toolbox
()
->
airMapManager
())
{
{
connect
(
&
_planManager
,
&
PlanManager
::
inProgressChanged
,
this
,
&
GeoFenceManager
::
inProgressChanged
);
connect
(
&
_planManager
,
&
PlanManager
::
inProgressChanged
,
this
,
&
GeoFenceManager
::
inProgressChanged
);
connect
(
&
_planManager
,
&
PlanManager
::
error
,
this
,
&
GeoFenceManager
::
error
);
connect
(
&
_planManager
,
&
PlanManager
::
error
,
this
,
&
GeoFenceManager
::
error
);
...
@@ -99,6 +101,31 @@ void GeoFenceManager::sendToVehicle(const QGeoCoordinate& breachReturn,
...
@@ -99,6 +101,31 @@ void GeoFenceManager::sendToVehicle(const QGeoCoordinate& breachReturn,
fenceItems
.
append
(
item
);
fenceItems
.
append
(
item
);
}
}
// send AirMap polygons
const
QmlObjectListModel
&
airmapPolygons
=
*
_airmapManager
->
polygonRestrictions
();
for
(
int
i
=
0
;
i
<
airmapPolygons
.
count
();
++
i
)
{
PolygonAirspaceRestriction
*
polygon
=
(
PolygonAirspaceRestriction
*
)
airmapPolygons
[
i
];
int
polygonCount
=
polygon
->
getPolygon
().
count
()
-
1
;
// last vertex is equal to the first
for
(
int
j
=
0
;
j
<
polygonCount
;
++
j
)
{
const
QGeoCoordinate
&
vertex
=
polygon
->
getPolygon
()[
j
].
value
<
QGeoCoordinate
>
();
MissionItem
*
item
=
new
MissionItem
(
0
,
MAV_CMD_NAV_FENCE_POLYGON_VERTEX_EXCLUSION
,
MAV_FRAME_GLOBAL
,
polygonCount
,
// vertex count
0
,
0
,
0
,
// param 2-4 unused
vertex
.
latitude
(),
vertex
.
longitude
(),
0
,
// param 7 unused
false
,
// autocontinue
false
,
// isCurrentItem
this
);
// parent
fenceItems
.
append
(
item
);
}
}
// TODO: circles too
_planManager
.
writeMissionItems
(
fenceItems
);
_planManager
.
writeMissionItems
(
fenceItems
);
for
(
int
i
=
0
;
i
<
fenceItems
.
count
();
i
++
)
{
for
(
int
i
=
0
;
i
<
fenceItems
.
count
();
i
++
)
{
...
...
This diff is collapsed.
Click to expand it.
src/MissionManager/GeoFenceManager.h
+
2
−
0
View file @
587df7a2
...
@@ -13,6 +13,7 @@
...
@@ -13,6 +13,7 @@
#include
<QObject>
#include
<QObject>
#include
<QGeoCoordinate>
#include
<QGeoCoordinate>
#include
"AirMapManager.h"
#include
"QGCLoggingCategory.h"
#include
"QGCLoggingCategory.h"
#include
"FactSystem.h"
#include
"FactSystem.h"
#include
"PlanManager.h"
#include
"PlanManager.h"
...
@@ -96,6 +97,7 @@ private:
...
@@ -96,6 +97,7 @@ private:
bool
_firstParamLoadComplete
;
bool
_firstParamLoadComplete
;
QList
<
QGCFencePolygon
>
_sendPolygons
;
QList
<
QGCFencePolygon
>
_sendPolygons
;
QList
<
QGCFenceCircle
>
_sendCircles
;
QList
<
QGCFenceCircle
>
_sendCircles
;
AirMapManager
*
_airmapManager
;
};
};
#endif
#endif
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment