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
8cf21ae7
Commit
8cf21ae7
authored
Sep 02, 2019
by
Valentin Platzgummer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
survey works now
parent
887e51f1
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
87 additions
and
8 deletions
+87
-8
ToDo.txt
ToDo.txt
+2
-2
CircularSurveyComplexItem.cc
src/Wima/CircularSurveyComplexItem.cc
+15
-0
CircularSurveyComplexItem.h
src/Wima/CircularSurveyComplexItem.h
+8
-0
OptimisationTools.h
src/Wima/OptimisationTools.h
+7
-0
WimaPlaner.cc
src/Wima/WimaPlaner.cc
+50
-4
SphericalSurveyMapVisual.qml
src/WimaView/SphericalSurveyMapVisual.qml
+5
-2
No files found.
ToDo.txt
View file @
8cf21ae7
optimize circular survey
remove Reference artefacts
solve Dijkstra issue (path not found, or not minimal)
profile survey
add dijkstra to flight view
src/Wima/CircularSurveyComplexItem.cc
View file @
8cf21ae7
...
...
@@ -11,6 +11,7 @@ CircularSurveyComplexItem::CircularSurveyComplexItem(Vehicle *vehicle, bool flyV
,
_metaDataMap
(
FactMetaData
::
createMapFromJsonFile
(
QStringLiteral
(
":/json/CircularSurvey.SettingsGroup.json"
),
this
))
,
_deltaR
(
settingsGroup
,
_metaDataMap
[
deltaRName
])
,
_deltaAlpha
(
settingsGroup
,
_metaDataMap
[
deltaAlphaName
])
,
_autoGenerated
(
false
)
{
_editorQml
=
"qrc:/qml/CircularSurveyItemEditor.qml"
;
...
...
@@ -37,6 +38,15 @@ void CircularSurveyComplexItem::setRefPoint(const QGeoCoordinate &refPt)
}
}
void
CircularSurveyComplexItem
::
setAutoGenerated
(
bool
autoGen
)
{
if
(
autoGen
!=
_autoGenerated
)
{
_autoGenerated
=
autoGen
;
emit
autoGeneratedChanged
();
}
}
QGeoCoordinate
CircularSurveyComplexItem
::
refPoint
()
const
{
return
_referencePoint
;
...
...
@@ -52,6 +62,11 @@ Fact *CircularSurveyComplexItem::deltaAlpha()
return
&
_deltaAlpha
;
}
bool
CircularSurveyComplexItem
::
autoGenerated
()
{
return
_autoGenerated
;
}
bool
CircularSurveyComplexItem
::
load
(
const
QJsonObject
&
complexObject
,
int
sequenceNumber
,
QString
&
errorString
)
{
return
false
;
...
...
src/Wima/CircularSurveyComplexItem.h
View file @
8cf21ae7
...
...
@@ -20,14 +20,19 @@ public:
Q_PROPERTY
(
QGeoCoordinate
refPoint
READ
refPoint
WRITE
setRefPoint
NOTIFY
refPointChanged
)
Q_PROPERTY
(
Fact
*
deltaR
READ
deltaR
CONSTANT
)
Q_PROPERTY
(
Fact
*
deltaAlpha
READ
deltaAlpha
CONSTANT
)
Q_PROPERTY
(
bool
autoGenerated
READ
autoGenerated
NOTIFY
autoGeneratedChanged
)
// Property setters
void
setRefPoint
(
const
QGeoCoordinate
&
refPt
);
// Set this to true if survey was automatically generated, prevents initialisation from gui.
void
setAutoGenerated
(
bool
autoGen
);
// Property getters
QGeoCoordinate
refPoint
()
const
;
Fact
*
deltaR
();
Fact
*
deltaAlpha
();
// Is true if survey was automatically generated, prevents initialisation from gui.
bool
autoGenerated
();
// Overrides from ComplexMissionItem
bool
load
(
const
QJsonObject
&
complexObject
,
int
sequenceNumber
,
QString
&
errorString
)
final
;
...
...
@@ -53,6 +58,7 @@ public:
signals:
void
refPointChanged
();
void
autoGeneratedChanged
();
private
slots
:
// Overrides from TransectStyleComplexItem
...
...
@@ -72,6 +78,8 @@ private:
SettingsFact
_deltaAlpha
;
QTimer
_updateTimer
;
bool
_autoGenerated
;
// set to true if survey was automatically generated, prevents initialisation from gui
};
...
...
src/Wima/OptimisationTools.h
View file @
8cf21ae7
...
...
@@ -46,6 +46,10 @@ namespace OptimisationTools {
workingSet
.
append
(
&
nodeList
[
i
]);
}
// double d1 = distanceDij(elements[0], elements[1]);
// double d2 = distanceDij(elements[0], elements[5]);
// double d3 = distanceDij(elements[5], elements[1]);
nodeList
[
startIndex
].
distance
=
0
;
// Dijkstra Algorithm
...
...
@@ -67,6 +71,9 @@ namespace OptimisationTools {
Node
*
u
=
workingSet
.
takeAt
(
minDistIndex
);
if
(
u
->
element
==
elements
[
endIndex
])
// shortest path found
break
;
//update distance
for
(
int
i
=
0
;
i
<
workingSet
.
size
();
i
++
)
{
Node
*
v
=
workingSet
[
i
];
...
...
src/Wima/WimaPlaner.cc
View file @
8cf21ae7
...
...
@@ -215,9 +215,30 @@ bool WimaPlaner::updateMission()
_visualItems
.
append
(
&
_joinedArea
);
#endif
// extract old survey data
QmlObjectListModel
*
missionItems
=
_missionController
->
visualItems
();
CircularSurveyComplexItem
*
OldSurveyPt
=
nullptr
;
QGeoCoordinate
oldSurveyRef
;
double
oldSurveyDeltaR
=
0
;
double
oldSurveyDeltaAlpha
=
0
;
bool
oldSurveyExists
=
false
;
for
(
int
i
=
0
;
i
<
_missionController
->
visualItems
()
->
count
();
i
++
)
{
OldSurveyPt
=
qobject_cast
<
CircularSurveyComplexItem
*>
(
missionItems
->
get
(
i
));
if
(
OldSurveyPt
!=
nullptr
)
{
oldSurveyRef
=
OldSurveyPt
->
refPoint
();
oldSurveyDeltaR
=
OldSurveyPt
->
deltaR
()
->
rawValue
().
toDouble
();
oldSurveyDeltaAlpha
=
OldSurveyPt
->
deltaAlpha
()
->
rawValue
().
toDouble
();
oldSurveyExists
=
true
;
break
;
}
}
// reset visual items
_missionController
->
removeAll
();
QmlObjectListModel
*
missionItems
=
_missionController
->
visualItems
();
missionItems
=
_missionController
->
visualItems
();
// set home position to serArea center
MissionSettingsItem
*
settingsItem
=
qobject_cast
<
MissionSettingsItem
*>
(
missionItems
->
get
(
0
));
if
(
settingsItem
==
nullptr
){
...
...
@@ -248,21 +269,36 @@ bool WimaPlaner::updateMission()
// create survey item, will be extened with more()-> mission types in the future
_missionController
->
insertComplexMissionItem
(
_missionController
->
circularSurveyComplexItemName
(),
_measurementArea
.
center
(),
missionItems
->
count
());
CircularSurveyComplexItem
*
survey
=
qobject_cast
<
CircularSurveyComplexItem
*>
(
missionItems
->
get
(
missionItems
->
count
()
-
1
));
if
(
survey
==
nullptr
){
qWarning
(
"WimaPlaner::updateMission(): survey == nullptr"
);
return
false
;
}
else
{
if
(
oldSurveyExists
)
{
survey
->
setRefPoint
(
oldSurveyRef
);
survey
->
deltaR
()
->
setRawValue
(
oldSurveyDeltaR
);
survey
->
deltaAlpha
()
->
setRawValue
(
oldSurveyDeltaAlpha
);
}
else
{
survey
->
setRefPoint
(
_measurementArea
.
center
());
}
survey
->
setAutoGenerated
(
true
);
// prevents reinitialisation from gui
survey
->
surveyAreaPolygon
()
->
clear
();
survey
->
surveyAreaPolygon
()
->
appendVertices
(
_measurementArea
.
coordinateList
());
}
// calculate path from take off to opArea
if
(
survey
->
visualTransectPoints
().
size
()
==
0
)
{
qWarning
(
"WimaPlaner::updateMission(): survey no points."
);
return
false
;
}
QGeoCoordinate
start
=
_serviceArea
.
center
();
QGeoCoordinate
end
=
survey
->
visualTransectPoints
().
first
().
value
<
QGeoCoordinate
>
();
QGeoCoordinate
end
=
survey
->
coordinate
();
if
(
!
_visualItems
.
contains
(
&
_joinedArea
))
_visualItems
.
append
(
&
_joinedArea
);
...
...
@@ -271,19 +307,29 @@ bool WimaPlaner::updateMission()
qgcApp
()
->
showMessage
(
QString
(
tr
(
"Not able to calculate the path from takeoff position to measurement area."
)).
toLocal8Bit
().
data
());
return
false
;
}
// path.clear();
// path.append(end);
// path.append(start);
// path.append(end);
// path.append(end);
for
(
int
i
=
1
;
i
<
path
.
count
()
-
1
;
i
++
)
{
sequenceNumber
=
_missionController
->
insertSimpleMissionItem
(
path
.
value
(
i
),
missionItems
->
count
()
-
1
);
_missionController
->
setCurrentPlanViewIndex
(
sequenceNumber
,
true
);
}
// calculate return path
start
=
survey
->
visualTransectPoints
().
last
().
value
<
QGeoCoordinate
>
();
start
=
survey
->
exitCoordinate
();
end
=
_serviceArea
.
center
();
path
.
clear
();
if
(
!
calcShortestPath
(
start
,
end
,
path
))
{
qgcApp
()
->
showMessage
(
QString
(
tr
(
"Not able to calculate the path from measurement area to landing position."
)).
toLocal8Bit
().
data
());
return
false
;
}
// path.clear();
// path.append(end);
// path.append(start);
// path.append(end);
// path.append(end);
for
(
int
i
=
1
;
i
<
path
.
count
()
-
1
;
i
++
)
{
sequenceNumber
=
_missionController
->
insertSimpleMissionItem
(
path
.
value
(
i
),
missionItems
->
count
());
_missionController
->
setCurrentPlanViewIndex
(
sequenceNumber
,
true
);
...
...
@@ -583,7 +629,7 @@ bool WimaPlaner::calcShortestPath(const QGeoCoordinate &start, const QGeoCoordin
/*start point*/
QPointF
(
0
,
0
),
/*destination*/
toCartesian2D
(
destination
,
start
),
/*shortest path*/
path2D
);
path
.
append
(
toGeo
(
path2D
,
/*origin*/
start
));
path
.
append
(
toGeo
(
path2D
,
/*origin*/
start
));
return
retVal
;
}
...
...
src/WimaView/SphericalSurveyMapVisual.qml
View file @
8cf21ae7
...
...
@@ -90,9 +90,12 @@ Item {
}
Component.onCompleted
:
{
_addInitialPolygon
()
if
(
!
_missionItem
.
autoGenerated
)
{
_addInitialPolygon
()
_setRefPoint
()
}
_addVisualElements
()
_setRefPoint
()
}
Component.onDestruction
:
{
...
...
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