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
3dc41359
Commit
3dc41359
authored
Nov 11, 2020
by
Valentin Platzgummer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
src mod
parent
99e5ae38
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
122 additions
and
85 deletions
+122
-85
Fact.cc
src/FactSystem/Fact.cc
+6
-6
MissionController.cc
src/MissionManager/MissionController.cc
+20
-3
StructureScanComplexItem.h
src/MissionManager/StructureScanComplexItem.h
+1
-1
VisualMissionItem.cc
src/MissionManager/VisualMissionItem.cc
+1
-1
CircularSurvey.cc
src/Wima/CircularSurvey.cc
+52
-24
CircularSurvey.h
src/Wima/CircularSurvey.h
+23
-24
WimaServiceArea.cc
src/Wima/Geometry/WimaServiceArea.cc
+5
-4
Utils.cpp
src/Wima/Utils.cpp
+0
-0
Utils.h
src/Wima/Utils.h
+0
-0
WimaPlaner.cc
src/Wima/WimaPlaner.cc
+13
-20
WimaPlaner.h
src/Wima/WimaPlaner.h
+1
-2
No files found.
src/FactSystem/Fact.cc
View file @
3dc41359
...
@@ -20,13 +20,13 @@ static const char* kMissingMetadata = "Meta data pointer missing";
...
@@ -20,13 +20,13 @@ static const char* kMissingMetadata = "Meta data pointer missing";
Fact
::
Fact
(
QObject
*
parent
)
Fact
::
Fact
(
QObject
*
parent
)
:
QObject
(
parent
)
:
QObject
(
parent
)
,
_componentId
(
-
1
)
,
_rawValue
(
0
)
,
_rawValue
(
0
)
,
_type
(
FactMetaData
::
valueTypeInt32
)
,
_type
(
FactMetaData
::
valueTypeInt32
)
,
_metaData
(
nullptr
)
,
_metaData
(
nullptr
)
,
_valueSliderModel
(
nullptr
)
,
_componentId
(
-
1
)
,
_sendValueChangedSignals
(
true
)
,
_sendValueChangedSignals
(
true
)
,
_deferredValueChangeSignal
(
false
)
,
_deferredValueChangeSignal
(
false
)
,
_valueSliderModel
(
nullptr
)
,
_ignoreQGCRebootRequired
(
false
)
,
_ignoreQGCRebootRequired
(
false
)
{
{
FactMetaData
*
metaData
=
new
FactMetaData
(
_type
,
this
);
FactMetaData
*
metaData
=
new
FactMetaData
(
_type
,
this
);
...
@@ -38,13 +38,13 @@ Fact::Fact(QObject* parent)
...
@@ -38,13 +38,13 @@ Fact::Fact(QObject* parent)
Fact
::
Fact
(
int
componentId
,
QString
name
,
FactMetaData
::
ValueType_t
type
,
QObject
*
parent
)
Fact
::
Fact
(
int
componentId
,
QString
name
,
FactMetaData
::
ValueType_t
type
,
QObject
*
parent
)
:
QObject
(
parent
)
:
QObject
(
parent
)
,
_name
(
name
)
,
_name
(
name
)
,
_componentId
(
componentId
)
,
_rawValue
(
0
)
,
_rawValue
(
0
)
,
_type
(
type
)
,
_type
(
type
)
,
_metaData
(
nullptr
)
,
_metaData
(
nullptr
)
,
_valueSliderModel
(
nullptr
)
,
_componentId
(
componentId
)
,
_sendValueChangedSignals
(
true
)
,
_sendValueChangedSignals
(
true
)
,
_deferredValueChangeSignal
(
false
)
,
_deferredValueChangeSignal
(
false
)
,
_valueSliderModel
(
nullptr
)
,
_ignoreQGCRebootRequired
(
false
)
,
_ignoreQGCRebootRequired
(
false
)
{
{
FactMetaData
*
metaData
=
new
FactMetaData
(
_type
,
this
);
FactMetaData
*
metaData
=
new
FactMetaData
(
_type
,
this
);
...
@@ -56,13 +56,13 @@ Fact::Fact(int componentId, QString name, FactMetaData::ValueType_t type, QObjec
...
@@ -56,13 +56,13 @@ Fact::Fact(int componentId, QString name, FactMetaData::ValueType_t type, QObjec
Fact
::
Fact
(
const
QString
&
settingsGroup
,
FactMetaData
*
metaData
,
QObject
*
parent
)
Fact
::
Fact
(
const
QString
&
settingsGroup
,
FactMetaData
*
metaData
,
QObject
*
parent
)
:
QObject
(
parent
)
:
QObject
(
parent
)
,
_name
(
metaData
->
name
())
,
_name
(
metaData
->
name
())
,
_componentId
(
0
)
,
_rawValue
(
0
)
,
_rawValue
(
0
)
,
_type
(
metaData
->
type
())
,
_type
(
metaData
->
type
())
,
_metaData
(
nullptr
)
,
_metaData
(
nullptr
)
,
_valueSliderModel
(
nullptr
)
,
_componentId
(
0
)
,
_sendValueChangedSignals
(
true
)
,
_sendValueChangedSignals
(
true
)
,
_deferredValueChangeSignal
(
false
)
,
_deferredValueChangeSignal
(
false
)
,
_valueSliderModel
(
nullptr
)
,
_ignoreQGCRebootRequired
(
false
)
,
_ignoreQGCRebootRequired
(
false
)
{
{
qgcApp
()
->
toolbox
()
->
corePlugin
()
->
adjustSettingMetaData
(
settingsGroup
,
*
metaData
);
qgcApp
()
->
toolbox
()
->
corePlugin
()
->
adjustSettingMetaData
(
settingsGroup
,
*
metaData
);
...
...
src/MissionManager/MissionController.cc
View file @
3dc41359
...
@@ -19,6 +19,7 @@
...
@@ -19,6 +19,7 @@
#include "FixedWingLandingComplexItem.h"
#include "FixedWingLandingComplexItem.h"
#include "VTOLLandingComplexItem.h"
#include "VTOLLandingComplexItem.h"
#include "StructureScanComplexItem.h"
#include "StructureScanComplexItem.h"
#include "Wima/CircularSurvey.h"
#include "CorridorScanComplexItem.h"
#include "CorridorScanComplexItem.h"
#include "JsonHelper.h"
#include "JsonHelper.h"
#include "ParameterManager.h"
#include "ParameterManager.h"
...
@@ -443,6 +444,8 @@ VisualMissionItem* MissionController::insertComplexMissionItem(QString itemName,
...
@@ -443,6 +444,8 @@ VisualMissionItem* MissionController::insertComplexMissionItem(QString itemName,
newItem
=
new
StructureScanComplexItem
(
_masterController
,
_flyView
,
QString
()
/* kmlFile */
,
_visualItems
/* parent */
);
newItem
=
new
StructureScanComplexItem
(
_masterController
,
_flyView
,
QString
()
/* kmlFile */
,
_visualItems
/* parent */
);
}
else
if
(
itemName
==
CorridorScanComplexItem
::
name
)
{
}
else
if
(
itemName
==
CorridorScanComplexItem
::
name
)
{
newItem
=
new
CorridorScanComplexItem
(
_masterController
,
_flyView
,
QString
()
/* kmlFile */
,
_visualItems
/* parent */
);
newItem
=
new
CorridorScanComplexItem
(
_masterController
,
_flyView
,
QString
()
/* kmlFile */
,
_visualItems
/* parent */
);
}
else
if
(
itemName
==
CircularSurvey
::
name
)
{
newItem
=
new
CircularSurvey
(
_masterController
,
_flyView
,
QString
()
/* kmlFile */
,
_visualItems
/* parent */
);
}
else
{
}
else
{
qWarning
()
<<
"Internal error: Unknown complex item:"
<<
itemName
;
qWarning
()
<<
"Internal error: Unknown complex item:"
<<
itemName
;
return
nullptr
;
return
nullptr
;
...
@@ -478,7 +481,8 @@ void MissionController::_insertComplexMissionItemWorker(const QGeoCoordinate& ma
...
@@ -478,7 +481,8 @@ void MissionController::_insertComplexMissionItemWorker(const QGeoCoordinate& ma
int
sequenceNumber
=
_nextSequenceNumber
();
int
sequenceNumber
=
_nextSequenceNumber
();
bool
surveyStyleItem
=
qobject_cast
<
SurveyComplexItem
*>
(
complexItem
)
||
bool
surveyStyleItem
=
qobject_cast
<
SurveyComplexItem
*>
(
complexItem
)
||
qobject_cast
<
CorridorScanComplexItem
*>
(
complexItem
)
||
qobject_cast
<
CorridorScanComplexItem
*>
(
complexItem
)
||
qobject_cast
<
StructureScanComplexItem
*>
(
complexItem
);
qobject_cast
<
StructureScanComplexItem
*>
(
complexItem
)
||
qobject_cast
<
CircularSurvey
*>
(
complexItem
)
;
if
(
surveyStyleItem
)
{
if
(
surveyStyleItem
)
{
bool
rollSupported
=
false
;
bool
rollSupported
=
false
;
...
@@ -535,7 +539,9 @@ void MissionController::removeVisualItem(int viIndex)
...
@@ -535,7 +539,9 @@ void MissionController::removeVisualItem(int viIndex)
return
;
return
;
}
}
bool
removeSurveyStyle
=
_visualItems
->
value
<
SurveyComplexItem
*>
(
viIndex
)
||
_visualItems
->
value
<
CorridorScanComplexItem
*>
(
viIndex
);
bool
removeSurveyStyle
=
_visualItems
->
value
<
SurveyComplexItem
*>
(
viIndex
)
||
_visualItems
->
value
<
CorridorScanComplexItem
*>
(
viIndex
)
||
_visualItems
->
value
<
CircularSurvey
*>
(
viIndex
);
VisualMissionItem
*
item
=
qobject_cast
<
VisualMissionItem
*>
(
_visualItems
->
removeAt
(
viIndex
));
VisualMissionItem
*
item
=
qobject_cast
<
VisualMissionItem
*>
(
_visualItems
->
removeAt
(
viIndex
));
if
(
item
==
_takeoffMissionItem
)
{
if
(
item
==
_takeoffMissionItem
)
{
...
@@ -549,7 +555,9 @@ void MissionController::removeVisualItem(int viIndex)
...
@@ -549,7 +555,9 @@ void MissionController::removeVisualItem(int viIndex)
// Determine if the mission still has another survey style item in it
// Determine if the mission still has another survey style item in it
bool
foundSurvey
=
false
;
bool
foundSurvey
=
false
;
for
(
int
i
=
1
;
i
<
_visualItems
->
count
();
i
++
)
{
for
(
int
i
=
1
;
i
<
_visualItems
->
count
();
i
++
)
{
if
(
_visualItems
->
value
<
SurveyComplexItem
*>
(
i
)
||
_visualItems
->
value
<
CorridorScanComplexItem
*>
(
i
))
{
if
(
_visualItems
->
value
<
SurveyComplexItem
*>
(
i
)
||
_visualItems
->
value
<
CorridorScanComplexItem
*>
(
i
)
||
_visualItems
->
value
<
CircularSurvey
*>
(
i
)
)
{
foundSurvey
=
true
;
foundSurvey
=
true
;
break
;
break
;
}
}
...
@@ -863,6 +871,15 @@ bool MissionController::_loadJsonMissionFileV2(const QJsonObject& json, QmlObjec
...
@@ -863,6 +871,15 @@ bool MissionController::_loadJsonMissionFileV2(const QJsonObject& json, QmlObjec
nextSequenceNumber
=
corridorItem
->
lastSequenceNumber
()
+
1
;
nextSequenceNumber
=
corridorItem
->
lastSequenceNumber
()
+
1
;
qCDebug
(
MissionControllerLog
)
<<
"Corridor Scan load complete: nextSequenceNumber"
<<
nextSequenceNumber
;
qCDebug
(
MissionControllerLog
)
<<
"Corridor Scan load complete: nextSequenceNumber"
<<
nextSequenceNumber
;
visualItems
->
append
(
corridorItem
);
visualItems
->
append
(
corridorItem
);
}
else
if
(
complexItemType
==
CircularSurvey
::
jsonComplexItemTypeValue
)
{
qCDebug
(
MissionControllerLog
)
<<
"Loading Circular Survey: nextSequenceNumber"
<<
nextSequenceNumber
;
CircularSurvey
*
survey
=
new
CircularSurvey
(
_masterController
,
_flyView
,
QString
()
/* kmlFile */
,
visualItems
);
if
(
!
survey
->
load
(
itemObject
,
nextSequenceNumber
++
,
errorString
))
{
return
false
;
}
nextSequenceNumber
=
survey
->
lastSequenceNumber
()
+
1
;
qCDebug
(
MissionControllerLog
)
<<
"Ciruclar Survey load complete: nextSequenceNumber"
<<
nextSequenceNumber
;
visualItems
->
append
(
survey
);
}
else
{
}
else
{
errorString
=
tr
(
"Unsupported complex item type: %1"
).
arg
(
complexItemType
);
errorString
=
tr
(
"Unsupported complex item type: %1"
).
arg
(
complexItemType
);
}
}
...
...
src/MissionManager/StructureScanComplexItem.h
View file @
3dc41359
...
@@ -86,7 +86,7 @@ public:
...
@@ -86,7 +86,7 @@ public:
double
specifiedGimbalYaw
(
void
)
final
{
return
std
::
numeric_limits
<
double
>::
quiet_NaN
();
}
double
specifiedGimbalYaw
(
void
)
final
{
return
std
::
numeric_limits
<
double
>::
quiet_NaN
();
}
double
specifiedGimbalPitch
(
void
)
final
{
return
std
::
numeric_limits
<
double
>::
quiet_NaN
();
}
double
specifiedGimbalPitch
(
void
)
final
{
return
std
::
numeric_limits
<
double
>::
quiet_NaN
();
}
void
appendMissionItems
(
QList
<
MissionItem
*>&
items
,
QObject
*
missionItemParent
)
final
;
void
appendMissionItems
(
QList
<
MissionItem
*>&
items
,
QObject
*
missionItemParent
)
final
;
void
setMissionFlightStatus
(
MissionController
::
MissionFlightStatus_t
&
missionFlightStatus
)
final
;
void
setMissionFlightStatus
(
const
MissionController
::
MissionFlightStatus_t
&
missionFlightStatus
)
final
;
void
applyNewAltitude
(
double
newAltitude
)
final
;
void
applyNewAltitude
(
double
newAltitude
)
final
;
double
additionalTimeDelay
(
void
)
const
final
{
return
0
;
}
double
additionalTimeDelay
(
void
)
const
final
{
return
0
;
}
ReadyForSaveState
readyForSaveState
(
void
)
const
final
;
ReadyForSaveState
readyForSaveState
(
void
)
const
final
;
...
...
src/MissionManager/VisualMissionItem.cc
View file @
3dc41359
...
@@ -150,7 +150,7 @@ void VisualMissionItem::setAzimuth(double azimuth)
...
@@ -150,7 +150,7 @@ void VisualMissionItem::setAzimuth(double azimuth)
}
}
}
}
void
VisualMissionItem
::
setMissionFlightStatus
(
MissionController
::
MissionFlightStatus_t
&
missionFlightStatus
)
void
VisualMissionItem
::
setMissionFlightStatus
(
const
MissionController
::
MissionFlightStatus_t
&
missionFlightStatus
)
{
{
if
(
!
QGC
::
fuzzyCompare
(
missionFlightStatus
.
gimbalYaw
,
_missionGimbalYaw
))
{
if
(
!
QGC
::
fuzzyCompare
(
missionFlightStatus
.
gimbalYaw
,
_missionGimbalYaw
))
{
_missionGimbalYaw
=
missionFlightStatus
.
gimbalYaw
;
_missionGimbalYaw
=
missionFlightStatus
.
gimbalYaw
;
...
...
src/Wima/CircularSurvey.cc
View file @
3dc41359
...
@@ -29,12 +29,15 @@ constexpr typename std::underlying_type<T>::type integral(T value) {
...
@@ -29,12 +29,15 @@ constexpr typename std::underlying_type<T>::type integral(T value) {
}
}
const
char
*
CircularSurvey
::
settingsGroup
=
"CircularSurvey"
;
const
char
*
CircularSurvey
::
settingsGroup
=
"CircularSurvey"
;
const
char
*
CircularSurvey
::
CircularSurveyNam
e
=
"CircularSurvey"
;
const
char
*
CircularSurvey
::
jsonComplexItemTypeValu
e
=
"CircularSurvey"
;
const
char
*
CircularSurvey
::
variantName
=
"Variant"
;
const
char
*
CircularSurvey
::
variantName
=
"Variant"
;
const
QString
CircularSurvey
::
name
(
tr
(
"Circular Survey"
));
CircularSurvey
::
CircularSurvey
(
PlanMasterController
*
masterController
,
bool
flyView
,
CircularSurvey
::
CircularSurvey
(
PlanMasterController
*
masterController
,
const
QString
&
kmlOrShpFile
,
QObject
*
parent
)
bool
flyView
,
const
QString
&
kmlOrShpFile
,
:
TransectStyleComplexItem
(
masterController
,
flyView
,
settingsGroup
,
parent
),
QObject
*
parent
)
:
TransectStyleComplexItem
(
masterController
,
flyView
,
settingsGroup
,
parent
),
_state
(
STATE
::
IDLE
),
_state
(
STATE
::
IDLE
),
_metaDataMap
(
FactMetaData
::
createMapFromJsonFile
(
_metaDataMap
(
FactMetaData
::
createMapFromJsonFile
(
QStringLiteral
(
":/json/CircularSurvey.SettingsGroup.json"
),
this
)),
QStringLiteral
(
":/json/CircularSurvey.SettingsGroup.json"
),
this
)),
...
@@ -65,7 +68,7 @@ CircularSurvey::CircularSurvey(PlanMasterController *masterController, bool flyV
...
@@ -65,7 +68,7 @@ CircularSurvey::CircularSurvey(PlanMasterController *masterController, bool flyV
CircularSurvey
::~
CircularSurvey
()
{}
CircularSurvey
::~
CircularSurvey
()
{}
void
CircularSurvey
::
reverse
()
{
void
CircularSurvey
::
reverse
()
{
this
->
_s
tate
=
STATE
::
REVERSE
;
this
->
_s
etState
(
STATE
::
REVERSE
)
;
this
->
_rebuildTransects
();
this
->
_rebuildTransects
();
}
}
...
@@ -113,7 +116,7 @@ bool CircularSurvey::load(const QJsonObject &complexObject, int sequenceNumber,
...
@@ -113,7 +116,7 @@ bool CircularSurvey::load(const QJsonObject &complexObject, int sequenceNumber,
QString
complexType
=
QString
complexType
=
complexObject
[
ComplexMissionItem
::
jsonComplexItemTypeKey
].
toString
();
complexObject
[
ComplexMissionItem
::
jsonComplexItemTypeKey
].
toString
();
if
(
itemType
!=
VisualMissionItem
::
jsonTypeComplexItemValue
||
if
(
itemType
!=
VisualMissionItem
::
jsonTypeComplexItemValue
||
complexType
!=
CircularSurveyNam
e
)
{
complexType
!=
jsonComplexItemTypeValu
e
)
{
errorString
=
tr
(
"%1 does not support loading this complex mission item "
errorString
=
tr
(
"%1 does not support loading this complex mission item "
"type: %2:%3"
)
"type: %2:%3"
)
.
arg
(
qgcApp
()
->
applicationName
())
.
arg
(
qgcApp
()
->
applicationName
())
...
@@ -161,7 +164,8 @@ void CircularSurvey::save(QJsonArray &planItems) {
...
@@ -161,7 +164,8 @@ void CircularSurvey::save(QJsonArray &planItems) {
saveObject
[
JsonHelper
::
jsonVersionKey
]
=
1
;
saveObject
[
JsonHelper
::
jsonVersionKey
]
=
1
;
saveObject
[
VisualMissionItem
::
jsonTypeKey
]
=
saveObject
[
VisualMissionItem
::
jsonTypeKey
]
=
VisualMissionItem
::
jsonTypeComplexItemValue
;
VisualMissionItem
::
jsonTypeComplexItemValue
;
saveObject
[
ComplexMissionItem
::
jsonComplexItemTypeKey
]
=
CircularSurveyName
;
saveObject
[
ComplexMissionItem
::
jsonComplexItemTypeKey
]
=
jsonComplexItemTypeValue
;
saveObject
[
variantName
]
=
double
(
_variant
.
rawValue
().
toUInt
());
saveObject
[
variantName
]
=
double
(
_variant
.
rawValue
().
toUInt
());
...
@@ -171,7 +175,9 @@ void CircularSurvey::save(QJsonArray &planItems) {
...
@@ -171,7 +175,9 @@ void CircularSurvey::save(QJsonArray &planItems) {
planItems
.
append
(
saveObject
);
planItems
.
append
(
saveObject
);
}
}
bool
CircularSurvey
::
specifiesCoordinate
()
const
{
return
true
;
}
bool
CircularSurvey
::
specifiesCoordinate
()
const
{
return
_transects
.
count
()
>
0
?
_transects
.
first
().
count
()
>
0
:
false
;
}
bool
CircularSurvey
::
_switchToGenerator
(
bool
CircularSurvey
::
_switchToGenerator
(
const
CircularSurvey
::
PtrGenerator
&
newG
)
{
const
CircularSurvey
::
PtrGenerator
&
newG
)
{
...
@@ -187,7 +193,7 @@ bool CircularSurvey::_switchToGenerator(
...
@@ -187,7 +193,7 @@ bool CircularSurvey::_switchToGenerator(
this
,
&
CircularSurvey
::
_rebuildTransects
);
this
,
&
CircularSurvey
::
_rebuildTransects
);
emit
generatorChanged
();
emit
generatorChanged
();
this
->
_s
tate
=
STATE
::
IDLE
;
this
->
_s
etState
(
STATE
::
IDLE
)
;
_rebuildTransects
();
_rebuildTransects
();
return
true
;
return
true
;
...
@@ -196,12 +202,26 @@ bool CircularSurvey::_switchToGenerator(
...
@@ -196,12 +202,26 @@ bool CircularSurvey::_switchToGenerator(
}
}
}
}
void
CircularSurvey
::
_setState
(
CircularSurvey
::
STATE
state
)
{
if
(
this
->
_state
!=
state
)
{
auto
oldState
=
this
->
_state
;
this
->
_state
=
state
;
if
(
_calculating
(
oldState
)
!=
_calculating
(
state
))
{
emit
calculatingChanged
();
}
}
}
bool
CircularSurvey
::
_calculating
(
CircularSurvey
::
STATE
state
)
const
{
return
state
==
STATE
::
ROUTING
;
}
void
CircularSurvey
::
_changeVariant
()
{
void
CircularSurvey
::
_changeVariant
()
{
this
->
_s
tate
=
STATE
::
VARIANT_CHANGE
;
this
->
_s
etState
(
STATE
::
VARIANT_CHANGE
)
;
this
->
_rebuildTransects
();
this
->
_rebuildTransects
();
}
}
void
CircularSurvey
::
_updateWorker
()
{
bool
CircularSurvey
::
_updateWorker
()
{
// Reset data.
// Reset data.
this
->
_transects
.
clear
();
this
->
_transects
.
clear
();
this
->
_variantVector
.
clear
();
this
->
_variantVector
.
clear
();
...
@@ -216,7 +236,7 @@ void CircularSurvey::_updateWorker() {
...
@@ -216,7 +236,7 @@ void CircularSurvey::_updateWorker() {
if
(
!
origin
.
isValid
())
{
if
(
!
origin
.
isValid
())
{
qCDebug
(
CircularSurveyLog
)
qCDebug
(
CircularSurveyLog
)
<<
"_updateWorker(): origin invalid."
<<
origin
;
<<
"_updateWorker(): origin invalid."
<<
origin
;
return
;
return
false
;
}
}
// Convert safe area.
// Convert safe area.
...
@@ -224,7 +244,7 @@ void CircularSurvey::_updateWorker() {
...
@@ -224,7 +244,7 @@ void CircularSurvey::_updateWorker() {
if
(
!
(
geoSafeArea
.
size
()
>=
3
))
{
if
(
!
(
geoSafeArea
.
size
()
>=
3
))
{
qCDebug
(
CircularSurveyLog
)
qCDebug
(
CircularSurveyLog
)
<<
"_updateWorker(): safe area invalid."
<<
geoSafeArea
;
<<
"_updateWorker(): safe area invalid."
<<
geoSafeArea
;
return
;
return
false
;
}
}
for
(
auto
&
v
:
geoSafeArea
)
{
for
(
auto
&
v
:
geoSafeArea
)
{
if
(
v
.
isValid
())
{
if
(
v
.
isValid
())
{
...
@@ -233,7 +253,7 @@ void CircularSurvey::_updateWorker() {
...
@@ -233,7 +253,7 @@ void CircularSurvey::_updateWorker() {
qCDebug
(
CircularSurveyLog
)
qCDebug
(
CircularSurveyLog
)
<<
"_updateWorker(): safe area contains invalid coordinate."
<<
"_updateWorker(): safe area contains invalid coordinate."
<<
geoSafeArea
;
<<
geoSafeArea
;
return
;
return
false
;
}
}
}
}
...
@@ -249,18 +269,22 @@ void CircularSurvey::_updateWorker() {
...
@@ -249,18 +269,22 @@ void CircularSurvey::_updateWorker() {
if
(
this
->
_pGenerator
->
get
(
g
))
{
if
(
this
->
_pGenerator
->
get
(
g
))
{
// Start/Restart routing worker.
// Start/Restart routing worker.
this
->
_pWorker
->
route
(
par
,
g
);
this
->
_pWorker
->
route
(
par
,
g
);
return
true
;
}
else
{
}
else
{
qCDebug
(
CircularSurveyLog
)
qCDebug
(
CircularSurveyLog
)
<<
"_updateWorker(): generator creation failed."
;
<<
"_updateWorker(): generator creation failed."
;
return
false
;
}
}
}
else
{
}
else
{
qCDebug
(
CircularSurveyLog
)
qCDebug
(
CircularSurveyLog
)
<<
"_updateWorker(): pGenerator == nullptr, number of registered "
<<
"_updateWorker(): pGenerator == nullptr, number of registered "
"generators: "
"generators: "
<<
this
->
_generatorList
.
size
();
<<
this
->
_generatorList
.
size
();
return
false
;
}
}
}
else
{
}
else
{
qCDebug
(
CircularSurveyLog
)
<<
"_updateWorker(): plan data invalid."
;
qCDebug
(
CircularSurveyLog
)
<<
"_updateWorker(): plan data invalid."
;
return
false
;
}
}
}
}
...
@@ -315,7 +339,7 @@ void CircularSurvey::_reverseWorker() {
...
@@ -315,7 +339,7 @@ void CircularSurvey::_reverseWorker() {
}
}
}
}
double
CircularSurvey
::
timeBetweenShots
()
{
return
1
;
}
double
CircularSurvey
::
timeBetweenShots
()
{
return
0
;
}
QString
CircularSurvey
::
commandDescription
()
const
{
QString
CircularSurvey
::
commandDescription
()
const
{
return
tr
(
"Circular Survey"
);
return
tr
(
"Circular Survey"
);
...
@@ -341,6 +365,8 @@ CircularSurvey::readyForSaveState() const {
...
@@ -341,6 +365,8 @@ CircularSurvey::readyForSaveState() const {
double
CircularSurvey
::
additionalTimeDelay
()
const
{
return
0
;
}
double
CircularSurvey
::
additionalTimeDelay
()
const
{
return
0
;
}
QString
CircularSurvey
::
patternName
()
const
{
return
name
;
}
bool
CircularSurvey
::
registerGenerator
(
bool
CircularSurvey
::
registerGenerator
(
const
QString
&
name
,
std
::
shared_ptr
<
routing
::
GeneratorBase
>
g
)
{
const
QString
&
name
,
std
::
shared_ptr
<
routing
::
GeneratorBase
>
g
)
{
if
(
name
.
isEmpty
())
{
if
(
name
.
isEmpty
())
{
...
@@ -451,25 +477,27 @@ void CircularSurvey::_rebuildTransectsPhase1(void) {
...
@@ -451,25 +477,27 @@ void CircularSurvey::_rebuildTransectsPhase1(void) {
switch
(
this
->
_state
)
{
switch
(
this
->
_state
)
{
case
STATE
:
:
SKIPP
:
case
STATE
:
:
SKIPP
:
qCDebug
(
CircularSurveyLog
)
<<
"rebuildTransectsPhase1: skipp."
;
qCDebug
(
CircularSurveyLog
)
<<
"rebuildTransectsPhase1: skipp."
;
this
->
_setState
(
STATE
::
IDLE
);
break
;
break
;
case
STATE
:
:
VARIANT_CHANGE
:
case
STATE
:
:
VARIANT_CHANGE
:
qCDebug
(
CircularSurveyLog
)
<<
"rebuildTransectsPhase1: variant change."
;
qCDebug
(
CircularSurveyLog
)
<<
"rebuildTransectsPhase1: variant change."
;
this
->
_changeVariantWorker
();
this
->
_changeVariantWorker
();
break
;
this
->
_setState
(
STATE
::
IDLE
);
case
STATE
:
:
RUN_CHANGE
:
qCDebug
(
CircularSurveyLog
)
<<
"rebuildTransectsPhase1: run change."
;
this
->
_changeVariantWorker
();
break
;
break
;
case
STATE
:
:
REVERSE
:
case
STATE
:
:
REVERSE
:
qCDebug
(
CircularSurveyLog
)
<<
"rebuildTransectsPhase1: reverse."
;
qCDebug
(
CircularSurveyLog
)
<<
"rebuildTransectsPhase1: reverse."
;
this
->
_reverseWorker
();
this
->
_reverseWorker
();
this
->
_setState
(
STATE
::
IDLE
);
break
;
break
;
case
STATE
:
:
IDLE
:
case
STATE
:
:
IDLE
:
case
STATE
:
:
ROUTING
:
this
->
_setState
(
STATE
::
ROUTING
);
qCDebug
(
CircularSurveyLog
)
<<
"rebuildTransectsPhase1: update."
;
qCDebug
(
CircularSurveyLog
)
<<
"rebuildTransectsPhase1: update."
;
this
->
_updateWorker
();
if
(
!
this
->
_updateWorker
())
{
this
->
_setState
(
STATE
::
IDLE
);
}
break
;
break
;
}
}
this
->
_state
=
STATE
::
IDLE
;
qCDebug
(
CircularSurveyLog
)
qCDebug
(
CircularSurveyLog
)
<<
"rebuildTransectsPhase1(): "
<<
"rebuildTransectsPhase1(): "
...
@@ -587,19 +615,19 @@ void CircularSurvey::_setTransects(CircularSurvey::PtrRoutingData pRoute) {
...
@@ -587,19 +615,19 @@ void CircularSurvey::_setTransects(CircularSurvey::PtrRoutingData pRoute) {
&
CircularSurvey
::
_changeVariant
);
&
CircularSurvey
::
_changeVariant
);
this
->
_changeVariantWorker
();
this
->
_changeVariantWorker
();
this
->
_s
tate
=
STATE
::
SKIPP
;
this
->
_s
etState
(
STATE
::
SKIPP
)
;
this
->
_rebuildTransects
();
this
->
_rebuildTransects
();
}
else
{
}
else
{
qCDebug
(
CircularSurveyLog
)
qCDebug
(
CircularSurveyLog
)
<<
"_setTransects(): failed, variantVector empty."
;
<<
"_setTransects(): failed, variantVector empty."
;
this
->
_s
tate
=
STATE
::
IDLE
;
this
->
_s
etState
(
STATE
::
IDLE
)
;
}
}
}
}
Fact
*
CircularSurvey
::
variant
()
{
return
&
_variant
;
}
Fact
*
CircularSurvey
::
variant
()
{
return
&
_variant
;
}
bool
CircularSurvey
::
calculating
()
const
{
bool
CircularSurvey
::
calculating
()
const
{
return
this
->
_
pWorker
->
calculating
(
);
return
this
->
_
calculating
(
this
->
_state
);
}
}
/*!
/*!
...
...
src/Wima/CircularSurvey.h
View file @
3dc41359
...
@@ -27,9 +27,11 @@ class CircularSurvey : public TransectStyleComplexItem {
...
@@ -27,9 +27,11 @@ class CircularSurvey : public TransectStyleComplexItem {
using
Transects
=
QList
<
QList
<
CoordInfo_t
>>
;
using
Transects
=
QList
<
QList
<
CoordInfo_t
>>
;
using
Variant
=
Transects
;
using
Variant
=
Transects
;
enum
class
STATE
{
IDLE
,
ROUTING
,
SKIPP
,
REVERSE
,
VARIANT_CHANGE
};
public:
public:
CircularSurvey
(
PlanMasterController
*
masterController
,
bool
flyView
,
const
QString
&
kmlOrShpFile
,
CircularSurvey
(
PlanMasterController
*
masterController
,
bool
flyView
,
QObject
*
parent
);
const
QString
&
kmlOrShpFile
,
QObject
*
parent
);
~
CircularSurvey
();
~
CircularSurvey
();
Q_PROPERTY
(
Fact
*
variant
READ
variant
CONSTANT
)
Q_PROPERTY
(
Fact
*
variant
READ
variant
CONSTANT
)
...
@@ -55,17 +57,18 @@ public:
...
@@ -55,17 +57,18 @@ public:
bool
calculating
()
const
;
bool
calculating
()
const
;
// Overrides
// Overrides
bool
load
(
const
QJsonObject
&
complexObject
,
int
sequenceNumber
,
virtual
bool
load
(
const
QJsonObject
&
complexObject
,
int
sequenceNumber
,
QString
&
errorString
)
override
final
;
QString
&
errorString
)
override
final
;
QString
mapVisualQML
(
void
)
const
override
final
;
virtual
QString
mapVisualQML
(
void
)
const
override
final
;
void
save
(
QJsonArray
&
planItems
)
override
final
;
virtual
void
save
(
QJsonArray
&
planItems
)
override
final
;
bool
specifiesCoordinate
(
void
)
const
override
final
;
virtual
bool
specifiesCoordinate
(
void
)
const
override
final
;
double
timeBetweenShots
(
void
)
override
final
;
virtual
double
timeBetweenShots
(
void
)
override
final
;
QString
commandDescription
(
void
)
const
override
final
;
virtual
QString
commandDescription
(
void
)
const
override
final
;
QString
commandName
(
void
)
const
override
final
;
virtual
QString
commandName
(
void
)
const
override
final
;
QString
abbreviation
(
void
)
const
override
final
;
virtual
QString
abbreviation
(
void
)
const
override
final
;
ReadyForSaveState
readyForSaveState
(
void
)
const
override
final
;
virtual
ReadyForSaveState
readyForSaveState
(
void
)
const
override
final
;
double
additionalTimeDelay
(
void
)
const
override
final
;
virtual
double
additionalTimeDelay
(
void
)
const
override
final
;
virtual
QString
patternName
(
void
)
const
override
;
// Generator
// Generator
bool
registerGenerator
(
const
QString
&
name
,
bool
registerGenerator
(
const
QString
&
name
,
...
@@ -80,7 +83,8 @@ public:
...
@@ -80,7 +83,8 @@ public:
static
const
char
*
settingsGroup
;
static
const
char
*
settingsGroup
;
static
const
char
*
variantName
;
static
const
char
*
variantName
;
static
const
char
*
CircularSurveyName
;
static
const
char
*
jsonComplexItemTypeValue
;
static
const
QString
name
;
signals:
signals:
void
calculatingChanged
();
void
calculatingChanged
();
...
@@ -90,27 +94,22 @@ signals:
...
@@ -90,27 +94,22 @@ signals:
private
slots
:
private
slots
:
// Overrides from TransectStyleComplexItem
// Overrides from TransectStyleComplexItem
v
oid
_rebuildTransectsPhase1
(
void
)
final
;
v
irtual
void
_rebuildTransectsPhase1
(
void
)
override
final
;
v
oid
_recalcCameraShots
(
void
)
final
;
v
irtual
void
_recalcCameraShots
(
void
)
override
final
;
// Worker functions.
// Worker functions.
void
_setTransects
(
PtrRoutingData
pRoute
);
void
_setTransects
(
PtrRoutingData
pRoute
);
void
_changeVariant
();
void
_changeVariant
();
void
_updateWorker
();
bool
_updateWorker
();
void
_changeVariantWorker
();
void
_changeVariantWorker
();
void
_reverseWorker
();
void
_reverseWorker
();
private:
private:
bool
_switchToGenerator
(
const
PtrGenerator
&
newG
);
bool
_switchToGenerator
(
const
PtrGenerator
&
newG
);
void
_setState
(
STATE
state
);
bool
_calculating
(
STATE
state
)
const
;
// State.
// State.
enum
class
STATE
{
IDLE
,
SKIPP
,
REVERSE
,
VARIANT_CHANGE
,
RUN_CHANGE
,
};
STATE
_state
;
STATE
_state
;
// center of the circular lanes, e.g. base station
// center of the circular lanes, e.g. base station
...
...
src/Wima/Geometry/WimaServiceArea.cc
View file @
3dc41359
#include "WimaServiceArea.h"
#include "WimaServiceArea.h"
#include "QGCLoggingCategory.h"
#include "QGCLoggingCategory.h"
#include "QGCQGeoCoordinate.h"
QGC_LOGGING_CATEGORY
(
WimaServiceAreaLog
,
"WimaServiceAreaLog"
)
QGC_LOGGING_CATEGORY
(
WimaServiceAreaLog
,
"WimaServiceAreaLog"
)
...
@@ -109,9 +110,9 @@ void WimaServiceArea::init() {
...
@@ -109,9 +110,9 @@ void WimaServiceArea::init() {
int
minIndex
=
0
;
int
minIndex
=
0
;
for
(
int
idx
=
0
;
idx
<
this
->
pathModel
().
count
();
++
idx
)
{
for
(
int
idx
=
0
;
idx
<
this
->
pathModel
().
count
();
++
idx
)
{
const
QObject
*
obj
=
this
->
pathModel
()[
idx
];
const
QObject
*
obj
=
this
->
pathModel
()[
idx
];
const
auto
*
vertex
=
qobject_cast
<
const
QGeoCoordinate
*>
(
obj
);
const
auto
*
vertex
=
qobject_cast
<
const
QG
CQG
eoCoordinate
*>
(
obj
);
if
(
vertex
!=
nullptr
)
{
if
(
vertex
!=
nullptr
)
{
auto
d
=
vertex
->
distanceTo
(
this
->
_depot
);
auto
d
=
vertex
->
coordinate
().
distanceTo
(
this
->
_depot
);
if
(
d
<
minDist
)
{
if
(
d
<
minDist
)
{
minDist
=
d
;
minDist
=
d
;
minIndex
=
idx
;
minIndex
=
idx
;
...
@@ -120,10 +121,10 @@ void WimaServiceArea::init() {
...
@@ -120,10 +121,10 @@ void WimaServiceArea::init() {
qCCritical
(
WimaServiceAreaLog
)
<<
"init(): nullptr catched!"
;
qCCritical
(
WimaServiceAreaLog
)
<<
"init(): nullptr catched!"
;
}
}
}
}
this
->
setDepot
(
*
this
->
pathModel
().
value
<
QGeoCoordinate
*>
(
minIndex
));
this
->
setDepot
(
this
->
pathModel
().
value
<
QGCQGeoCoordinate
*>
(
minIndex
)
->
coordinate
(
));
}
else
if
(
this
->
pathModel
().
count
()
>
0
)
{
}
else
if
(
this
->
pathModel
().
count
()
>
0
)
{
// Use first coordinate.
// Use first coordinate.
this
->
setDepot
(
*
this
->
pathModel
().
value
<
QGeoCoordinate
*>
(
0
));
this
->
setDepot
(
this
->
pathModel
().
value
<
QGCQGeoCoordinate
*>
(
0
)
->
coordinate
(
));
}
}
}
}
});
});
...
...
src/Wima/
WaypointManager/
Utils.cpp
→
src/Wima/Utils.cpp
View file @
3dc41359
File moved
src/Wima/
WaypointManager/
Utils.h
→
src/Wima/Utils.h
View file @
3dc41359
File moved
src/Wima/WimaPlaner.cc
View file @
3dc41359
...
@@ -350,7 +350,7 @@ void WimaPlaner::_update() {
...
@@ -350,7 +350,7 @@ void WimaPlaner::_update() {
// Create survey item if not yet present.
// Create survey item if not yet present.
if
(
surveyIndex
<
0
)
{
if
(
surveyIndex
<
0
)
{
_missionController
->
insertComplexMissionItem
(
_missionController
->
insertComplexMissionItem
(
_missionController
->
circularSurveyComplexItemName
()
,
CircularSurvey
::
name
,
_measurementArea
.
center
(),
missionItems
->
count
());
_measurementArea
.
center
(),
missionItems
->
count
());
_survey
=
qobject_cast
<
CircularSurvey
*>
(
_survey
=
qobject_cast
<
CircularSurvey
*>
(
missionItems
->
get
(
missionItems
->
count
()
-
1
));
missionItems
->
get
(
missionItems
->
count
()
-
1
));
...
@@ -361,10 +361,8 @@ void WimaPlaner::_update() {
...
@@ -361,10 +361,8 @@ void WimaPlaner::_update() {
}
}
// establish connections
// establish connections
connect
(
_survey
,
&
CircularSurvey
::
calculatingChanged
,
this
,
connect
(
_survey
,
&
CircularSurvey
::
visualTransectPointsChanged
,
this
,
&
WimaPlaner
::
CSCalculatingChangedHandler
);
&
WimaPlaner
::
CSVisualTransectPointsChangedHandler
);
connect
(
_survey
,
&
CircularSurvey
::
missionItemReady
,
this
,
&
WimaPlaner
::
CSMissionItemReadyHandler
);
connect
(
_survey
,
&
CircularSurvey
::
destroyed
,
this
,
connect
(
_survey
,
&
CircularSurvey
::
destroyed
,
this
,
&
WimaPlaner
::
CSDestroyedHandler
);
&
WimaPlaner
::
CSDestroyedHandler
);
}
}
...
@@ -470,15 +468,14 @@ void WimaPlaner::CSDestroyedHandler() {
...
@@ -470,15 +468,14 @@ void WimaPlaner::CSDestroyedHandler() {
this
->
_stateMachine
->
updateState
(
EVENT
::
SURVEY_DESTROYED
);
this
->
_stateMachine
->
updateState
(
EVENT
::
SURVEY_DESTROYED
);
}
}
void
WimaPlaner
::
CSMissionItemReadyHandler
()
{
void
WimaPlaner
::
CSVisualTransectPointsChangedHandler
()
{
if
(
this
->
_survey
&&
this
->
_survey
->
calculating
()){
this
->
_stateMachine
->
updateState
(
EVENT
::
SURVEY_UPDATE_TRIGGERED
);
}
else
{
this
->
_stateMachine
->
updateState
(
EVENT
::
SURVEY_UPDATED
);
this
->
_stateMachine
->
updateState
(
EVENT
::
SURVEY_UPDATED
);
this
->
_update
();
this
->
_update
();
}
}
void
WimaPlaner
::
CSCalculatingChangedHandler
()
{
if
(
this
->
_survey
->
calculating
())
{
this
->
_stateMachine
->
updateState
(
EVENT
::
SURVEY_UPDATE_TRIGGERED
);
}
}
}
void
WimaPlaner
::
mAreaPathChangedHandler
()
{
void
WimaPlaner
::
mAreaPathChangedHandler
()
{
...
@@ -608,10 +605,8 @@ bool WimaPlaner::loadFromFile(const QString &filename) {
...
@@ -608,10 +605,8 @@ bool WimaPlaner::loadFromFile(const QString &filename) {
// disconnect old survey
// disconnect old survey
if
(
_survey
!=
nullptr
)
{
if
(
_survey
!=
nullptr
)
{
disconnect
(
_survey
,
&
CircularSurvey
::
calculatingChanged
,
this
,
disconnect
(
_survey
,
&
CircularSurvey
::
visualTransectPointsChanged
,
this
,
&
WimaPlaner
::
CSCalculatingChangedHandler
);
&
WimaPlaner
::
CSVisualTransectPointsChangedHandler
);
disconnect
(
_survey
,
&
CircularSurvey
::
missionItemReady
,
this
,
&
WimaPlaner
::
CSMissionItemReadyHandler
);
disconnect
(
_survey
,
&
CircularSurvey
::
destroyed
,
this
,
disconnect
(
_survey
,
&
CircularSurvey
::
destroyed
,
this
,
&
WimaPlaner
::
CSDestroyedHandler
);
&
WimaPlaner
::
CSDestroyedHandler
);
}
}
...
@@ -753,10 +748,8 @@ bool WimaPlaner::loadFromFile(const QString &filename) {
...
@@ -753,10 +748,8 @@ bool WimaPlaner::loadFromFile(const QString &filename) {
for
(
int
i
=
0
;
i
<
missionItems
->
count
();
i
++
)
{
for
(
int
i
=
0
;
i
<
missionItems
->
count
();
i
++
)
{
_survey
=
missionItems
->
value
<
CircularSurvey
*>
(
i
);
_survey
=
missionItems
->
value
<
CircularSurvey
*>
(
i
);
if
(
_survey
!=
nullptr
)
{
if
(
_survey
!=
nullptr
)
{
connect
(
_survey
,
&
CircularSurvey
::
calculatingChanged
,
this
,
connect
(
_survey
,
&
CircularSurvey
::
visualTransectPointsChanged
,
this
,
&
WimaPlaner
::
CSCalculatingChangedHandler
);
&
WimaPlaner
::
CSVisualTransectPointsChangedHandler
);
connect
(
_survey
,
&
CircularSurvey
::
missionItemReady
,
this
,
&
WimaPlaner
::
CSMissionItemReadyHandler
);
connect
(
_survey
,
&
CircularSurvey
::
destroyed
,
this
,
connect
(
_survey
,
&
CircularSurvey
::
destroyed
,
this
,
&
WimaPlaner
::
CSDestroyedHandler
);
&
WimaPlaner
::
CSDestroyedHandler
);
break
;
break
;
...
...
src/Wima/WimaPlaner.h
View file @
3dc41359
...
@@ -127,8 +127,7 @@ private slots:
...
@@ -127,8 +127,7 @@ private slots:
void
updatePolygonInteractivity
(
int
index
);
void
updatePolygonInteractivity
(
int
index
);
void
_update
();
void
_update
();
void
CSDestroyedHandler
();
void
CSDestroyedHandler
();
void
CSMissionItemReadyHandler
();
void
CSVisualTransectPointsChangedHandler
();
void
CSCalculatingChangedHandler
();
void
mAreaPathChangedHandler
();
void
mAreaPathChangedHandler
();
void
mAreaTilesChangedHandler
();
void
mAreaTilesChangedHandler
();
void
mAreaProgressChangedHandler
();
void
mAreaProgressChangedHandler
();
...
...
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