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
0397d607
Commit
0397d607
authored
Oct 15, 2020
by
Valentin Platzgummer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
nemointerface improved
parent
52b36170
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
87 additions
and
117 deletions
+87
-117
qgroundcontrol.pro
qgroundcontrol.pro
+1
-5
WimaArea.cc
src/Wima/Geometry/WimaArea.cc
+1
-1
WimaMeasurementArea.cc
src/Wima/Geometry/WimaMeasurementArea.cc
+0
-37
WimaMeasurementArea.h
src/Wima/Geometry/WimaMeasurementArea.h
+6
-13
NemoInterface.cpp
src/Wima/Snake/NemoInterface.cpp
+59
-52
snake.cpp
src/Wima/Snake/snake.cpp
+9
-2
snake.h
src/Wima/Snake/snake.h
+4
-2
WimaPlaner.cc
src/Wima/WimaPlaner.cc
+7
-4
WimaPlaner.h
src/Wima/WimaPlaner.h
+0
-1
No files found.
qgroundcontrol.pro
View file @
0397d607
...
@@ -29,20 +29,16 @@ DebugBuild {
...
@@ -29,20 +29,16 @@ DebugBuild {
DESTDIR
=
$$
{
OUT_PWD
}
/
debug
DESTDIR
=
$$
{
OUT_PWD
}
/
debug
DEFINES
+=
DEBUG
DEFINES
+=
DEBUG
#
DEFINES
+=
SNAKE_SHOW_TIME
#
DEFINES
+=
SNAKE_SHOW_TIME
#
DEFINES
+=
DEBUG_SRTL
#
DEFINES
+=
SNAKE_DEBUG
#
DEFINES
+=
SNAKE_DEBUG
DEFINES
+=
SNAKE_SHOW_TIME
DEFINES
+=
SNAKE_SHOW_TIME
DEFINES
+=
SHOW_CIRCULAR_SURVEY_TIME
DEFINES
+=
DEBUG_CIRCULAR_SURVEY
DEFINES
+=
DEBUG_CIRCULAR_SURVEY
#
DEFINES
+=
ROS_BRIDGE_DEBUG
DEFINES
+=
ROS_BRIDGE_DEBUG
}
}
else
{
else
{
DESTDIR
=
$$
{
OUT_PWD
}
/
release
DESTDIR
=
$$
{
OUT_PWD
}
/
release
#
DEFINES
+=
ROS_BRIDGE_DEBUG
#
DEFINES
+=
ROS_BRIDGE_DEBUG
DEFINES
+=
SHOW_CIRCULAR_SURVEY_TIME
DEFINES
+=
SNAKE_SHOW_TIME
DEFINES
+=
SNAKE_SHOW_TIME
#
DEFINES
+=
SNAKE_DEBUG
#
DEFINES
+=
SNAKE_DEBUG
#
DEFINES
+=
DEBUG_SRTL
DEFINES
+=
NDEBUG
DEFINES
+=
NDEBUG
}
}
...
...
src/Wima/Geometry/WimaArea.cc
View file @
0397d607
...
@@ -70,7 +70,7 @@ WimaArea::WimaArea(const WimaArea &other, QObject *parent)
...
@@ -70,7 +70,7 @@ WimaArea::WimaArea(const WimaArea &other, QObject *parent)
*/
*/
WimaArea
&
WimaArea
::
operator
=
(
const
WimaArea
&
other
)
{
WimaArea
&
WimaArea
::
operator
=
(
const
WimaArea
&
other
)
{
QGCMapPolygon
::
operator
=
(
other
);
QGCMapPolygon
::
operator
=
(
other
);
this
->
_maxAltitude
=
other
.
maxAltitude
(
);
this
->
setMaxAltitude
(
other
.
_maxAltitude
);
this
->
setPath
(
other
.
path
());
this
->
setPath
(
other
.
path
());
return
*
this
;
return
*
this
;
...
...
src/Wima/Geometry/WimaMeasurementArea.cc
View file @
0397d607
...
@@ -58,8 +58,6 @@ const char *WimaMeasurementArea::settingsGroup = "MeasurementArea";
...
@@ -58,8 +58,6 @@ const char *WimaMeasurementArea::settingsGroup = "MeasurementArea";
const
char
*
WimaMeasurementArea
::
tileHeightName
=
"TileHeight"
;
const
char
*
WimaMeasurementArea
::
tileHeightName
=
"TileHeight"
;
const
char
*
WimaMeasurementArea
::
tileWidthName
=
"TileWidth"
;
const
char
*
WimaMeasurementArea
::
tileWidthName
=
"TileWidth"
;
const
char
*
WimaMeasurementArea
::
minTileAreaName
=
"MinTileArea"
;
const
char
*
WimaMeasurementArea
::
minTileAreaName
=
"MinTileArea"
;
const
char
*
WimaMeasurementArea
::
transectDistanceName
=
"TransectDistance"
;
const
char
*
WimaMeasurementArea
::
minTransectLengthName
=
"MinTransectLength"
;
const
char
*
WimaMeasurementArea
::
showTilesName
=
"ShowTiles"
;
const
char
*
WimaMeasurementArea
::
showTilesName
=
"ShowTiles"
;
const
char
*
WimaMeasurementArea
::
WimaMeasurementAreaName
=
"Measurement Area"
;
const
char
*
WimaMeasurementArea
::
WimaMeasurementAreaName
=
"Measurement Area"
;
...
@@ -76,12 +74,6 @@ WimaMeasurementArea::WimaMeasurementArea(QObject *parent)
...
@@ -76,12 +74,6 @@ WimaMeasurementArea::WimaMeasurementArea(QObject *parent)
this
/* QObject parent */
)),
this
/* QObject parent */
)),
_minTileArea
(
SettingsFact
(
settingsGroup
,
_metaDataMap
[
minTileAreaName
],
_minTileArea
(
SettingsFact
(
settingsGroup
,
_metaDataMap
[
minTileAreaName
],
this
/* QObject parent */
)),
this
/* QObject parent */
)),
_transectDistance
(
SettingsFact
(
settingsGroup
,
_metaDataMap
[
transectDistanceName
],
this
/* QObject parent */
)),
_minTransectLength
(
SettingsFact
(
settingsGroup
,
_metaDataMap
[
minTransectLengthName
],
this
/* QObject parent */
)),
_showTiles
(
SettingsFact
(
settingsGroup
,
_metaDataMap
[
showTilesName
],
_showTiles
(
SettingsFact
(
settingsGroup
,
_metaDataMap
[
showTilesName
],
this
/* QObject parent */
)),
this
/* QObject parent */
)),
_state
(
STATE
::
IDLE
)
{
_state
(
STATE
::
IDLE
)
{
...
@@ -100,12 +92,6 @@ WimaMeasurementArea::WimaMeasurementArea(const WimaMeasurementArea &other,
...
@@ -100,12 +92,6 @@ WimaMeasurementArea::WimaMeasurementArea(const WimaMeasurementArea &other,
this
/* QObject parent */
)),
this
/* QObject parent */
)),
_minTileArea
(
SettingsFact
(
settingsGroup
,
_metaDataMap
[
minTileAreaName
],
_minTileArea
(
SettingsFact
(
settingsGroup
,
_metaDataMap
[
minTileAreaName
],
this
/* QObject parent */
)),
this
/* QObject parent */
)),
_transectDistance
(
SettingsFact
(
settingsGroup
,
_metaDataMap
[
transectDistanceName
],
this
/* QObject parent */
)),
_minTransectLength
(
SettingsFact
(
settingsGroup
,
_metaDataMap
[
minTransectLengthName
],
this
/* QObject parent */
)),
_showTiles
(
SettingsFact
(
settingsGroup
,
_metaDataMap
[
showTilesName
],
_showTiles
(
SettingsFact
(
settingsGroup
,
_metaDataMap
[
showTilesName
],
this
/* QObject parent */
)),
this
/* QObject parent */
)),
_state
(
STATE
::
IDLE
)
{
_state
(
STATE
::
IDLE
)
{
...
@@ -120,7 +106,6 @@ WimaMeasurementArea::WimaMeasurementArea(const WimaMeasurementArea &other,
...
@@ -120,7 +106,6 @@ WimaMeasurementArea::WimaMeasurementArea(const WimaMeasurementArea &other,
WimaMeasurementArea
&
WimaMeasurementArea
::
WimaMeasurementArea
&
WimaMeasurementArea
::
operator
=
(
const
WimaMeasurementArea
&
other
)
{
operator
=
(
const
WimaMeasurementArea
&
other
)
{
WimaArea
::
operator
=
(
other
);
WimaArea
::
operator
=
(
other
);
return
*
this
;
return
*
this
;
}
}
...
@@ -140,10 +125,6 @@ Fact *WimaMeasurementArea::tileWidth() { return &_tileWidth; }
...
@@ -140,10 +125,6 @@ Fact *WimaMeasurementArea::tileWidth() { return &_tileWidth; }
Fact
*
WimaMeasurementArea
::
minTileArea
()
{
return
&
_minTileArea
;
}
Fact
*
WimaMeasurementArea
::
minTileArea
()
{
return
&
_minTileArea
;
}
Fact
*
WimaMeasurementArea
::
transectDistance
()
{
return
&
_transectDistance
;
}
Fact
*
WimaMeasurementArea
::
minTransectLength
()
{
return
&
_minTransectLength
;
}
Fact
*
WimaMeasurementArea
::
showTiles
()
{
return
&
_showTiles
;
}
Fact
*
WimaMeasurementArea
::
showTiles
()
{
return
&
_showTiles
;
}
QmlObjectListModel
*
WimaMeasurementArea
::
tiles
()
{
QmlObjectListModel
*
WimaMeasurementArea
::
tiles
()
{
...
@@ -179,8 +160,6 @@ void WimaMeasurementArea::saveToJson(QJsonObject &json) {
...
@@ -179,8 +160,6 @@ void WimaMeasurementArea::saveToJson(QJsonObject &json) {
json
[
tileHeightName
]
=
_tileHeight
.
rawValue
().
toDouble
();
json
[
tileHeightName
]
=
_tileHeight
.
rawValue
().
toDouble
();
json
[
tileWidthName
]
=
_tileWidth
.
rawValue
().
toDouble
();
json
[
tileWidthName
]
=
_tileWidth
.
rawValue
().
toDouble
();
json
[
minTileAreaName
]
=
_minTileArea
.
rawValue
().
toDouble
();
json
[
minTileAreaName
]
=
_minTileArea
.
rawValue
().
toDouble
();
json
[
transectDistanceName
]
=
_transectDistance
.
rawValue
().
toDouble
();
json
[
minTransectLengthName
]
=
_minTransectLength
.
rawValue
().
toDouble
();
json
[
showTilesName
]
=
_showTiles
.
rawValue
().
toBool
();
json
[
showTilesName
]
=
_showTiles
.
rawValue
().
toBool
();
json
[
areaTypeName
]
=
WimaMeasurementAreaName
;
json
[
areaTypeName
]
=
WimaMeasurementAreaName
;
}
}
...
@@ -211,22 +190,6 @@ bool WimaMeasurementArea::loadFromJson(const QJsonObject &json,
...
@@ -211,22 +190,6 @@ bool WimaMeasurementArea::loadFromJson(const QJsonObject &json,
retVal
=
false
;
retVal
=
false
;
}
}
if
(
json
.
contains
(
transectDistanceName
)
&&
json
[
transectDistanceName
].
isDouble
())
{
_transectDistance
.
setRawValue
(
json
[
transectDistanceName
].
toDouble
());
}
else
{
errorString
.
append
(
tr
(
"Could not load transect distance!
\n
"
));
retVal
=
false
;
}
if
(
json
.
contains
(
minTransectLengthName
)
&&
json
[
minTransectLengthName
].
isDouble
())
{
_minTransectLength
.
setRawValue
(
json
[
minTransectLengthName
].
toDouble
());
}
else
{
errorString
.
append
(
tr
(
"Could not load minimal transect length!
\n
"
));
retVal
=
false
;
}
if
(
json
.
contains
(
showTilesName
)
&&
json
[
showTilesName
].
isBool
())
{
if
(
json
.
contains
(
showTilesName
)
&&
json
[
showTilesName
].
isBool
())
{
_showTiles
.
setRawValue
(
json
[
showTilesName
].
toBool
());
_showTiles
.
setRawValue
(
json
[
showTilesName
].
toBool
());
}
else
{
}
else
{
...
...
src/Wima/Geometry/WimaMeasurementArea.h
View file @
0397d607
...
@@ -44,8 +44,6 @@ public:
...
@@ -44,8 +44,6 @@ public:
Q_PROPERTY
(
Fact
*
tileHeight
READ
tileHeight
CONSTANT
)
Q_PROPERTY
(
Fact
*
tileHeight
READ
tileHeight
CONSTANT
)
Q_PROPERTY
(
Fact
*
tileWidth
READ
tileWidth
CONSTANT
)
Q_PROPERTY
(
Fact
*
tileWidth
READ
tileWidth
CONSTANT
)
Q_PROPERTY
(
Fact
*
minTileArea
READ
minTileArea
CONSTANT
)
Q_PROPERTY
(
Fact
*
minTileArea
READ
minTileArea
CONSTANT
)
Q_PROPERTY
(
Fact
*
transectDistance
READ
transectDistance
CONSTANT
)
Q_PROPERTY
(
Fact
*
minTransectLength
READ
minTransectLength
CONSTANT
)
Q_PROPERTY
(
Fact
*
showTiles
READ
showTiles
CONSTANT
)
Q_PROPERTY
(
Fact
*
showTiles
READ
showTiles
CONSTANT
)
Q_PROPERTY
(
QmlObjectListModel
*
tiles
READ
tiles
NOTIFY
tilesChanged
)
Q_PROPERTY
(
QmlObjectListModel
*
tiles
READ
tiles
NOTIFY
tilesChanged
)
Q_PROPERTY
(
int
maxTiles
READ
maxTiles
NOTIFY
maxTilesChanged
)
Q_PROPERTY
(
int
maxTiles
READ
maxTiles
NOTIFY
maxTilesChanged
)
...
@@ -55,11 +53,10 @@ public:
...
@@ -55,11 +53,10 @@ public:
QString
mapVisualQML
(
void
)
const
;
QString
mapVisualQML
(
void
)
const
;
QString
editorQML
(
void
)
const
;
QString
editorQML
(
void
)
const
;
// Property getters.
Fact
*
tileHeight
();
Fact
*
tileHeight
();
Fact
*
tileWidth
();
Fact
*
tileWidth
();
Fact
*
minTileArea
();
Fact
*
minTileArea
();
Fact
*
transectDistance
();
Fact
*
minTransectLength
();
Fact
*
showTiles
();
Fact
*
showTiles
();
QmlObjectListModel
*
tiles
();
QmlObjectListModel
*
tiles
();
const
QVector
<
int
>
&
progress
()
const
;
const
QVector
<
int
>
&
progress
()
const
;
...
@@ -83,8 +80,6 @@ public:
...
@@ -83,8 +80,6 @@ public:
static
const
char
*
tileHeightName
;
static
const
char
*
tileHeightName
;
static
const
char
*
tileWidthName
;
static
const
char
*
tileWidthName
;
static
const
char
*
minTileAreaName
;
static
const
char
*
minTileAreaName
;
static
const
char
*
transectDistanceName
;
static
const
char
*
minTransectLengthName
;
static
const
char
*
showTilesName
;
static
const
char
*
showTilesName
;
static
const
char
*
WimaMeasurementAreaName
;
static
const
char
*
WimaMeasurementAreaName
;
...
@@ -93,6 +88,7 @@ signals:
...
@@ -93,6 +88,7 @@ signals:
void
maxTilesChanged
();
void
maxTilesChanged
();
void
progressChanged
();
void
progressChanged
();
void
progressAccepted
();
void
progressAccepted
();
void
progressNotAccepted
();
void
readyChanged
();
void
readyChanged
();
public
slots
:
public
slots
:
...
@@ -114,17 +110,14 @@ private:
...
@@ -114,17 +110,14 @@ private:
SettingsFact
_tileHeight
;
SettingsFact
_tileHeight
;
SettingsFact
_tileWidth
;
SettingsFact
_tileWidth
;
SettingsFact
_minTileArea
;
SettingsFact
_minTileArea
;
SettingsFact
_transectDistance
;
SettingsFact
_minTransectLength
;
SettingsFact
_showTiles
;
SettingsFact
_showTiles
;
// Tile stuff.
// Tile stuff.
QTimer
_timer
;
mutable
QTimer
_timer
;
using
DataPtr
=
std
::
shared_ptr
<
TileData
>
;
using
DataPtr
=
std
::
shared_ptr
<
TileData
>
;
TileData
_tileData
;
mutable
TileData
_tileData
;
QFutureWatcher
<
DataPtr
>
_watcher
;
mutable
QFutureWatcher
<
DataPtr
>
_watcher
;
mutable
STATE
_state
;
STATE
_state
;
QVector
<
int
>
_progress
;
QVector
<
int
>
_progress
;
};
};
src/Wima/Snake/NemoInterface.cpp
View file @
0397d607
...
@@ -55,7 +55,7 @@ public:
...
@@ -55,7 +55,7 @@ public:
bool
running
();
bool
running
();
private:
private:
bool
doTopicServiceSetup
();
void
doTopicServiceSetup
();
void
loop
();
void
loop
();
static
STATUS
heartbeatToStatus
(
static
STATUS
heartbeatToStatus
(
const
ros_bridge
::
messages
::
nemo_msgs
::
heartbeat
::
Heartbeat
&
hb
);
const
ros_bridge
::
messages
::
nemo_msgs
::
heartbeat
::
Heartbeat
&
hb
);
...
@@ -69,6 +69,7 @@ private:
...
@@ -69,6 +69,7 @@ private:
//! \pre this->ENUOriginMutex must be locked
//! \pre this->ENUOriginMutex must be locked
//!
//!
void
publishENUOrigin
();
void
publishENUOrigin
();
bool
setStatus
(
NemoInterface
::
STATUS
s
);
// Data.
// Data.
SnakeTilesLocal
tilesENU
;
SnakeTilesLocal
tilesENU
;
...
@@ -77,9 +78,9 @@ private:
...
@@ -77,9 +78,9 @@ private:
mutable
std
::
shared_timed_mutex
ENUOriginMutex
;
mutable
std
::
shared_timed_mutex
ENUOriginMutex
;
QNemoProgress
qProgress
;
QNemoProgress
qProgress
;
mutable
std
::
shared_timed_mutex
progressMutex
;
mutable
std
::
shared_timed_mutex
progressMutex
;
NemoInterface
::
STATUS
status_
;
TimePoint
nextTimeout
;
TimePoint
nextTimeout
;
mutable
std
::
shared_timed_mutex
statusMutex
;
mutable
std
::
shared_timed_mutex
timeoutMutex
;
std
::
atomic
<
NemoInterface
::
STATUS
>
status_
;
// Not protected data.
// Not protected data.
TileData
tileData
;
TileData
tileData
;
...
@@ -106,7 +107,7 @@ StatusMap statusMap{
...
@@ -106,7 +107,7 @@ StatusMap statusMap{
NemoInterface
::
STATUS
::
WEBSOCKET_DETECTED
,
"Websocket Detected"
)};
NemoInterface
::
STATUS
::
WEBSOCKET_DETECTED
,
"Websocket Detected"
)};
NemoInterface
::
Impl
::
Impl
(
NemoInterface
*
p
)
NemoInterface
::
Impl
::
Impl
(
NemoInterface
*
p
)
:
status_
(
STATUS
::
NOT_CONNECTED
),
nextTimeout
(
TimePoint
::
max
()
),
:
nextTimeout
(
TimePoint
::
max
()),
status_
(
STATUS
::
NOT_CONNECTED
),
running_
(
false
),
topicServiceSetupDone
(
false
),
parent
(
p
)
{
running_
(
false
),
topicServiceSetupDone
(
false
),
parent
(
p
)
{
// ROS Bridge.
// ROS Bridge.
...
@@ -158,25 +159,37 @@ void NemoInterface::Impl::setTileData(const TileData &tileData) {
...
@@ -158,25 +159,37 @@ void NemoInterface::Impl::setTileData(const TileData &tileData) {
const
auto
*
tile
=
qobject_cast
<
const
SnakeTile
*>
(
obj
);
const
auto
*
tile
=
qobject_cast
<
const
SnakeTile
*>
(
obj
);
if
(
tile
!=
nullptr
)
{
if
(
tile
!=
nullptr
)
{
if
(
tile
->
coordinateList
().
size
()
>
0
)
{
if
(
tile
->
coordinateList
().
size
()
>
0
)
{
this
->
ENUOrigin
=
tile
->
coordinateList
().
first
();
if
(
tile
->
coordinateList
().
first
().
isValid
())
{
const
auto
&
origin
=
this
->
ENUOrigin
;
this
->
ENUOrigin
=
tile
->
coordinateList
().
first
();
this
->
tilesENU
.
polygons
().
clear
();
const
auto
&
origin
=
this
->
ENUOrigin
;
for
(
int
i
=
0
;
i
<
tileData
.
tiles
.
count
();
++
i
)
{
this
->
tilesENU
.
polygons
().
clear
();
obj
=
tileData
.
tiles
.
get
(
i
);
for
(
int
i
=
0
;
i
<
tileData
.
tiles
.
count
();
++
i
)
{
tile
=
qobject_cast
<
const
SnakeTile
*>
(
obj
);
obj
=
tileData
.
tiles
.
get
(
i
);
if
(
tile
!=
nullptr
)
{
tile
=
qobject_cast
<
const
SnakeTile
*>
(
obj
);
SnakeTileLocal
tileENU
;
if
(
tile
!=
nullptr
)
{
snake
::
areaToEnu
(
origin
,
tile
->
coordinateList
(),
tileENU
.
path
());
SnakeTileLocal
tileENU
;
this
->
tilesENU
.
polygons
().
push_back
(
std
::
move
(
tileENU
));
snake
::
areaToEnu
(
origin
,
tile
->
coordinateList
(),
tileENU
.
path
());
}
else
{
this
->
tilesENU
.
polygons
().
push_back
(
std
::
move
(
tileENU
));
qWarning
()
<<
"NemoInterface::Impl::setTileData(): nullptr."
;
}
else
{
break
;
qWarning
()
<<
"NemoInterface::Impl::setTileData(): nullptr."
;
break
;
}
}
}
}
else
{
qWarning
()
<<
"NemoInterface::Impl::setTileData(): Origin invalid."
;
}
}
}
else
{
}
else
{
qWarning
()
<<
"NemoInterface::Impl::setTileData():
nullptr
."
;
qWarning
()
<<
"NemoInterface::Impl::setTileData():
tile empty
."
;
}
}
}
}
}
else
{
this
->
tileData
.
clear
();
std
::
lock
(
this
->
ENUOriginMutex
,
this
->
tilesENUMutex
);
UniqueLock
lk1
(
this
->
ENUOriginMutex
,
std
::
adopt_lock
);
UniqueLock
lk2
(
this
->
tilesENUMutex
,
std
::
adopt_lock
);
this
->
ENUOrigin
=
QGeoCoordinate
(
0
,
0
,
0
);
this
->
tilesENU
=
SnakeTilesLocal
();
}
}
}
}
...
@@ -196,10 +209,7 @@ void NemoInterface::Impl::publishTileData() {
...
@@ -196,10 +209,7 @@ void NemoInterface::Impl::publishTileData() {
}
}
}
}
NemoInterface
::
STATUS
NemoInterface
::
Impl
::
status
()
{
NemoInterface
::
STATUS
NemoInterface
::
Impl
::
status
()
{
return
status_
.
load
();
}
SharedLock
lk
(
this
->
statusMutex
);
return
status_
;
}
QVector
<
int
>
NemoInterface
::
Impl
::
progress
()
{
QVector
<
int
>
NemoInterface
::
Impl
::
progress
()
{
SharedLock
lk
(
this
->
progressMutex
);
SharedLock
lk
(
this
->
progressMutex
);
...
@@ -208,15 +218,12 @@ QVector<int> NemoInterface::Impl::progress() {
...
@@ -208,15 +218,12 @@ QVector<int> NemoInterface::Impl::progress() {
bool
NemoInterface
::
Impl
::
running
()
{
return
this
->
running_
.
load
();
}
bool
NemoInterface
::
Impl
::
running
()
{
return
this
->
running_
.
load
();
}
bool
NemoInterface
::
Impl
::
doTopicServiceSetup
()
{
void
NemoInterface
::
Impl
::
doTopicServiceSetup
()
{
using
namespace
ros_bridge
::
messages
;
using
namespace
ros_bridge
::
messages
;
// snake tiles.
// snake tiles.
{
{
SharedLock
lk
(
this
->
tilesENUMutex
);
SharedLock
lk
(
this
->
tilesENUMutex
);
if
(
this
->
tilesENU
.
polygons
().
size
()
==
0
)
return
false
;
this
->
pRosBridge
->
advertiseTopic
(
this
->
pRosBridge
->
advertiseTopic
(
"/snake/tiles"
,
"/snake/tiles"
,
jsk_recognition_msgs
::
polygon_array
::
messageType
().
c_str
());
jsk_recognition_msgs
::
polygon_array
::
messageType
().
c_str
());
...
@@ -225,7 +232,6 @@ bool NemoInterface::Impl::doTopicServiceSetup() {
...
@@ -225,7 +232,6 @@ bool NemoInterface::Impl::doTopicServiceSetup() {
// snake origin.
// snake origin.
{
{
SharedLock
lk
(
this
->
ENUOriginMutex
);
SharedLock
lk
(
this
->
ENUOriginMutex
);
this
->
pRosBridge
->
advertiseTopic
(
this
->
pRosBridge
->
advertiseTopic
(
"/snake/origin"
,
geographic_msgs
::
geo_point
::
messageType
().
c_str
());
"/snake/origin"
,
geographic_msgs
::
geo_point
::
messageType
().
c_str
());
}
}
...
@@ -261,21 +267,20 @@ bool NemoInterface::Impl::doTopicServiceSetup() {
...
@@ -261,21 +267,20 @@ bool NemoInterface::Impl::doTopicServiceSetup() {
/* callback */
[
this
](
JsonDocUPtr
pDoc
)
{
/* callback */
[
this
](
JsonDocUPtr
pDoc
)
{
// auto start = std::chrono::high_resolution_clock::now();
// auto start = std::chrono::high_resolution_clock::now();
nemo_msgs
::
heartbeat
::
Heartbeat
heartbeatMsg
;
nemo_msgs
::
heartbeat
::
Heartbeat
heartbeatMsg
;
UniqueLock
lk
(
this
->
statusMutex
);
if
(
!
nemo_msgs
::
heartbeat
::
fromJson
(
*
pDoc
,
heartbeatMsg
))
{
if
(
!
nemo_msgs
::
heartbeat
::
fromJson
(
*
pDoc
,
heartbeatMsg
))
{
status_
=
STATUS
::
INVALID_HEARTBEAT
;
this
->
setStatus
(
STATUS
::
INVALID_HEARTBEAT
)
;
}
else
{
}
else
{
status_
=
heartbeatToStatus
(
heartbeatMsg
);
this
->
setStatus
(
heartbeatToStatus
(
heartbeatMsg
)
);
}
}
if
(
status_
==
STATUS
::
INVALID_HEARTBEAT
)
{
if
(
this
->
status_
==
STATUS
::
INVALID_HEARTBEAT
)
{
UniqueLock
lk
(
this
->
timeoutMutex
);
this
->
nextTimeout
=
TimePoint
::
max
();
this
->
nextTimeout
=
TimePoint
::
max
();
}
else
if
(
status_
==
STATUS
::
HEARTBEAT_DETECTED
)
{
}
else
if
(
this
->
status_
==
STATUS
::
HEARTBEAT_DETECTED
)
{
UniqueLock
lk
(
this
->
timeoutMutex
);
this
->
nextTimeout
=
this
->
nextTimeout
=
std
::
chrono
::
high_resolution_clock
::
now
()
+
timeoutInterval
;
std
::
chrono
::
high_resolution_clock
::
now
()
+
timeoutInterval
;
}
}
lk
.
unlock
();
emit
this
->
parent
->
statusChanged
();
// auto delta =
// auto delta =
// std::chrono::duration_cast<std::chrono::milliseconds>(
// std::chrono::duration_cast<std::chrono::milliseconds>(
// std::chrono::high_resolution_clock::now() - start);
// std::chrono::high_resolution_clock::now() - start);
...
@@ -320,8 +325,6 @@ bool NemoInterface::Impl::doTopicServiceSetup() {
...
@@ -320,8 +325,6 @@ bool NemoInterface::Impl::doTopicServiceSetup() {
pDoc
->
AddMember
(
"tiles"
,
jSnakeTiles
,
pDoc
->
GetAllocator
());
pDoc
->
AddMember
(
"tiles"
,
jSnakeTiles
,
pDoc
->
GetAllocator
());
return
pDoc
;
return
pDoc
;
});
});
return
true
;
}
}
void
NemoInterface
::
Impl
::
loop
()
{
void
NemoInterface
::
Impl
::
loop
()
{
...
@@ -329,25 +332,20 @@ void NemoInterface::Impl::loop() {
...
@@ -329,25 +332,20 @@ void NemoInterface::Impl::loop() {
if
(
this
->
running_
)
{
if
(
this
->
running_
)
{
if
(
!
this
->
pRosBridge
->
isRunning
())
{
if
(
!
this
->
pRosBridge
->
isRunning
())
{
this
->
pRosBridge
->
start
();
this
->
pRosBridge
->
start
();
this
->
loop
();
}
else
if
(
this
->
pRosBridge
->
isRunning
()
&&
this
->
pRosBridge
->
connected
()
&&
}
else
if
(
this
->
pRosBridge
->
isRunning
()
&&
this
->
pRosBridge
->
connected
()
&&
!
this
->
topicServiceSetupDone
)
{
!
this
->
topicServiceSetupDone
)
{
if
(
this
->
doTopicServiceSetup
())
{
this
->
doTopicServiceSetup
();
this
->
topicServiceSetupDone
=
true
;
this
->
topicServiceSetupDone
=
true
;
UniqueLock
lk
(
this
->
statusMutex
);
this
->
status_
=
STATUS
::
WEBSOCKET_DETECTED
;
this
->
setStatus
(
STATUS
::
WEBSOCKET_DETECTED
);
lk
.
unlock
();
emit
this
->
parent
->
statusChanged
();
}
}
else
if
(
this
->
pRosBridge
->
isRunning
()
&&
}
else
if
(
this
->
pRosBridge
->
isRunning
()
&&
!
this
->
pRosBridge
->
connected
()
&&
this
->
topicServiceSetupDone
)
{
!
this
->
pRosBridge
->
connected
()
&&
this
->
topicServiceSetupDone
)
{
this
->
pRosBridge
->
reset
();
this
->
pRosBridge
->
reset
();
this
->
pRosBridge
->
start
();
this
->
pRosBridge
->
start
();
this
->
topicServiceSetupDone
=
false
;
this
->
topicServiceSetupDone
=
false
;
UniqueLock
lk
(
this
->
statusMutex
);
this
->
setStatus
(
STATUS
::
TIMEOUT
);
this
->
status_
=
STATUS
::
TIMEOUT
;
lk
.
unlock
();
emit
this
->
parent
->
statusChanged
();
}
}
}
else
if
(
this
->
pRosBridge
->
isRunning
())
{
}
else
if
(
this
->
pRosBridge
->
isRunning
())
{
this
->
pRosBridge
->
reset
();
this
->
pRosBridge
->
reset
();
...
@@ -356,16 +354,15 @@ void NemoInterface::Impl::loop() {
...
@@ -356,16 +354,15 @@ void NemoInterface::Impl::loop() {
// Check if heartbeat timeout occured.
// Check if heartbeat timeout occured.
if
(
this
->
running_
&&
this
->
topicServiceSetupDone
)
{
if
(
this
->
running_
&&
this
->
topicServiceSetupDone
)
{
UniqueLock
lk
(
this
->
status
Mutex
);
UniqueLock
lk
(
this
->
timeout
Mutex
);
if
(
this
->
nextTimeout
!=
TimePoint
::
max
()
&&
if
(
this
->
nextTimeout
!=
TimePoint
::
max
()
&&
this
->
nextTimeout
<
std
::
chrono
::
high_resolution_clock
::
now
())
{
this
->
nextTimeout
<
std
::
chrono
::
high_resolution_clock
::
now
())
{
lk
.
unlock
();
if
(
this
->
pRosBridge
->
isRunning
()
&&
this
->
pRosBridge
->
connected
())
{
if
(
this
->
pRosBridge
->
isRunning
()
&&
this
->
pRosBridge
->
connected
())
{
this
->
s
tatus_
=
STATUS
::
WEBSOCKET_DETECTED
;
this
->
s
etStatus
(
STATUS
::
WEBSOCKET_DETECTED
)
;
}
else
{
}
else
{
this
->
s
tatus_
=
STATUS
::
TIMEOUT
;
this
->
s
etStatus
(
STATUS
::
TIMEOUT
)
;
}
}
lk
.
unlock
();
emit
this
->
parent
->
statusChanged
();
}
}
}
}
}
}
...
@@ -400,6 +397,16 @@ void NemoInterface::Impl::publishENUOrigin() {
...
@@ -400,6 +397,16 @@ void NemoInterface::Impl::publishENUOrigin() {
this
->
pRosBridge
->
publish
(
std
::
move
(
jOrigin
),
"/snake/origin"
);
this
->
pRosBridge
->
publish
(
std
::
move
(
jOrigin
),
"/snake/origin"
);
}
}
bool
NemoInterface
::
Impl
::
setStatus
(
NemoInterface
::
STATUS
s
)
{
if
(
s
!=
this
->
status_
)
{
this
->
status_
=
s
;
emit
this
->
parent
->
statusChanged
();
return
true
;
}
else
{
return
false
;
}
}
// ===============================================================
// ===============================================================
// NemoInterface
// NemoInterface
NemoInterface
::
NemoInterface
(
QObject
*
parent
)
NemoInterface
::
NemoInterface
(
QObject
*
parent
)
...
...
src/Wima/Snake/snake.cpp
View file @
0397d607
...
@@ -1143,10 +1143,17 @@ bool shortestPathFromGraph(const Matrix<double> &graph, const size_t startIndex,
...
@@ -1143,10 +1143,17 @@ bool shortestPathFromGraph(const Matrix<double> &graph, const size_t startIndex,
}
// namespace snake
}
// namespace snake
bool
boost
::
geometry
::
model
::
operator
==
(
snake
::
FPoint
p1
,
snake
::
FPoint
p2
)
{
bool
boost
::
geometry
::
model
::
operator
==
(
snake
::
FPoint
&
p1
,
snake
::
FPoint
&
p2
)
{
return
(
p1
.
get
<
0
>
()
==
p2
.
get
<
0
>
())
&&
(
p1
.
get
<
1
>
()
==
p2
.
get
<
1
>
());
return
(
p1
.
get
<
0
>
()
==
p2
.
get
<
0
>
())
&&
(
p1
.
get
<
1
>
()
==
p2
.
get
<
1
>
());
}
}
bool
boost
::
geometry
::
model
::
operator
!=
(
snake
::
FPoint
p1
,
snake
::
FPoint
p2
)
{
bool
boost
::
geometry
::
model
::
operator
!=
(
snake
::
FPoint
&
p1
,
snake
::
FPoint
&
p2
)
{
return
!
(
p1
==
p2
);
}
bool
boost
::
geometry
::
model
::
operator
==
(
snake
::
IPoint
&
p1
,
snake
::
IPoint
&
p2
)
{
return
(
p1
.
get
<
0
>
()
==
p2
.
get
<
0
>
())
&&
(
p1
.
get
<
1
>
()
==
p2
.
get
<
1
>
());
}
bool
boost
::
geometry
::
model
::
operator
!=
(
snake
::
IPoint
&
p1
,
snake
::
IPoint
&
p2
)
{
return
!
(
p1
==
p2
);
return
!
(
p1
==
p2
);
}
}
src/Wima/Snake/snake.h
View file @
0397d607
...
@@ -258,8 +258,10 @@ namespace boost {
...
@@ -258,8 +258,10 @@ namespace boost {
namespace
geometry
{
namespace
geometry
{
namespace
model
{
namespace
model
{
bool
operator
==
(
snake
::
FPoint
p1
,
snake
::
FPoint
p2
);
bool
operator
==
(
snake
::
FPoint
&
p1
,
snake
::
FPoint
&
p2
);
bool
operator
!=
(
snake
::
FPoint
p1
,
snake
::
FPoint
p2
);
bool
operator
!=
(
snake
::
FPoint
&
p1
,
snake
::
FPoint
&
p2
);
bool
operator
==
(
snake
::
IPoint
&
p1
,
snake
::
IPoint
&
p2
);
bool
operator
!=
(
snake
::
IPoint
&
p1
,
snake
::
IPoint
&
p2
);
}
// namespace model
}
// namespace model
}
// namespace geometry
}
// namespace geometry
...
...
src/Wima/WimaPlaner.cc
View file @
0397d607
...
@@ -160,8 +160,6 @@ bool WimaPlaner::readyForSynchronization() {
...
@@ -160,8 +160,6 @@ bool WimaPlaner::readyForSynchronization() {
bool
WimaPlaner
::
progressLocked
()
{
return
this
->
_progressLocked
;
}
bool
WimaPlaner
::
progressLocked
()
{
return
this
->
_progressLocked
;
}
WimaPlaner
*
WimaPlaner
::
thisPointer
()
{
return
this
;
}
void
WimaPlaner
::
removeArea
(
int
index
)
{
void
WimaPlaner
::
removeArea
(
int
index
)
{
if
(
index
>=
0
&&
index
<
_visualItems
.
count
())
{
if
(
index
>=
0
&&
index
<
_visualItems
.
count
())
{
WimaArea
*
area
=
qobject_cast
<
WimaArea
*>
(
_visualItems
.
removeAt
(
index
));
WimaArea
*
area
=
qobject_cast
<
WimaArea
*>
(
_visualItems
.
removeAt
(
index
));
...
@@ -239,15 +237,20 @@ bool WimaPlaner::addCorridor() {
...
@@ -239,15 +237,20 @@ bool WimaPlaner::addCorridor() {
void
WimaPlaner
::
removeAll
()
{
void
WimaPlaner
::
removeAll
()
{
bool
changesApplied
=
false
;
bool
changesApplied
=
false
;
// Delete Pointers.
while
(
_visualItems
.
count
()
>
0
)
{
while
(
_visualItems
.
count
()
>
0
)
{
removeArea
(
0
);
removeArea
(
0
);
changesApplied
=
true
;
changesApplied
=
true
;
}
}
// Reset Items.
_measurementArea
=
WimaMeasurementArea
();
_joinedArea
=
WimaJoinedArea
();
_serviceArea
=
WimaServiceArea
();
_corridor
=
WimaCorridor
();
// Remove missions items.
_missionController
->
removeAll
();
_missionController
->
removeAll
();
_currentFile
=
""
;
_currentFile
=
""
;
_survey
=
nullptr
;
_survey
=
nullptr
;
emit
currentFileChanged
();
emit
currentFileChanged
();
...
...
src/Wima/WimaPlaner.h
View file @
0397d607
...
@@ -82,7 +82,6 @@ public:
...
@@ -82,7 +82,6 @@ public:
void
setCurrentPolygonIndex
(
int
index
);
void
setCurrentPolygonIndex
(
int
index
);
void
setProgressLocked
(
bool
l
);
void
setProgressLocked
(
bool
l
);
Q_INVOKABLE
WimaPlaner
*
thisPointer
();
Q_INVOKABLE
bool
addMeasurementArea
();
Q_INVOKABLE
bool
addMeasurementArea
();
/// Removes an area from _visualItems
/// Removes an area from _visualItems
/// @param index Index of the area to be removed
/// @param index Index of the area to be removed
...
...
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