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
8d2e42c4
Commit
8d2e42c4
authored
Jan 10, 2020
by
Valentin Platzgummer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
circular survey max waypoints added
parent
76edd9d2
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
87 additions
and
29 deletions
+87
-29
qgroundcontrol.qrc
qgroundcontrol.qrc
+2
-2
TransectStyleComplexItem.cc
src/MissionManager/TransectStyleComplexItem.cc
+3
-3
CircularSurveyItemEditor.qml
src/PlanView/CircularSurveyItemEditor.qml
+27
-10
TerrainQuery.cc
src/Terrain/TerrainQuery.cc
+3
-0
CircularSurvey.SettingsGroup.json
src/Wima/CircularSurvey.SettingsGroup.json
+8
-1
CircularSurveyComplexItem.cc
src/Wima/CircularSurveyComplexItem.cc
+38
-12
CircularSurveyComplexItem.h
src/Wima/CircularSurveyComplexItem.h
+6
-1
No files found.
qgroundcontrol.qrc
View file @
8d2e42c4
...
...
@@ -220,7 +220,7 @@
<file alias="QGroundControl/Controls/WimaMeasurementAreaMapVisual.qml">src/WimaView/WimaMeasurementAreaMapVisual.qml</file>
<file alias="QGroundControl/Controls/WimaCorridorMapVisual.qml">src/WimaView/WimaCorridorMapVisual.qml</file>
<file alias="QGroundControl/Controls/WimaMeasurementAreaEditor.qml">src/WimaView/WimaMeasurementAreaEditor.qml</file>
<file alias="
QGroundControl/Controls/CircularSurveyMapVisual
.qml">src/PlanView/CircularSurveyItemEditor.qml</file>
<file alias="
CircularSurveyItemEditor
.qml">src/PlanView/CircularSurveyItemEditor.qml</file>
<file alias="QGroundControl/Controls/DragCoordinate.qml">src/WimaView/DragCoordinate.qml</file>
<file alias="QGroundControl/Controls/CoordinateIndicatorDrag.qml">src/WimaView/CoordinateIndicatorDrag.qml</file>
<file alias="QGroundControl/Controls/CoordinateIndicator.qml">src/WimaView/CoordinateIndicator.qml</file>
...
...
@@ -229,7 +229,7 @@
<file alias="QGroundControl/FlightMap/WimaPlanMapItems.qml">src/FlightMap/MapItems/WimaPlanMapItems.qml</file>
<file alias="QGroundControl/FlightMap/WimaMissionItemMapVisual.qml">src/PlanView/WimaMissionItemMapVisual.qml</file>
<file alias="QGroundControl/FlightDisplay/FlightDisplayWimaMenu.qml">src/FlightDisplay/FlightDisplayWimaMenu.qml</file>
<file>src/WimaView/CircularSurveyMapVisual.qml</file>
<file
alias="QGroundControl/Controls/CircularSurveyMapVisual.qml"
>src/WimaView/CircularSurveyMapVisual.qml</file>
</qresource>
<qresource prefix="/json">
<file alias="APMMavlinkStreamRate.SettingsGroup.json">src/Settings/APMMavlinkStreamRate.SettingsGroup.json</file>
...
...
src/MissionManager/TransectStyleComplexItem.cc
View file @
8d2e42c4
...
...
@@ -358,10 +358,10 @@ void TransectStyleComplexItem::_rebuildTransects(void)
}
//CALLGRIND_TOGGLE_COLLECT;
auto
startTime
=
std
::
chrono
::
high_resolution_clock
::
now
();
//
auto startTime = std::chrono::high_resolution_clock::now();
_rebuildTransectsPhase1
();
auto
delta
=
std
::
chrono
::
duration_cast
<
std
::
chrono
::
microseconds
>
(
std
::
chrono
::
high_resolution_clock
::
now
()
-
startTime
).
count
();
qWarning
()
<<
"TransectStyleComplexItem::_rebuildTransects(): time: "
<<
delta
<<
" us"
;
//
auto delta = std::chrono::duration_cast<std::chrono::microseconds>(std::chrono::high_resolution_clock::now() - startTime).count();
//
qWarning() << "TransectStyleComplexItem::_rebuildTransects(): time: " << delta << " us";
//CALLGRIND_TOGGLE_COLLECT;
if
(
_followTerrain
)
{
...
...
src/PlanView/CircularSurveyItemEditor.qml
View file @
8d2e42c4
...
...
@@ -166,18 +166,35 @@ Rectangle {
onClicked
:
missionItem
.
resetReference
();
Layout.fillWidth
:
true
}
}
/*
Temporarily removed due to bug https://github.com/mavlink/qgroundcontrol/issues/7005
FactCheckBox {
text: qsTr("Split concave polygons")
fact: _splitConcave
visible: _splitConcave.visible
property Fact _splitConcave: missionItem.splitConcavePolygons
SectionHeader
{
id
:
miscellaneousHeader
text
:
qsTr
(
"
Miscellaneous
"
)
}
*/
ColumnLayout
{
anchors.left
:
parent
.
left
anchors.right
:
parent
.
right
spacing
:
_margin
visible
:
miscellaneousHeader
.
checked
GridLayout
{
Layout.fillWidth
:
true
columnSpacing
:
_margin
rowSpacing
:
_margin
columns
:
2
QGCLabel
{
text
:
qsTr
(
"
Max Waypoints
"
)
}
FactTextField
{
fact
:
missionItem
.
maxWaypoints
Layout.fillWidth
:
true
}
}
// GridLayout
}
// ColumnLayout
/*
// The following code causes seg. faults from time to time
SectionHeader {
id: terrainHeader
text: qsTr("Terrain")
...
...
@@ -222,7 +239,7 @@ Rectangle {
Layout.fillWidth: true
}
}
}
}
*/
/*SectionHeader {
id: statsHeader
...
...
src/Terrain/TerrainQuery.cc
View file @
8d2e42c4
...
...
@@ -362,10 +362,13 @@ void TerrainTileManager::addCoordinateQuery(TerrainOfflineAirMapQuery* terrainQu
void
TerrainTileManager
::
addPathQuery
(
TerrainOfflineAirMapQuery
*
terrainQueryInterface
,
const
QGeoCoordinate
&
startPoint
,
const
QGeoCoordinate
&
endPoint
)
{
// Convert to individual coordinate queries
//qDebug() << "TerrainTileManager::addPathQuery()" << startPoint;
QList
<
QGeoCoordinate
>
coordinates
;
double
lat
=
startPoint
.
latitude
();
double
lon
=
startPoint
.
longitude
();
double
steps
=
ceil
(
endPoint
.
distanceTo
(
startPoint
)
/
TerrainTile
::
terrainAltitudeSpacing
);
// if (qFuzzyIsNull(steps))
// return;
double
latDiff
=
endPoint
.
latitude
()
-
lat
;
double
lonDiff
=
endPoint
.
longitude
()
-
lon
;
for
(
double
i
=
0.0
;
i
<=
steps
;
i
=
i
+
1
)
{
...
...
src/Wima/CircularSurvey.SettingsGroup.json
View file @
8d2e42c4
...
...
@@ -35,8 +35,15 @@
},
{
"name"
:
"Reverse"
,
"shortDescription"
:
"Reverses the transect path"
,
"shortDescription"
:
"Reverses the transect path
.
"
,
"type"
:
"bool"
,
"defaultValue"
:
0
},
{
"name"
:
"MaxWaypoints"
,
"shortDescription"
:
"The maximum number of waypoints the circular survey can containt. To many waypoints cause a performance hit."
,
"type"
:
"uint32"
,
"defaultValue"
:
2000
,
"min"
:
1
}
]
src/Wima/CircularSurveyComplexItem.cc
View file @
8d2e42c4
...
...
@@ -10,6 +10,7 @@ const char* CircularSurveyComplexItem::deltaAlphaName = "DeltaAlpha"
const
char
*
CircularSurveyComplexItem
::
transectMinLengthName
=
"TransectMinLength"
;
const
char
*
CircularSurveyComplexItem
::
isSnakePathName
=
"IsSnakePath"
;
const
char
*
CircularSurveyComplexItem
::
reverseName
=
"Reverse"
;
const
char
*
CircularSurveyComplexItem
::
maxWaypointsName
=
"MaxWaypoints"
;
const
char
*
CircularSurveyComplexItem
::
jsonComplexItemTypeValue
=
"circularSurvey"
;
...
...
@@ -17,6 +18,7 @@ const char* CircularSurveyComplexItem::jsonDeltaRKey = "deltaR"
const
char
*
CircularSurveyComplexItem
::
jsonDeltaAlphaKey
=
"deltaAlpha"
;
const
char
*
CircularSurveyComplexItem
::
jsonTransectMinLengthKey
=
"transectMinLength"
;
const
char
*
CircularSurveyComplexItem
::
jsonIsSnakePathKey
=
"isSnakePath"
;
const
char
*
CircularSurveyComplexItem
::
jsonReverseKey
=
"reverse"
;
const
char
*
CircularSurveyComplexItem
::
jsonReferencePointLatKey
=
"referencePointLat"
;
const
char
*
CircularSurveyComplexItem
::
jsonReferencePointLongKey
=
"referencePointLong"
;
const
char
*
CircularSurveyComplexItem
::
jsonReferencePointAltKey
=
"referencePointAlt"
;
...
...
@@ -30,6 +32,7 @@ CircularSurveyComplexItem::CircularSurveyComplexItem(Vehicle *vehicle, bool flyV
,
_transectMinLength
(
settingsGroup
,
_metaDataMap
[
transectMinLengthName
])
,
_isSnakePath
(
settingsGroup
,
_metaDataMap
[
isSnakePathName
])
,
_reverse
(
settingsGroup
,
_metaDataMap
[
reverseName
])
,
_maxWaypoints
(
settingsGroup
,
_metaDataMap
[
maxWaypointsName
])
,
_isInitialized
(
false
)
,
_reverseOnly
(
false
)
,
_referencePointBeingChanged
(
false
)
...
...
@@ -41,6 +44,7 @@ CircularSurveyComplexItem::CircularSurveyComplexItem(Vehicle *vehicle, bool flyV
connect
(
&
_deltaAlpha
,
&
Fact
::
valueChanged
,
this
,
&
CircularSurveyComplexItem
::
_rebuildTransects
);
connect
(
&
_transectMinLength
,
&
Fact
::
valueChanged
,
this
,
&
CircularSurveyComplexItem
::
_rebuildTransects
);
connect
(
&
_isSnakePath
,
&
Fact
::
valueChanged
,
this
,
&
CircularSurveyComplexItem
::
_rebuildTransects
);
connect
(
&
_maxWaypoints
,
&
Fact
::
valueChanged
,
this
,
&
CircularSurveyComplexItem
::
_rebuildTransects
);
connect
(
&
_reverse
,
&
Fact
::
valueChanged
,
this
,
&
CircularSurveyComplexItem
::
_reverseTransects
);
connect
(
this
,
&
CircularSurveyComplexItem
::
refPointChanged
,
this
,
&
CircularSurveyComplexItem
::
_rebuildTransects
);
//connect(&_cameraCalc.distanceToSurface(), &Fact::rawValueChanged, this->)
...
...
@@ -123,6 +127,7 @@ bool CircularSurveyComplexItem::load(const QJsonObject &complexObject, int seque
{
jsonDeltaAlphaKey
,
QJsonValue
::
Double
,
true
},
{
jsonTransectMinLengthKey
,
QJsonValue
::
Double
,
true
},
{
jsonIsSnakePathKey
,
QJsonValue
::
Bool
,
true
},
{
jsonReverseKey
,
QJsonValue
::
Bool
,
true
},
{
jsonReferencePointLatKey
,
QJsonValue
::
Double
,
true
},
{
jsonReferencePointLongKey
,
QJsonValue
::
Double
,
true
},
{
jsonReferencePointAltKey
,
QJsonValue
::
Double
,
true
},
...
...
@@ -160,6 +165,7 @@ bool CircularSurveyComplexItem::load(const QJsonObject &complexObject, int seque
_referencePoint
.
setLatitude
(
complexObject
[
jsonReferencePointLatKey
].
toDouble
());
_referencePoint
.
setAltitude
(
complexObject
[
jsonReferencePointAltKey
].
toDouble
());
_isSnakePath
.
setRawValue
(
complexObject
[
jsonIsSnakePathKey
].
toBool
());
_reverse
.
setRawValue
(
complexObject
[
jsonReverseKey
].
toBool
());
setIsInitialized
(
true
);
_ignoreRecalc
=
false
;
...
...
@@ -187,6 +193,7 @@ void CircularSurveyComplexItem::save(QJsonArray &planItems)
saveObject
[
jsonDeltaAlphaKey
]
=
_deltaAlpha
.
rawValue
().
toDouble
();
saveObject
[
jsonTransectMinLengthKey
]
=
_transectMinLength
.
rawValue
().
toDouble
();
saveObject
[
jsonIsSnakePathKey
]
=
_isSnakePath
.
rawValue
().
toBool
();
saveObject
[
jsonReverseKey
]
=
_reverse
.
rawValue
().
toBool
();
saveObject
[
jsonReferencePointLongKey
]
=
_referencePoint
.
longitude
();
saveObject
[
jsonReferencePointLatKey
]
=
_referencePoint
.
latitude
();
saveObject
[
jsonReferencePointAltKey
]
=
_referencePoint
.
altitude
();
...
...
@@ -372,6 +379,7 @@ void CircularSurveyComplexItem::_rebuildTransectsPhase1()
return
;
_updateCounter
++
;
unsigned
int
waypointCounter
=
0
;
// If the transects are getting rebuilt then any previously loaded mission items are now invalid
if
(
_loadedMissionItemsParent
)
{
...
...
@@ -389,7 +397,11 @@ void CircularSurveyComplexItem::_rebuildTransectsPhase1()
// reverse transects and return
if
(
_reverseOnly
)
{
_reverseOnly
=
false
;
if
(
_transects
.
size
()
>
1
)
{
QList
<
QList
<
CoordInfo_t
>>
transectsReverse
;
transectsReverse
.
reserve
(
_transects
.
size
());
for
(
auto
list
:
_transects
)
{
QList
<
CoordInfo_t
>
listReverse
;
...
...
@@ -398,13 +410,11 @@ void CircularSurveyComplexItem::_rebuildTransectsPhase1()
transectsReverse
.
prepend
(
listReverse
);
}
_transects
=
transectsReverse
;
_transects
.
clear
();
_transects
.
append
(
transectsReverse
);
_reverseOnly
=
false
;
return
;
}
}
_transects
.
clear
();
QPolygonF
surveyPolygon
=
toQPolygonF
(
toCartesian2D
(
_surveyAreaPolygon
.
coordinateList
(),
_referencePoint
));
...
...
@@ -437,6 +447,7 @@ void CircularSurveyComplexItem::_rebuildTransectsPhase1()
double
lmin
=
_transectMinLength
.
rawValue
().
toDouble
();
double
r_min
=
dr
;
// meter
double
r_max
=
(
*
std
::
max_element
(
distances
.
begin
(),
distances
.
end
()));
// meter
unsigned
int
maxWaypoints
=
_maxWaypoints
.
rawValue
().
toUInt
();
QPointF
origin
(
0
,
0
);
IntersectType
type
;
...
...
@@ -546,14 +557,21 @@ void CircularSurveyComplexItem::_rebuildTransectsPhase1()
QVector
<
QPointF
>
sectorPath
=
circle
.
approximateSektor
(
numNodes
,
alpha1
,
alpha2
);
// use shortestPath() here if necessary, could be a problem if dr >>
if
(
sectorPath
.
size
()
>
0
)
if
(
sectorPath
.
size
()
>
0
)
{
waypointCounter
+=
uint
(
sectorPath
.
size
());
if
(
waypointCounter
>
maxWaypoints
)
return
;
transectPath
.
append
(
sectorPath
);
}
}
}
else
if
(
originInside
)
{
// circle fully inside polygon
int
numNodes
=
int
(
ceil
(
2
*
M_PI
/
dalpha
))
+
1
;
QVector
<
QPointF
>
sectorPath
=
circle
.
approximateSektor
(
numNodes
,
0
,
2
*
M_PI
);
// use shortestPath() here if necessary, could be a problem if dr >>
waypointCounter
+=
uint
(
sectorPath
.
size
());
if
(
waypointCounter
>
maxWaypoints
)
return
;
transectPath
.
append
(
sectorPath
);
}
r
+=
dr
;
...
...
@@ -613,6 +631,9 @@ void CircularSurveyComplexItem::_rebuildTransectsPhase1()
optiPath
.
append
(
currentSection
);
// append last section
if
(
optiPath
.
size
()
>
_maxWaypoints
.
rawValue
().
toInt
())
return
;
// convert to CoordInfo_t
if
(
_reverse
.
rawValue
().
toBool
())
...
...
@@ -669,6 +690,11 @@ Fact *CircularSurveyComplexItem::reverse()
return
&
_reverse
;
}
Fact
*
CircularSurveyComplexItem
::
maxWaypoints
()
{
return
&
_maxWaypoints
;
}
...
...
src/Wima/CircularSurveyComplexItem.h
View file @
8d2e42c4
...
...
@@ -24,6 +24,7 @@ public:
Q_PROPERTY
(
Fact
*
transectMinLength
READ
transectMinLength
CONSTANT
)
Q_PROPERTY
(
Fact
*
isSnakePath
READ
isSnakePath
CONSTANT
)
Q_PROPERTY
(
Fact
*
reverse
READ
reverse
CONSTANT
)
Q_PROPERTY
(
Fact
*
maxWaypoints
READ
maxWaypoints
CONSTANT
)
Q_PROPERTY
(
bool
isInitialized
READ
isInitialized
WRITE
setIsInitialized
NOTIFY
isInitializedChanged
)
Q_INVOKABLE
void
resetReference
(
void
);
...
...
@@ -41,6 +42,7 @@ public:
Fact
*
transectMinLength
();
Fact
*
isSnakePath
();
Fact
*
reverse
();
Fact
*
maxWaypoints
();
// Is true if survey was automatically generated, prevents initialisation from gui.
bool
isInitialized
();
bool
referencePointBeingChanged
();
// returns true if the referencepoint is being changed (dragged by user)
...
...
@@ -69,12 +71,14 @@ public:
static
const
char
*
transectMinLengthName
;
static
const
char
*
isSnakePathName
;
static
const
char
*
reverseName
;
static
const
char
*
maxWaypointsName
;
static
const
char
*
jsonComplexItemTypeValue
;
static
const
char
*
jsonDeltaRKey
;
static
const
char
*
jsonDeltaAlphaKey
;
static
const
char
*
jsonTransectMinLengthKey
;
static
const
char
*
jsonIsSnakePathKey
;
static
const
char
*
jsonReverseKey
;
static
const
char
*
jsonReferencePointLongKey
;
static
const
char
*
jsonReferencePointLatKey
;
static
const
char
*
jsonReferencePointAltKey
;
...
...
@@ -108,6 +112,7 @@ private:
SettingsFact
_transectMinLength
;
// minimal transect lenght, transects are rejected if they are shorter than this value
SettingsFact
_isSnakePath
;
// bool value, determining if transects are connected in a snake like or zig zag like manner
SettingsFact
_reverse
;
// reverses the _transects path
SettingsFact
_maxWaypoints
;
// the maximum number of waypoints _transects (TransectStyleComplexItem) can contain (to avoid performance hits)
QTimer
_updateTimer
;
...
...
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