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
8b16b196
Commit
8b16b196
authored
Sep 11, 2020
by
Valentin Platzgummer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
temp
parent
990aa5eb
Changes
10
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
1090 additions
and
435 deletions
+1090
-435
qgroundcontrol.pro
qgroundcontrol.pro
+2
-0
snake.cpp
src/Snake/snake.cpp
+16
-11
snake.h
src/Snake/snake.h
+10
-10
NemoInterface.cpp
src/Wima/Snake/NemoInterface.cpp
+341
-0
NemoInterface.h
src/Wima/Snake/NemoInterface.h
+40
-0
SnakeDataManager.cc
src/Wima/Snake/SnakeDataManager.cc
+240
-386
SnakeDataManager.h
src/Wima/Snake/SnakeDataManager.h
+0
-13
SnakeDataManager_old.cc
src/Wima/Snake/SnakeDataManager_old.cc
+425
-0
WimaController.cc
src/Wima/WimaController.cc
+16
-14
WimaController.h
src/Wima/WimaController.h
+0
-1
No files found.
qgroundcontrol.pro
View file @
8b16b196
...
...
@@ -434,6 +434,7 @@ HEADERS += \
src
/
Wima
/
Geometry
/
GenericPolygon
.
h
\
src
/
Wima
/
Geometry
/
GenericPolygonArray
.
h
\
src
/
Wima
/
Geometry
/
GeoPoint3D
.
h
\
src
/
Wima
/
Snake
/
NemoInterface
.
h
\
src
/
Wima
/
Snake
/
QNemoHeartbeat
.
h
\
src
/
Wima
/
Snake
/
QNemoProgress
.
h
\
src
/
Wima
/
Snake
/
QNemoProgress
.
h
\
...
...
@@ -500,6 +501,7 @@ SOURCES += \
src
/
Snake
/
clipper
/
clipper
.
cpp
\
src
/
Snake
/
snake
.
cpp
\
src
/
Wima
/
Geometry
/
GeoPoint3D
.
cpp
\
src
/
Wima
/
Snake
/
NemoInterface
.
cpp
\
src
/
Wima
/
Snake
/
QNemoProgress
.
cc
\
src
/
Wima
/
Snake
/
SnakeDataManager
.
cc
\
src
/
Wima
/
Snake
/
SnakeTile
.
cpp
\
...
...
src/Snake/snake.cpp
View file @
8b16b196
...
...
@@ -454,7 +454,7 @@ bool Scenario::update() {
return
true
;
}
bool
Scenario
::
_calculateBoundingBox
()
{
bool
Scenario
::
_calculateBoundingBox
()
const
{
return
minimalBoundingBox
(
_mArea
,
_mAreaBoundingBox
);
}
...
...
@@ -474,7 +474,7 @@ bool Scenario::_calculateBoundingBox() {
*
* @return Returns true if successful.
*/
bool
Scenario
::
_calculateTiles
()
{
bool
Scenario
::
_calculateTiles
()
const
{
_tiles
.
clear
();
_tileCenterPoints
.
clear
();
...
...
@@ -571,7 +571,7 @@ bool Scenario::_calculateTiles() {
return
true
;
}
bool
Scenario
::
_calculateJoinedArea
()
{
bool
Scenario
::
_calculateJoinedArea
()
const
{
_jArea
.
clear
();
// Measurement area and service area overlapping?
bool
overlapingSerMeas
=
bg
::
intersects
(
_mArea
,
_sArea
)
?
true
:
false
;
...
...
@@ -775,7 +775,7 @@ bool flight_plan::transectsFromScenario(Length distance, Length minLength,
ClipperLib
::
PolyTree
clippedTransecs
;
clipper
.
Execute
(
ClipperLib
::
ctIntersection
,
clippedTransecs
,
ClipperLib
::
pftNonZero
,
ClipperLib
::
pftNonZero
);
auto
&
transects
=
clippedTransecs
;
const
auto
*
transects
=
&
clippedTransecs
;
bool
ignoreProgress
=
p
.
size
()
!=
scenario
.
tiles
().
size
();
ClipperLib
::
PolyTree
clippedTransecs2
;
...
...
@@ -793,9 +793,9 @@ bool flight_plan::transectsFromScenario(Length distance, Length minLength,
if
(
processedTiles
.
size
()
!=
numTiles
)
{
vector
<
ClipperLib
::
Path
>
processedTilesClipper
;
for
(
auto
t
:
processedTiles
)
{
for
(
const
auto
&
t
:
processedTiles
)
{
ClipperLib
::
Path
path
;
for
(
auto
vertex
:
t
.
outer
())
{
for
(
const
auto
&
vertex
:
t
.
outer
())
{
path
.
push_back
(
ClipperLib
::
IntPoint
{
static_cast
<
ClipperLib
::
cInt
>
(
vertex
.
get
<
0
>
()
*
CLIPPER_SCALE
),
static_cast
<
ClipperLib
::
cInt
>
(
vertex
.
get
<
1
>
()
*
CLIPPER_SCALE
)});
...
...
@@ -805,26 +805,31 @@ bool flight_plan::transectsFromScenario(Length distance, Length minLength,
// Subtract holes (tiles with measurement_progress == 100) from transects.
clipper
.
Clear
();
for
(
auto
&
child
:
clippedTransecs
.
Childs
)
for
(
const
auto
&
child
:
clippedTransecs
.
Childs
)
{
clipper
.
AddPath
(
child
->
Contour
,
ClipperLib
::
ptSubject
,
false
);
}
clipper
.
AddPaths
(
processedTilesClipper
,
ClipperLib
::
ptClip
,
true
);
clipper
.
Execute
(
ClipperLib
::
ctDifference
,
clippedTransecs2
,
ClipperLib
::
pftNonZero
,
ClipperLib
::
pftNonZero
);
transects
=
clippedTransecs2
;
transects
=
&
clippedTransecs2
;
}
else
{
// All tiles processed (t.size() not changed).
return
true
;
}
}
// Extract transects from PolyTree and convert them to BoostLineString
for
(
auto
&
child
:
transects
.
Childs
)
{
auto
&
clipperTransect
=
child
->
Contour
;
for
(
const
auto
&
child
:
transects
->
Childs
)
{
const
auto
&
clipperTransect
=
child
->
Contour
;
BoostPoint
v1
{
static_cast
<
double
>
(
clipperTransect
[
0
].
X
)
/
CLIPPER_SCALE
,
static_cast
<
double
>
(
clipperTransect
[
0
].
Y
)
/
CLIPPER_SCALE
};
BoostPoint
v2
{
static_cast
<
double
>
(
clipperTransect
[
1
].
X
)
/
CLIPPER_SCALE
,
static_cast
<
double
>
(
clipperTransect
[
1
].
Y
)
/
CLIPPER_SCALE
};
BoostLineString
transect
{
v1
,
v2
};
if
(
bg
::
length
(
transect
)
>=
minLength
.
value
())
if
(
bg
::
length
(
transect
)
>=
minLength
.
value
())
{
t
.
push_back
(
transect
);
}
}
if
(
t
.
size
()
==
0
)
{
...
...
src/Snake/snake.h
View file @
8b16b196
...
...
@@ -173,14 +173,14 @@ public:
const
BoundingBox
&
measurementAreaBBox
()
const
;
const
BoostPoint
&
homePositon
()
const
;
bool
update
();
bool
update
()
const
;
string
errorString
;
mutable
string
errorString
;
private:
bool
_calculateBoundingBox
();
bool
_calculateTiles
();
bool
_calculateJoinedArea
();
bool
_calculateBoundingBox
()
const
;
bool
_calculateTiles
()
const
;
bool
_calculateJoinedArea
()
const
;
Length
_tileWidth
;
Length
_tileHeight
;
...
...
@@ -191,12 +191,12 @@ private:
BoostPolygon
_mArea
;
BoostPolygon
_sArea
;
BoostPolygon
_corridor
;
BoostPolygon
_jArea
;
mutable
BoostPolygon
_jArea
;
BoundingBox
_mAreaBoundingBox
;
vector
<
BoostPolygon
>
_tiles
;
BoostLineString
_tileCenterPoints
;
BoostPoint
_homePosition
;
mutable
BoundingBox
_mAreaBoundingBox
;
mutable
vector
<
BoostPolygon
>
_tiles
;
mutable
BoostLineString
_tileCenterPoints
;
mutable
BoostPoint
_homePosition
;
};
template
<
class
GeoPoint
,
template
<
class
,
class
...
>
class
Container
>
...
...
src/Wima/Snake/NemoInterface.cpp
0 → 100644
View file @
8b16b196
This diff is collapsed.
Click to expand it.
src/Wima/Snake/NemoInterface.h
0 → 100644
View file @
8b16b196
#pragma once
#include <QGeoCoordinate>
#include <QObject>
#include "SnakeTilesLocal.h"
#include <memory>
class
NemoInterface
:
public
QObject
{
Q_OBJECT
class
Impl
;
using
PImpl
=
std
::
unique_ptr
<
Impl
>
;
public:
enum
class
NemoStatus
{
NotConnected
=
0
,
Connected
=
1
,
Timeout
=
-
1
,
InvalidHeartbeat
=
-
2
};
explicit
NemoInterface
(
QObject
*
parent
=
nullptr
);
void
start
();
void
stop
();
void
setTilesENU
(
const
SnakeTilesLocal
&
tilesENU
);
void
setENUOrigin
(
const
QGeoCoordinate
&
ENUOrigin
);
NemoStatus
status
();
QVector
<
int
>
progress
();
signals:
void
statusChanged
();
void
progressChanged
();
private:
PImpl
pImpl
;
};
src/Wima/Snake/SnakeDataManager.cc
View file @
8b16b196
This diff is collapsed.
Click to expand it.
src/Wima/Snake/SnakeDataManager.h
View file @
8b16b196
...
...
@@ -15,13 +15,6 @@ using namespace boost::units;
using
Length
=
quantity
<
si
::
length
>
;
using
Area
=
quantity
<
si
::
area
>
;
enum
class
NemoStatus
{
NotConnected
=
0
,
Connected
=
1
,
Timeout
=
-
1
,
InvalidHeartbeat
=
-
2
};
class
SnakeDataManager
:
public
QThread
{
Q_OBJECT
...
...
@@ -39,7 +32,6 @@ public:
const
QmlObjectListModel
*
tiles
()
const
;
QVariantList
tileCenterPoints
()
const
;
QNemoProgress
nemoProgress
()
const
;
int
nemoStatus
()
const
;
bool
calcInProgress
()
const
;
QString
errorMessage
()
const
;
bool
success
()
const
;
...
...
@@ -63,12 +55,7 @@ public:
Length
tileWidth
()
const
;
void
setTileWidth
(
Length
tileWidth
);
void
enableRosBridge
();
void
disableRosBride
();
signals:
void
nemoProgressChanged
();
void
nemoStatusChanged
(
int
status
);
void
calcInProgressChanged
(
bool
inProgress
);
protected:
...
...
src/Wima/Snake/SnakeDataManager_old.cc
0 → 100644
View file @
8b16b196
This diff is collapsed.
Click to expand it.
src/Wima/WimaController.cc
View file @
8b16b196
...
...
@@ -121,6 +121,8 @@ WimaController::WimaController(QObject *parent)
&
WimaController
::
nemoStatusChanged
);
connect
(
_currentDM
,
&
SnakeDataManager
::
nemoStatusChanged
,
this
,
&
WimaController
::
nemoStatusStringChanged
);
connect
(
_currentDM
,
&
SnakeDataManager
::
calcInProgressChanged
,
this
,
&
WimaController
::
snakeCalcInProgressChanged
);
connect
(
this
,
&
QObject
::
destroyed
,
&
this
->
_snakeDM
,
&
SnakeDataManager
::
quit
);
connect
(
this
,
&
QObject
::
destroyed
,
&
this
->
_emptyDM
,
&
SnakeDataManager
::
quit
);
...
...
@@ -726,15 +728,15 @@ void WimaController::_DMFinishedHandler() {
}
// Do update.
auto
fut
=
QtConcurrent
::
run
([
this
]
{
this
->
_snakeWM
.
update
();
// this can take a while (ca. 200ms)
this
->
_snakeWM
.
update
();
// this can take a while (ca. 200ms)
emit
this
->
missionItemsChanged
();
emit
this
->
currentMissionItemsChanged
();
emit
this
->
currentWaypointPathChanged
();
emit
this
->
waypointPathChanged
();
});
(
void
)
fut
;
emit
snakeTilesChanged
();
emit
snakeTileCenterPointsChanged
();
emit
nemoProgressChanged
();
emit
missionItemsChanged
();
emit
currentMissionItemsChanged
();
emit
currentWaypointPathChanged
();
emit
waypointPathChanged
();
}
void
WimaController
::
_switchToSnakeWaypointManager
(
QVariant
variant
)
{
...
...
@@ -756,6 +758,8 @@ void WimaController::_switchDataManager(SnakeDataManager &dataManager) {
&
WimaController
::
nemoStatusChanged
);
disconnect
(
_currentDM
,
&
SnakeDataManager
::
nemoStatusChanged
,
this
,
&
WimaController
::
nemoStatusStringChanged
);
disconnect
(
_currentDM
,
&
SnakeDataManager
::
calcInProgressChanged
,
this
,
&
WimaController
::
snakeCalcInProgressChanged
);
_currentDM
=
&
dataManager
;
...
...
@@ -767,8 +771,9 @@ void WimaController::_switchDataManager(SnakeDataManager &dataManager) {
&
WimaController
::
nemoStatusChanged
);
connect
(
_currentDM
,
&
SnakeDataManager
::
nemoStatusChanged
,
this
,
&
WimaController
::
nemoStatusStringChanged
);
connect
(
_currentDM
,
&
SnakeDataManager
::
calcInProgressChanged
,
this
,
&
WimaController
::
snakeCalcInProgressChanged
);
emit
snakeConnectionStatusChanged
();
emit
snakeCalcInProgressChanged
();
emit
snakeTilesChanged
();
emit
snakeTileCenterPointsChanged
();
...
...
@@ -778,16 +783,13 @@ void WimaController::_switchDataManager(SnakeDataManager &dataManager) {
}
}
void
WimaController
::
_progressChangedHandler
()
{
emit
this
->
nemoProgressChanged
();
this
->
_currentDM
->
start
();
}
void
WimaController
::
_progressChangedHandler
()
{
_snakeDM
.
start
();
}
void
WimaController
::
_enableSnakeChangedHandler
()
{
if
(
this
->
_enableSnake
.
rawValue
().
toBool
())
{
qDebug
()
<<
"WimaController: enabling snake."
;
_switchDataManager
(
this
->
_snakeDM
);
this
->
_snakeDM
.
enableRosBridge
();
_switchDataManager
(
_snakeDM
);
_currentDM
->
start
();
}
else
{
qDebug
()
<<
"WimaController: disabling snake."
;
...
...
src/Wima/WimaController.h
View file @
8b16b196
...
...
@@ -205,7 +205,6 @@ signals:
void
phaseDistanceChanged
(
void
);
void
phaseDurationChanged
(
void
);
// Snake.
void
snakeConnectionStatusChanged
(
void
);
void
snakeCalcInProgressChanged
(
void
);
void
snakeTilesChanged
(
void
);
void
snakeTileCenterPointsChanged
(
void
);
...
...
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