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
6af0d454
Commit
6af0d454
authored
Oct 22, 2020
by
Valentin Platzgummer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
temp
parent
53fdc29e
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
96 additions
and
70 deletions
+96
-70
CircularSurvey.cc
src/Wima/CircularSurvey.cc
+6
-0
CircularSurvey.h
src/Wima/CircularSurvey.h
+2
-0
CircularGenerator.cpp
src/Wima/Snake/CircularGenerator.cpp
+15
-5
LinearGenerator.cpp
src/Wima/Snake/LinearGenerator.cpp
+22
-21
WimaPlanData.cc
src/Wima/WimaPlanData.cc
+34
-0
WimaPlanData.h
src/Wima/WimaPlanData.h
+5
-0
WimaPlaner.cc
src/Wima/WimaPlaner.cc
+9
-29
WimaPlaner.h
src/Wima/WimaPlaner.h
+3
-15
No files found.
src/Wima/CircularSurvey.cc
View file @
6af0d454
...
...
@@ -78,6 +78,12 @@ void CircularSurvey::setPlanData(const WimaPlanData &d) {
*
this
->
_pAreaData
=
d
;
}
const
WimaPlanData
&
CircularSurvey
::
planData
()
const
{
return
*
this
->
_pAreaData
;
}
WimaPlanData
&
CircularSurvey
::
planData
()
{
return
*
this
->
_pAreaData
;
}
QStringList
CircularSurvey
::
variantNames
()
const
{
return
_variantNames
;
}
bool
CircularSurvey
::
load
(
const
QJsonObject
&
complexObject
,
int
sequenceNumber
,
...
...
src/Wima/CircularSurvey.h
View file @
6af0d454
...
...
@@ -51,6 +51,8 @@ public:
void
setPlanData
(
const
WimaPlanData
&
d
);
// Property getters
const
WimaPlanData
&
planData
()
const
;
WimaPlanData
&
planData
();
Fact
*
variant
();
QStringList
variantNames
()
const
;
bool
calculating
()
const
;
...
...
src/Wima/Snake/CircularGenerator.cpp
View file @
6af0d454
...
...
@@ -169,6 +169,9 @@ void CircularGenerator::resetReferenceIfInvalid() {
void
CircularGenerator
::
resetReference
()
{
if
(
this
->
_d
->
measurementArea
().
center
().
isValid
())
{
setReference
(
this
->
_d
->
measurementArea
().
center
());
}
else
{
qCWarning
(
CircularGeneratorLog
)
<<
"measurement area center"
<<
this
->
_d
->
measurementArea
().
center
();
}
}
...
...
@@ -176,15 +179,21 @@ void CircularGenerator::establishConnections() {
if
(
this
->
_d
&&
!
this
->
_connectionsEstablished
)
{
connect
(
this
->
_d
.
get
(),
&
WimaPlanData
::
originChanged
,
this
,
&
GeneratorBase
::
generatorChanged
);
connect
(
&
this
->
_d
->
measurementArea
(),
&
WimaMeasurementAreaData
::
progressChanged
,
this
,
&
GeneratorBase
::
generatorChanged
);
connect
(
&
this
->
_d
->
measurementArea
(),
&
WimaMeasurementAreaData
::
tileDataChanged
,
this
,
&
GeneratorBase
::
generatorChanged
);
connect
(
&
this
->
_d
->
measurementArea
(),
&
WimaMeasurementAreaData
::
pathChanged
,
this
,
&
CircularGenerator
::
resetReferenceIfInvalid
);
connect
(
&
this
->
_d
->
measurementArea
(),
&
WimaMeasurementAreaData
::
centerChanged
,
this
,
&
CircularGenerator
::
resetReferenceIfInvalid
);
connect
(
&
this
->
_d
->
measurementArea
(),
&
WimaMeasurementAreaData
::
pathChanged
,
this
,
&
GeneratorBase
::
generatorChanged
);
connect
(
&
this
->
_d
->
serviceArea
(),
&
WimaServiceAreaData
::
depotChanged
,
this
,
&
GeneratorBase
::
generatorChanged
);
connect
(
&
this
->
_d
->
joinedArea
(),
&
WimaJoinedAreaData
::
pathChanged
,
this
,
&
GeneratorBase
::
generatorChanged
);
connect
(
this
->
distance
(),
&
Fact
::
rawValueChanged
,
this
,
&
GeneratorBase
::
generatorChanged
);
connect
(
this
->
deltaAlpha
(),
&
Fact
::
rawValueChanged
,
this
,
...
...
@@ -207,14 +216,15 @@ void CircularGenerator::deleteConnections() {
disconnect
(
&
this
->
_d
->
measurementArea
(),
&
WimaMeasurementAreaData
::
tileDataChanged
,
this
,
&
GeneratorBase
::
generatorChanged
);
disconnect
(
&
this
->
_d
->
measurementArea
(),
&
WimaMeasurementAreaData
::
pathChanged
,
this
,
&
CircularGenerator
::
resetReferenceIfInvalid
);
disconnect
(
&
this
->
_d
->
measurementArea
(),
&
WimaMeasurementAreaData
::
center
,
this
,
&
CircularGenerator
::
resetReferenceIfInvalid
);
disconnect
(
&
this
->
_d
->
measurementArea
(),
&
WimaMeasurementAreaData
::
pathChanged
,
this
,
&
GeneratorBase
::
generatorChanged
);
disconnect
(
&
this
->
_d
->
serviceArea
(),
&
WimaServiceAreaData
::
depotChanged
,
this
,
&
GeneratorBase
::
generatorChanged
);
disconnect
(
&
this
->
_d
->
joinedArea
(),
&
WimaJoinedAreaData
::
pathChanged
,
this
,
&
GeneratorBase
::
generatorChanged
);
disconnect
(
this
->
distance
(),
&
Fact
::
rawValueChanged
,
this
,
&
GeneratorBase
::
generatorChanged
);
disconnect
(
this
->
deltaAlpha
(),
&
Fact
::
rawValueChanged
,
this
,
...
...
src/Wima/Snake/LinearGenerator.cpp
View file @
6af0d454
...
...
@@ -144,6 +144,8 @@ void LinearGenerator::establishConnections() {
this
,
&
GeneratorBase
::
generatorChanged
);
connect
(
&
this
->
_d
->
serviceArea
(),
&
WimaServiceAreaData
::
depotChanged
,
this
,
&
GeneratorBase
::
generatorChanged
);
connect
(
&
this
->
_d
->
joinedArea
(),
&
WimaJoinedAreaData
::
pathChanged
,
this
,
&
GeneratorBase
::
generatorChanged
);
connect
(
this
->
distance
(),
&
Fact
::
rawValueChanged
,
this
,
&
GeneratorBase
::
generatorChanged
);
connect
(
this
->
alpha
(),
&
Fact
::
rawValueChanged
,
this
,
...
...
@@ -156,27 +158,26 @@ void LinearGenerator::establishConnections() {
void
LinearGenerator
::
deleteConnections
()
{
if
(
this
->
_d
&&
this
->
_connectionsEstablished
)
{
disconnect
(
this
->
_d
.
get
(),
&
WimaPlanData
::
measurementAreaChanged
,
this
,
&
GeneratorBase
::
generatorChanged
);
disconnect
(
this
->
_d
.
get
(),
&
WimaPlanData
::
originChanged
,
this
,
&
GeneratorBase
::
generatorChanged
);
disconnect
(
&
this
->
_d
->
measurementArea
(),
&
WimaMeasurementAreaData
::
progressChanged
,
this
,
&
GeneratorBase
::
generatorChanged
);
disconnect
(
&
this
->
_d
->
measurementArea
(),
&
WimaMeasurementAreaData
::
tileDataChanged
,
this
,
&
GeneratorBase
::
generatorChanged
);
disconnect
(
&
this
->
_d
->
measurementArea
(),
&
WimaMeasurementAreaData
::
pathChanged
,
this
,
&
GeneratorBase
::
generatorChanged
);
disconnect
(
&
this
->
_d
->
serviceArea
(),
&
WimaServiceAreaData
::
depotChanged
,
this
,
&
GeneratorBase
::
generatorChanged
);
disconnect
(
this
->
distance
(),
&
Fact
::
rawValueChanged
,
this
,
&
GeneratorBase
::
generatorChanged
);
disconnect
(
this
->
alpha
(),
&
Fact
::
rawValueChanged
,
this
,
&
GeneratorBase
::
generatorChanged
);
disconnect
(
this
->
minLength
(),
&
Fact
::
rawValueChanged
,
this
,
&
GeneratorBase
::
generatorChanged
);
connect
(
this
->
_d
.
get
(),
&
WimaPlanData
::
originChanged
,
this
,
&
GeneratorBase
::
generatorChanged
);
connect
(
&
this
->
_d
->
measurementArea
(),
&
WimaMeasurementAreaData
::
progressChanged
,
this
,
&
GeneratorBase
::
generatorChanged
);
connect
(
&
this
->
_d
->
measurementArea
(),
&
WimaMeasurementAreaData
::
tileDataChanged
,
this
,
&
GeneratorBase
::
generatorChanged
);
connect
(
&
this
->
_d
->
measurementArea
(),
&
WimaMeasurementAreaData
::
pathChanged
,
this
,
&
GeneratorBase
::
generatorChanged
);
connect
(
&
this
->
_d
->
serviceArea
(),
&
WimaServiceAreaData
::
depotChanged
,
this
,
&
GeneratorBase
::
generatorChanged
);
connect
(
&
this
->
_d
->
joinedArea
(),
&
WimaJoinedAreaData
::
pathChanged
,
this
,
&
GeneratorBase
::
generatorChanged
);
connect
(
this
->
distance
(),
&
Fact
::
rawValueChanged
,
this
,
&
GeneratorBase
::
generatorChanged
);
connect
(
this
->
alpha
(),
&
Fact
::
rawValueChanged
,
this
,
&
GeneratorBase
::
generatorChanged
);
connect
(
this
->
minLength
(),
&
Fact
::
rawValueChanged
,
this
,
&
GeneratorBase
::
generatorChanged
);
this
->
_connectionsEstablished
=
false
;
}
}
...
...
src/Wima/WimaPlanData.cc
View file @
6af0d454
...
...
@@ -50,6 +50,40 @@ void WimaPlanData::set(const WimaMeasurementAreaData &areaData) {
}
}
void
WimaPlanData
::
set
(
const
WimaJoinedArea
&
areaData
)
{
if
(
_joinedArea
!=
areaData
)
{
_joinedArea
=
areaData
;
emit
joinedAreaChanged
();
}
}
void
WimaPlanData
::
set
(
const
WimaServiceArea
&
areaData
)
{
if
(
_serviceArea
!=
areaData
)
{
_serviceArea
=
areaData
;
emit
serviceAreaChanged
();
}
}
void
WimaPlanData
::
set
(
const
WimaCorridor
&
areaData
)
{
if
(
_corridor
!=
areaData
)
{
_corridor
=
areaData
;
emit
corridorChanged
();
}
}
void
WimaPlanData
::
set
(
const
WimaMeasurementArea
&
areaData
)
{
if
(
_measurementArea
!=
areaData
)
{
_measurementArea
=
areaData
;
emit
measurementAreaChanged
();
if
(
_measurementArea
.
coordinateList
().
size
()
>
0
)
{
setOrigin
(
_measurementArea
.
coordinateList
().
first
());
}
else
{
setOrigin
(
QGeoCoordinate
());
}
}
}
void
WimaPlanData
::
clear
()
{
*
this
=
WimaPlanData
();
}
QGeoCoordinate
WimaPlanData
::
origin
()
{
return
_origin
;
}
...
...
src/Wima/WimaPlanData.h
View file @
6af0d454
...
...
@@ -22,6 +22,11 @@ public:
void
set
(
const
WimaServiceAreaData
&
areaData
);
void
set
(
const
WimaCorridorData
&
areaData
);
void
set
(
const
WimaMeasurementAreaData
&
areaData
);
void
set
(
const
WimaJoinedArea
&
areaData
);
void
set
(
const
WimaServiceArea
&
areaData
);
void
set
(
const
WimaCorridor
&
areaData
);
void
set
(
const
WimaMeasurementArea
&
areaData
);
void
clear
();
const
WimaJoinedAreaData
&
joinedArea
()
const
;
...
...
src/Wima/WimaPlaner.cc
View file @
6af0d454
...
...
@@ -38,9 +38,7 @@ const char *WimaPlaner::missionItemsName = "MissionItems";
WimaPlaner
::
WimaPlaner
(
QObject
*
parent
)
:
QObject
(
parent
),
_masterController
(
nullptr
),
_missionController
(
nullptr
),
_currentAreaIndex
(
-
1
),
_copyMAreaToSurvey
(
true
),
_copySAreaToSurvey
(
true
),
_corridorChanged
(
true
),
_joinedArea
(
this
),
_arrivalPathLength
(
0
),
_returnPathLength
(
0
),
_survey
(
nullptr
),
_surveyChanged
(
true
),
_currentAreaIndex
(
-
1
),
_joinedArea
(
this
),
_survey
(
nullptr
),
_synchronized
(
false
),
_nemoInterface
(
this
),
_stateMachine
(
new
StateMachine
),
_areasMonitored
(
false
),
_missionControllerMonitored
(
false
),
_progressLocked
(
false
)
{
...
...
@@ -364,22 +362,7 @@ void WimaPlaner::_update() {
&
WimaPlaner
::
CSDestroyedHandler
);
}
// update survey area
disconnect
(
_survey
,
&
CircularSurvey
::
calculatingChanged
,
this
,
&
WimaPlaner
::
CSCalculatingChangedHandler
);
WimaPlanData
planData
;
if
(
!
toPlanData
(
planData
))
{
qCWarning
(
WimaPlanerLog
)
<<
"not able to create plan data."
;
return
;
}
_survey
->
setPlanData
(
planData
);
connect
(
_survey
,
&
CircularSurvey
::
calculatingChanged
,
this
,
&
WimaPlaner
::
CSCalculatingChangedHandler
);
// Folloing statement just for completeness.
this
->
_stateMachine
->
updateState
(
EVENT
::
SURVEY_UPDATE_TRIGGERED
);
(
void
)
toPlanData
(
this
->
_survey
->
planData
());
}
break
;
// STATE::NEEDS_SURVEY_UPDATE
case
STATE
:
:
WAITING_FOR_SURVEY_UPDATE
:
{
...
...
@@ -447,7 +430,7 @@ void WimaPlaner::_update() {
.
data
());
return
;
}
_arrivalPathLength
=
path
.
size
()
-
1
;
for
(
int
i
=
1
;
i
<
path
.
count
()
-
1
;
i
++
)
{
(
void
)
_missionController
->
insertSimpleMissionItem
(
path
[
i
],
missionItems
->
count
()
-
1
);
...
...
@@ -465,8 +448,7 @@ void WimaPlaner::_update() {
.
data
());
return
;
}
_returnPathLength
=
path
.
size
()
-
1
;
// -1: fist item is last measurement point
for
(
int
i
=
1
;
i
<
path
.
count
()
-
1
;
i
++
)
{
(
void
)
_missionController
->
insertSimpleMissionItem
(
path
[
i
],
missionItems
->
count
());
...
...
@@ -955,13 +937,11 @@ void WimaPlaner::setInteractive() {
* \sa WimaController, WimaPlanData
*/
bool
WimaPlaner
::
toPlanData
(
WimaPlanData
&
planData
)
{
// store areas
planData
.
set
(
WimaMeasurementAreaData
(
_measurementArea
));
planData
.
set
(
WimaServiceAreaData
(
_serviceArea
));
planData
.
set
(
WimaCorridorData
(
_corridor
));
planData
.
set
(
WimaJoinedAreaData
(
_joinedArea
));
return
true
;
planData
.
set
(
_measurementArea
);
planData
.
set
(
_serviceArea
);
planData
.
set
(
_corridor
);
planData
.
set
(
_joinedArea
);
return
planData
.
isValid
();
}
#ifndef NDEBUG
...
...
src/Wima/WimaPlaner.h
View file @
6af0d454
...
...
@@ -172,27 +172,13 @@ private:
int
_currentAreaIndex
;
QString
_currentFile
;
bool
_joinedAreaValid
;
WimaMeasurementArea
_measurementArea
;
bool
_copyMAreaToSurvey
;
WimaServiceArea
_serviceArea
;
bool
_copySAreaToSurvey
;
WimaCorridor
_corridor
;
bool
_corridorChanged
;
// contains all visible areas
QmlObjectListModel
_visualItems
;
// joined area fromed by _measurementArea, _serviceArea, _corridor
WimaJoinedArea
_joinedArea
;
// path from takeoff to first measurement point
unsigned
long
_arrivalPathLength
;
// path from last measurement point to land
unsigned
long
_returnPathLength
;
QmlObjectListModel
_visualItems
;
// all areas
CircularSurvey
*
_survey
;
bool
_surveyChanged
;
// sync stuff
bool
_synchronized
;
// true if planData is synchronized with
// wimaController
#ifndef NDEBUG
QTimer
_autoLoadTimer
;
// timer to auto load mission after some time, prevents
...
...
@@ -206,4 +192,6 @@ private:
bool
_areasMonitored
;
bool
_missionControllerMonitored
;
bool
_progressLocked
;
bool
_synchronized
;
// true if planData is synchronized with
// wimaController
};
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