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
0a9d836e
Commit
0a9d836e
authored
Jul 24, 2020
by
Valentin Platzgummer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
befor integrating Waypoint managers into WimaController
parent
72acd11d
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
190 additions
and
191 deletions
+190
-191
qgroundcontrol.pro
qgroundcontrol.pro
+2
-2
QmlObjectListModel.h
src/QmlControls/QmlObjectListModel.h
+1
-1
WimaJoinedAreaData.h
src/Wima/Geometry/WimaJoinedAreaData.h
+0
-4
AreaInterface.cpp
src/Wima/WaypointManager/AreaInterface.cpp
+10
-0
DefaultManager.cpp
src/Wima/WaypointManager/DefaultManager.cpp
+4
-4
DefaultManager.h
src/Wima/WaypointManager/DefaultManager.h
+1
-2
GenericSlicer.cpp
src/Wima/WaypointManager/GenericSlicer.cpp
+0
-1
GenericSlicer.h
src/Wima/WaypointManager/GenericSlicer.h
+0
-164
GenericWaypointManager.h
src/Wima/WaypointManager/GenericWaypointManager.h
+5
-10
Slicer.cpp
src/Wima/WaypointManager/Slicer.cpp
+70
-0
Slicer.h
src/Wima/WaypointManager/Slicer.h
+94
-0
Utils.h
src/Wima/WaypointManager/Utils.h
+3
-3
No files found.
qgroundcontrol.pro
View file @
0a9d836e
...
...
@@ -440,11 +440,11 @@ HEADERS += \
src
/
Wima
/
Snake
/
SnakeWorker
.
h
\
src
/
Wima
/
WaypointManager
/
AreaInterface
.
h
\
src
/
Wima
/
WaypointManager
/
DefaultManager
.
h
\
src
/
Wima
/
WaypointManager
/
GenericSlicer
.
h
\
src
/
Wima
/
WaypointManager
/
GenericWaypointManager
.
h
\
src
/
Wima
/
Geometry
/
WimaPolygonArray
.
h
\
src
/
Wima
/
Snake
/
snaketile
.
h
\
src
/
Wima
/
WaypointManager
/
Settings
.
h
\
src
/
Wima
/
WaypointManager
/
Slicer
.
h
\
src
/
Wima
/
WaypointManager
/
Utils
.
h
\
src
/
api
/
QGCCorePlugin
.
h
\
src
/
api
/
QGCOptions
.
h
\
...
...
@@ -501,9 +501,9 @@ SOURCES += \
src
/
Wima
/
Snake
/
SnakeWorker
.
cc
\
src
/
Wima
/
WaypointManager
/
AreaInterface
.
cpp
\
src
/
Wima
/
WaypointManager
/
DefaultManager
.
cpp
\
src
/
Wima
/
WaypointManager
/
GenericSlicer
.
cpp
\
src
/
Wima
/
WaypointManager
/
GenericWaypointManager
.
cpp
\
src
/
Wima
/
WaypointManager
/
Settings
.
cpp
\
src
/
Wima
/
WaypointManager
/
Slicer
.
cpp
\
src
/
Wima
/
WaypointManager
/
Utils
.
cpp
\
src
/
comm
/
ros_bridge
/
include
/
ComPrivateInclude
.
cpp
\
src
/
comm
/
ros_bridge
/
include
/
MessageTag
.
cpp
\
...
...
src/QmlControls/QmlObjectListModel.h
View file @
0a9d836e
...
...
@@ -47,7 +47,7 @@ public:
QObject
*
operator
[]
(
int
i
);
const
QObject
*
operator
[]
(
int
i
)
const
;
template
<
class
T
>
T
value
(
int
index
)
{
return
qobject_cast
<
T
>
(
_objectList
[
index
]);
}
template
<
class
T
>
T
value
(
int
index
)
const
{
return
qobject_cast
<
T
>
(
_objectList
[
index
]);
}
QList
<
QObject
*>*
objectList
()
{
return
&
_objectList
;
}
/// Calls deleteLater on all items and this itself.
...
...
src/Wima/Geometry/WimaJoinedAreaData.h
View file @
0a9d836e
...
...
@@ -23,10 +23,6 @@ public:
static
const
char
*
typeString
;
signals:
public
slots
:
protected:
void
assign
(
const
WimaJoinedAreaData
&
other
);
void
assign
(
const
WimaJoinedArea
&
other
);
...
...
src/Wima/WaypointManager/AreaInterface.cpp
View file @
0a9d836e
...
...
@@ -41,6 +41,16 @@ void WaypointManager::AreaInterface::setJoinedArea(WimaJoinedAreaData *area)
_jArea
=
area
;
}
const
WimaMeasurementAreaData
*
WaypointManager
::
AreaInterface
::
measurementArea
()
const
{
return
_mArea
;
}
const
WimaServiceAreaData
*
WaypointManager
::
AreaInterface
::
serviceArea
()
const
{
return
_sArea
;
}
const
WimaCorridorData
*
WaypointManager
::
AreaInterface
::
corridor
()
const
{
return
_cArea
;
...
...
src/Wima/WaypointManager/DefaultManager.cpp
View file @
0a9d836e
...
...
@@ -8,7 +8,7 @@ bool WaypointManager::DefaultManager::update()
{
// extract waypoints
_slice
.
clear
();
_slicer
->
update
(
_waypoints
,
_slice
);
Slicer
::
update
(
_waypoints
,
_slice
);
return
_worker
();
}
...
...
@@ -16,7 +16,7 @@ bool WaypointManager::DefaultManager::next()
{
// extract waypoints
_slice
.
clear
();
_slicer
->
next
(
_waypoints
,
_slice
);
Slicer
::
next
(
_waypoints
,
_slice
);
return
_worker
();
}
...
...
@@ -24,7 +24,7 @@ bool WaypointManager::DefaultManager::previous()
{
// extract waypoints
_slice
.
clear
();
_slicer
->
previous
(
_waypoints
,
_slice
);
Slicer
::
previous
(
_waypoints
,
_slice
);
return
_worker
();
}
...
...
@@ -32,7 +32,7 @@ bool WaypointManager::DefaultManager::reset()
{
// extract waypoints
_slice
.
clear
();
_slicer
->
reset
(
_waypoints
,
_slice
);
Slicer
::
reset
(
_waypoints
,
_slice
);
return
_worker
();
}
...
...
src/Wima/WaypointManager/DefaultManager.h
View file @
0a9d836e
...
...
@@ -20,8 +20,7 @@ class DefaultManager : public ManagerBase
{
public:
DefaultManager
()
=
delete
;
DefaultManager
(
Slicer
*
slicer
,
Settings
*
settings
,
DefaultManager
(
Settings
*
settings
,
AreaInterface
*
interface
);
...
...
src/Wima/WaypointManager/GenericSlicer.cpp
deleted
100644 → 0
View file @
72acd11d
#include "GenericSlicer.h"
src/Wima/WaypointManager/GenericSlicer.h
deleted
100644 → 0
View file @
72acd11d
#pragma once
#include <assert.h>
#include <iostream>
#include "Utils.h"
//! @brief Base class for all waypoint managers.
template
<
class
ElementType
,
template
<
class
,
class
...
>
class
Container
/*e.g. QVector*/
>
class
GenericSlicer
{
public:
typedef
Container
<
ElementType
>
ContainerType
;
GenericSlicer
();
// Slicing.
void
update
(
const
ContainerType
&
source
,
ContainerType
&
update
);
void
next
(
const
ContainerType
&
source
,
ContainerType
&
update
);
void
previous
(
const
ContainerType
&
source
,
ContainerType
&
update
);
void
reset
(
const
ContainerType
&
source
,
ContainerType
&
update
);
// Slicing parameters.
//! @brief Sets the overlap.
//!
//! @param overlap The number of overlapping vertices
//! between on and the next slice.
void
setOverlap
(
uint32_t
overlap
);
//! @brief Sets the number of vertices per slice.
//!
//! @param N The number of vertices per slice.
void
setN
(
std
::
uint32_t
N
);
//! @brief Sets the start index.
//!
//! @param idxStart The start index.
void
setStartIndex
(
int
idxStart
);
//! @return Returns the overlap.
uint32_t
overlap
();
//! @return Returns the number of vertices per slice N.
uint32_t
N
();
//! @return Returns the start index.
int
startIndex
();
private:
void
_updateIdx
(
std
::
size_t
size
);
long
_idxStart
;
long
_idxEnd
;
long
_idxNext
;
long
_idxPrevious
;
uint32_t
_overlap
;
uint32_t
_N
;
bool
_idxValid
;
bool
_atEnd
;
};
template
<
class
ElementType
,
template
<
class
,
class
...
>
class
Container
/*e.g. QVector*/
>
GenericSlicer
<
ElementType
,
Container
>::
GenericSlicer
()
:
_idxValid
(
false
)
,
_atEnd
(
false
)
{}
template
<
class
ElementType
,
template
<
class
,
class
...
>
class
Container
/*e.g. QVector*/
>
void
GenericSlicer
<
ElementType
,
Container
>::
setOverlap
(
std
::
uint32_t
overlap
)
{
_idxValid
=
false
;
_overlap
=
overlap
;
}
template
<
class
ElementType
,
template
<
class
,
class
...
>
class
Container
/*e.g. QVector*/
>
void
GenericSlicer
<
ElementType
,
Container
>::
setN
(
uint32_t
N
)
{
_idxValid
=
false
;
_N
=
N
>
0
?
N
:
1
;
}
template
<
class
ElementType
,
template
<
class
,
class
...
>
class
Container
/*e.g. QVector*/
>
void
GenericSlicer
<
ElementType
,
Container
>::
setStartIndex
(
int
idxStart
)
{
_idxValid
=
false
;
_idxStart
=
idxStart
;
}
template
<
class
ElementType
,
template
<
class
,
class
...
>
class
Container
/*e.g. QVector*/
>
uint32_t
GenericSlicer
<
ElementType
,
Container
>::
overlap
()
{
return
_overlap
;
}
template
<
class
ElementType
,
template
<
class
,
class
...
>
class
Container
/*e.g. QVector*/
>
uint32_t
GenericSlicer
<
ElementType
,
Container
>::
N
()
{
return
_N
;
}
template
<
class
ElementType
,
template
<
class
,
class
...
>
class
Container
/*e.g. QVector*/
>
int
GenericSlicer
<
ElementType
,
Container
>::
startIndex
()
{
return
_idxStart
;
}
template
<
class
ElementType
,
template
<
class
,
class
...
>
class
Container
/*e.g. QVector*/
>
void
GenericSlicer
<
ElementType
,
Container
>::
_updateIdx
(
std
::
size_t
size
)
{
_idxValid
=
true
;
_atEnd
=
false
;
if
(
_idxStart
>=
size
-
1
)
{
_idxStart
=
size
-
1
;
_idxEnd
=
_idxStart
;
_idxNext
=
_idxStart
;
_atEnd
=
true
;
return
;
}
_idxStart
<
0
?
0
:
_idxStart
;
_idxEnd
=
_idxStart
+
_N
-
1
;
_idxEnd
=
_idxEnd
<
size
?
_idxEnd
:
size
-
1
;
_idxNext
=
_idxEnd
+
1
-
_overlap
;
_idxNext
=
_idxNext
<
0
?
0
:
_idxNext
;
_idxNext
=
_idxNext
<
size
?
_idxNext
:
size
-
1
;
_idxPrevious
=
_idxStart
-
1
+
_overlap
;
_idxPrevious
=
_idxPrevious
<
0
?
0
:
_idxPrevious
;
_idxPrevious
=
_idxPrevious
<
size
?
_idxPrevious
:
size
-
1
;
}
template
<
class
ElementType
,
template
<
class
,
class
...
>
class
Container
/*e.g. QVector*/
>
void
GenericSlicer
<
ElementType
,
Container
>::
update
(
const
ContainerType
&
source
,
Container
<
ElementType
>
&
slice
){
if
(
!
_idxValid
)
_updateIdx
(
source
.
size
());
WaypointManager
::
Utils
::
extract
(
source
,
slice
,
_idxStart
,
_idxEnd
);
// extract waypoints
}
template
<
class
ElementType
,
template
<
class
,
class
...
>
class
Container
/*e.g. QVector*/
>
void
GenericSlicer
<
ElementType
,
Container
>::
next
(
const
ContainerType
&
source
,
Container
<
ElementType
>
&
slice
){
setStartIndex
(
_idxNext
);
slice
(
source
,
slice
);
}
template
<
class
ElementType
,
template
<
class
,
class
...
>
class
Container
/*e.g. QVector*/
>
void
GenericSlicer
<
ElementType
,
Container
>::
previous
(
const
ContainerType
&
source
,
Container
<
ElementType
>
&
slice
){
setStartIndex
(
_idxPrevious
);
slice
(
source
,
slice
);
}
template
<
class
ElementType
,
template
<
class
,
class
...
>
class
Container
/*e.g. QVector*/
>
void
GenericSlicer
<
ElementType
,
Container
>::
reset
(
const
ContainerType
&
source
,
Container
<
ElementType
>
&
slice
){
setStartIndex
(
0
);
slice
(
source
,
slice
);
}
src/Wima/WaypointManager/GenericWaypointManager.h
View file @
0a9d836e
...
...
@@ -2,7 +2,7 @@
#include <iostream>
#include "
Generic
Slicer.h"
#include "Slicer.h"
namespace
WaypointManager
{
...
...
@@ -10,14 +10,13 @@ template<class WaypointType,
template
<
class
,
class
...
>
class
ContainerType
,
class
MissionItemList
,
class
SettingsType
>
class
GenericWaypointManager
class
GenericWaypointManager
:
public
Slicer
{
public:
typedef
GenericSlicer
<
WaypointType
,
ContainerType
>
Slicer
;
typedef
ContainerType
<
WaypointType
>
WaypointList
;
GenericWaypointManager
()
=
delete
;
GenericWaypointManager
(
S
licer
*
slicer
,
S
ettingsType
*
settings
);
GenericWaypointManager
(
SettingsType
*
settings
);
// Waypoint editing.
void
setWaypoints
(
const
WaypointList
&
waypoints
);
...
...
@@ -42,7 +41,6 @@ protected:
WaypointList
_waypoints
;
WaypointList
_slice
;
MissionItemList
_missionItems
;
Slicer
*
_slicer
;
SettingsType
*
_settings
;
};
...
...
@@ -54,12 +52,9 @@ template<class WaypointType,
GenericWaypointManager
<
WaypointType
,
ContainerType
,
MissionItemList
,
SettingsType
>::
GenericWaypointManager
(
Slicer
*
slicer
,
SettingsType
*
Settings
SettingsType
>::
GenericWaypointManager
(
SettingsType
*
Settings
)
:
_slicer
(
slicer
)
,
_settings
(
_settings
)
:
_settings
(
_settings
)
{}
template
<
class
WaypointType
,
...
...
src/Wima/WaypointManager/Slicer.cpp
0 → 100644
View file @
0a9d836e
#include "Slicer.h"
Slicer
::
Slicer
()
:
_idxValid
(
false
)
,
_atEnd
(
false
)
{}
void
Slicer
::
setOverlap
(
uint32_t
overlap
)
{
_idxValid
=
false
;
_overlap
=
overlap
;
}
void
Slicer
::
setN
(
uint32_t
N
)
{
_idxValid
=
false
;
_N
=
N
>
0
?
N
:
1
;
}
void
Slicer
::
setStartIndex
(
int
idxStart
)
{
_idxValid
=
false
;
_idxStart
=
idxStart
;
}
uint32_t
Slicer
::
overlap
()
{
return
_overlap
;
}
uint32_t
Slicer
::
N
()
{
return
_N
;
}
int
Slicer
::
startIndex
()
{
return
_idxStart
;
}
Slicer
&
Slicer
::
operator
=
(
const
Slicer
&
other
)
{
}
void
Slicer
::
_updateIdx
(
std
::
size_t
size
)
{
_idxValid
=
true
;
_atEnd
=
false
;
if
(
_idxStart
>=
long
(
size
)
-
1
)
{
_idxStart
=
long
(
size
)
-
1
;
_idxEnd
=
_idxStart
;
_idxNext
=
_idxStart
;
_atEnd
=
true
;
return
;
}
_idxStart
=
_idxStart
<
0
?
0
:
_idxStart
;
_idxEnd
=
_idxStart
+
_N
-
1
;
_idxEnd
=
_idxEnd
<
long
(
size
)
?
_idxEnd
:
size
-
1
;
_idxNext
=
_idxEnd
+
1
-
_overlap
;
_idxNext
=
_idxNext
<
0
?
0
:
_idxNext
;
_idxNext
=
_idxNext
<
long
(
size
)
?
_idxNext
:
size
-
1
;
_idxPrevious
=
_idxStart
-
1
+
_overlap
;
_idxPrevious
=
_idxPrevious
<
0
?
0
:
_idxPrevious
;
_idxPrevious
=
_idxPrevious
<
long
(
size
)
?
_idxPrevious
:
size
-
1
;
}
src/Wima/WaypointManager/Slicer.h
0 → 100644
View file @
0a9d836e
#pragma once
#include <assert.h>
#include <iostream>
#include "Utils.h"
//! @brief Base class for all waypoint managers.
class
Slicer
{
public:
Slicer
();
protected:
// Slicing.
template
<
class
Container1
,
class
Container2
>
void
update
(
const
Container1
&
source
,
Container2
&
slice
);
template
<
class
Container1
,
class
Container2
>
void
next
(
const
Container1
&
source
,
Container2
&
slice
);
template
<
class
Container1
,
class
Container2
>
void
previous
(
const
Container1
&
source
,
Container2
&
slice
);
template
<
class
Container1
,
class
Container2
>
void
reset
(
const
Container1
&
source
,
Container2
&
slice
);
public:
// Slicing parameters.
//! @brief Sets the overlap.
//!
//! @param overlap The number of overlapping vertices
//! between on and the next slice.
void
setOverlap
(
uint32_t
overlap
);
//! @brief Sets the number of vertices per slice.
//!
//! @param N The number of vertices per slice.
void
setN
(
std
::
uint32_t
N
);
//! @brief Sets the start index.
//!
//! @param idxStart The start index.
void
setStartIndex
(
int
idxStart
);
//! @return Returns the overlap.
uint32_t
overlap
();
//! @return Returns the number of vertices per slice N.
uint32_t
N
();
//! @return Returns the start index.
int
startIndex
();
Slicer
&
operator
=
(
const
Slicer
&
other
);
private:
void
_updateIdx
(
std
::
size_t
size
);
long
_idxStart
;
long
_idxEnd
;
long
_idxNext
;
long
_idxPrevious
;
uint32_t
_overlap
;
uint32_t
_N
;
bool
_idxValid
;
bool
_atEnd
;
};
template
<
class
Container1
,
class
Container2
>
void
Slicer
::
update
(
const
Container1
&
source
,
Container2
&
slice
){
if
(
!
_idxValid
)
_updateIdx
(
source
.
size
());
WaypointManager
::
Utils
::
extract
(
source
,
slice
,
_idxStart
,
_idxEnd
);
}
template
<
class
Container1
,
class
Container2
>
void
Slicer
::
next
(
const
Container1
&
source
,
Container2
&
slice
){
setStartIndex
(
_idxNext
);
update
(
source
,
slice
);
}
template
<
class
Container1
,
class
Container2
>
void
Slicer
::
previous
(
const
Container1
&
source
,
Container2
&
slice
){
setStartIndex
(
_idxPrevious
);
update
(
source
,
slice
);
}
template
<
class
Container1
,
class
Container2
>
void
Slicer
::
reset
(
const
Container1
&
source
,
Container2
&
slice
){
setStartIndex
(
0
);
update
(
source
,
slice
);
}
src/Wima/WaypointManager/Utils.h
View file @
0a9d836e
...
...
@@ -20,7 +20,7 @@ QVariant getCoordinate(const SimpleMissionItem* item);
/// extracts the coordinates stored in missionItems (list of MissionItems) and stores them in coordinateList.
template
<
class
CoordinateType
,
template
<
class
,
class
...
>
class
ContainerType
>
bool
extract
(
QmlObjectListModel
&
missionItems
,
bool
extract
(
const
QmlObjectListModel
&
missionItems
,
ContainerType
<
CoordinateType
>
&
coordinateList
,
std
::
size_t
startIndex
,
std
::
size_t
endIndex
)
...
...
@@ -59,7 +59,7 @@ bool extract(QmlObjectListModel &missionItems,
/// extracts the coordinates stored in missionItems (list of MissionItems) and stores them in coordinateList.
template
<
class
CoordinateType
,
template
<
class
,
class
...
>
class
ContainerType
>
bool
extract
(
QmlObjectListModel
&
missionItems
,
bool
extract
(
const
QmlObjectListModel
&
missionItems
,
ContainerType
<
CoordinateType
>
&
coordinateList
)
{
...
...
@@ -73,7 +73,7 @@ bool extract(QmlObjectListModel &missionItems,
/// extracts the coordinates stored in missionItems (list of MissionItems) and stores them in coordinateList.
template
<
class
CoordinateType
,
template
<
class
,
class
...
>
class
ContainerType
>
bool
extract
(
ContainerType
<
CoordinateType
>
&
source
,
bool
extract
(
const
ContainerType
<
CoordinateType
>
&
source
,
ContainerType
<
CoordinateType
>
&
destination
,
std
::
size_t
startIndex
,
std
::
size_t
endIndex
)
...
...
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