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
de01b189
Commit
de01b189
authored
Oct 10, 2019
by
Valentin Platzgummer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wp added to flight view
parent
00b3967d
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
194 additions
and
55 deletions
+194
-55
qgroundcontrol.qrc
qgroundcontrol.qrc
+1
-0
FlightDisplayViewMap.qml
src/FlightDisplay/FlightDisplayViewMap.qml
+3
-2
MissionItemIndicator.qml
src/FlightMap/MapItems/MissionItemIndicator.qml
+2
-0
WimaPlanMapItems.qml
src/FlightMap/MapItems/WimaPlanMapItems.qml
+11
-9
SimpleMissionItem.cc
src/MissionManager/SimpleMissionItem.cc
+1
-1
WimaMissionItemMapVisual.qml
src/PlanView/WimaMissionItemMapVisual.qml
+118
-0
WimaController.cc
src/Wima/WimaController.cc
+25
-12
WimaController.h
src/Wima/WimaController.h
+8
-3
WimaPlaner.cc
src/Wima/WimaPlaner.cc
+25
-28
No files found.
qgroundcontrol.qrc
View file @
de01b189
...
...
@@ -228,6 +228,7 @@
<file alias="QGroundControl/Controls/WimaJoinedAreaMapVisual.qml">src/WimaView/WimaJoinedAreaMapVisual.qml</file>
<file alias="QGroundControl/Controls/WimaCorridorEditor.qml">src/WimaView/WimaCorridorEditor.qml</file>
<file alias="QGroundControl/FlightMap/WimaPlanMapItems.qml">src/FlightMap/MapItems/WimaPlanMapItems.qml</file>
<file alias="QGroundControl/Controls/WimaMissionItemMapVisual.qml">src/PlanView/WimaMissionItemMapVisual.qml</file>
</qresource>
<qresource prefix="/json">
<file alias="APMMavlinkStreamRate.SettingsGroup.json">src/Settings/APMMavlinkStreamRate.SettingsGroup.json</file>
...
...
src/FlightDisplay/FlightDisplayViewMap.qml
View file @
de01b189
...
...
@@ -205,7 +205,7 @@ FlightMap {
:
object
.
type
===
"
WimaMeasurementAreaData
"
?
"
green
"
:
"
transparent
"
opacity
:
0.25
z
:
QGroundControl
.
zOrderTrajectoryLines
-
1
z
:
QGroundControl
.
zOrderTrajectoryLines
-
2
}
}
...
...
@@ -214,7 +214,8 @@ FlightMap {
map
:
flightMap
largeMapView
:
_mainIsMap
wimaController
:
flightMap
.
wimaController
z
:
1000
z
:
QGroundControl
.
zOrderTrajectoryLines
-
1
color
:
"
gray
"
}
// Add trajectory points to the map
...
...
src/FlightMap/MapItems/MissionItemIndicator.qml
View file @
de01b189
...
...
@@ -21,6 +21,7 @@ MapQuickItem {
property
var
missionItem
property
int
sequenceNumber
property
var
color
signal
clicked
...
...
@@ -37,6 +38,7 @@ MapQuickItem {
vehicleYaw
:
missionItem
.
missionVehicleYaw
showGimbalYaw
:
!
isNaN
(
missionItem
.
missionGimbalYaw
)
onClicked
:
_item
.
clicked
()
color
:
_item
.
color
property
bool
_isCurrentItem
:
missionItem
?
missionItem
.
isCurrentItem
:
false
}
...
...
src/FlightMap/MapItems/WimaPlanMapItems.qml
View file @
de01b189
...
...
@@ -22,6 +22,7 @@ Item {
property
var
map
///< Map control to show items on
property
bool
largeMapView
///< true: map takes up entire view, false: map is in small window
property
var
wimaController
property
var
color
property
var
_map
:
map
property
var
_missionLineViewComponent
...
...
@@ -30,14 +31,15 @@ Item {
Repeater
{
model
:
largeMapView
?
wimaController
.
missionItems
:
0
delegate
:
MissionItemMapVisual
{
delegate
:
Wima
MissionItemMapVisual
{
map
:
_map
onClicked
:
{
if
(
isActiveVehicle
)
{
// Only active vehicle supports click to change current mission item
guidedActionsController
.
confirmAction
(
guidedActionsController
.
actionSetWaypoint
,
Math
.
max
(
object
.
sequenceNumber
,
1
))
}
}
color
:
_root
.
color
// onClicked: {
// if (isActiveVehicle) {
// // Only active vehicle supports click to change current mission item
// guidedActionsController.confirmAction(guidedActionsController.actionSetWaypoint, Math.max(object.sequenceNumber, 1))
// }
// }
}
/*onItemAdded: {
...
...
@@ -66,9 +68,9 @@ Item {
MapPolyline
{
line.width
:
3
line.color
:
"
#be781c
"
// Hack, can't get palette to work in here
line.color
:
"
gray
"
// Hack, can't get palette to work in here
z
:
QGroundControl
.
zOrderWaypointLines
path
:
undefined
//
wimaController.waypointPath
path
:
wimaController
.
waypointPath
}
}
}
src/MissionManager/SimpleMissionItem.cc
View file @
de01b189
...
...
@@ -148,7 +148,7 @@ SimpleMissionItem::SimpleMissionItem(Vehicle* vehicle, bool flyView, const Missi
SimpleMissionItem
::
SimpleMissionItem
(
const
SimpleMissionItem
&
other
,
bool
flyView
,
QObject
*
parent
)
:
VisualMissionItem
(
other
,
flyView
,
parent
)
,
_missionItem
(
other
.
_
vehicle
)
,
_missionItem
(
other
.
_
missionItem
,
this
)
,
_rawEdit
(
false
)
,
_dirty
(
false
)
,
_ignoreDirtyChangeSignals
(
false
)
...
...
src/PlanView/WimaMissionItemMapVisual.qml
0 → 100644
View file @
de01b189
/****************************************************************************
*
* (c) 2009-2016 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
*
* QGroundControl is licensed according to the terms in the file
* COPYING.md in the root of the source code directory.
*
****************************************************************************/
import
QtQuick
2.3
import
QtQuick
.
Controls
1.2
import
QtLocation
5.3
import
QtPositioning
5.3
import
QGroundControl
1.0
import
QGroundControl
.
ScreenTools
1.0
import
QGroundControl
.
Palette
1.0
import
QGroundControl
.
Controls
1.0
import
QGroundControl
.
FlightMap
1.0
/// Simple Mission Item visuals
Item
{
id
:
_root
property
var
map
///< Map control to place item in
property
var
qgcView
///< QGCView to use for popping dialogs
property
var
color
property
var
_missionItem
:
object
property
var
_itemVisual
property
var
_dragArea
property
bool
_itemVisualShowing
:
false
property
bool
_dragAreaShowing
:
false
signal
clicked
(
int
sequenceNumber
)
function
hideItemVisuals
()
{
if
(
_itemVisualShowing
)
{
_itemVisual
.
destroy
()
_itemVisualShowing
=
false
}
}
function
showItemVisuals
()
{
if
(
!
_itemVisualShowing
)
{
_itemVisual
=
indicatorComponent
.
createObject
(
map
)
map
.
addMapItem
(
_itemVisual
)
_itemVisualShowing
=
true
}
}
function
hideDragArea
()
{
if
(
_dragAreaShowing
)
{
_dragArea
.
destroy
()
_dragAreaShowing
=
false
}
}
function
showDragArea
()
{
if
(
!
_dragAreaShowing
&&
_missionItem
.
specifiesCoordinate
)
{
_dragArea
=
dragAreaComponent
.
createObject
(
map
)
_dragAreaShowing
=
true
}
}
Component.onCompleted
:
{
showItemVisuals
()
if
(
_missionItem
.
isCurrentItem
&&
map
.
planView
)
{
showDragArea
()
}
}
Component
.
onDestruction
:
{
hideDragArea
()
hideItemVisuals
()
}
Connections
{
target
:
_missionItem
onIsCurrentItemChanged
:
{
if
(
_missionItem
.
isCurrentItem
)
{
showDragArea
()
}
else
{
hideDragArea
()
}
}
}
// Control which is used to drag items
Component
{
id
:
dragAreaComponent
MissionItemIndicatorDrag
{
mapControl
:
_root
.
map
itemIndicator
:
_itemVisual
itemCoordinate
:
_missionItem
.
coordinate
onItemCoordinateChanged
:
_missionItem
.
coordinate
=
itemCoordinate
}
}
Component
{
id
:
indicatorComponent
MissionItemIndicator
{
coordinate
:
_missionItem
.
coordinate
visible
:
_missionItem
.
specifiesCoordinate
z
:
QGroundControl
.
zOrderMapItems
missionItem
:
_missionItem
sequenceNumber
:
_missionItem
.
sequenceNumber
color
:
_root
.
color
onClicked
:
_root
.
clicked
(
_missionItem
.
sequenceNumber
)
}
}
}
src/Wima/WimaController.cc
View file @
de01b189
...
...
@@ -38,7 +38,7 @@ QStringList WimaController::saveNameFilters() const
return
filters
;
}
WimaDataContainer
*
WimaController
::
dataContainer
()
const
WimaDataContainer
*
WimaController
::
dataContainer
()
{
return
_container
;
}
...
...
@@ -48,6 +48,11 @@ QmlObjectListModel *WimaController::missionItems()
return
&
_missionItems
;
}
QVariantList
WimaController
::
waypointPath
()
{
return
_waypointPath
;
}
void
WimaController
::
setMasterController
(
PlanMasterController
*
masterC
)
{
_masterController
=
masterC
;
...
...
@@ -159,14 +164,11 @@ void WimaController::containerDataValidChanged(bool valid)
int
areaCounter
=
0
;
int
numAreas
=
4
;
// extract only numAreas Areas, if there are more they are invalid and ignored
qWarning
()
<<
QString
(
"List Size: %1"
).
arg
(
areaList
.
size
());
for
(
int
i
=
0
;
i
<
areaList
.
size
();
i
++
)
{
const
WimaAreaData
*
areaData
=
areaList
[
i
];
qWarning
()
<<
areaData
->
type
();
if
(
areaData
->
type
()
==
WimaServiceAreaData
::
typeString
)
{
// is it a service area?
_serviceArea
=
*
qobject_cast
<
const
WimaServiceAreaData
*>
(
areaData
);
// qWarning("Service area, wuhuuu!");
areaCounter
++
;
_visualItems
.
append
(
&
_serviceArea
);
...
...
@@ -175,7 +177,6 @@ void WimaController::containerDataValidChanged(bool valid)
if
(
areaData
->
type
()
==
WimaMeasurementAreaData
::
typeString
)
{
// is it a measurement area?
_measurementArea
=
*
qobject_cast
<
const
WimaMeasurementAreaData
*>
(
areaData
);
// qWarning("Measurement area, wuhuuu!");
areaCounter
++
;
_visualItems
.
append
(
&
_measurementArea
);
...
...
@@ -184,7 +185,6 @@ void WimaController::containerDataValidChanged(bool valid)
if
(
areaData
->
type
()
==
WimaCorridorData
::
typeString
)
{
// is it a corridor?
_corridor
=
*
qobject_cast
<
const
WimaCorridorData
*>
(
areaData
);
// qWarning("WimaCorridorData, wuhuuu!");
areaCounter
++
;
//_visualItems.append(&_corridor); // not needed
...
...
@@ -193,7 +193,6 @@ void WimaController::containerDataValidChanged(bool valid)
if
(
areaData
->
type
()
==
WimaJoinedAreaData
::
typeString
)
{
// is it a corridor?
_joinedArea
=
*
qobject_cast
<
const
WimaJoinedAreaData
*>
(
areaData
);
// qWarning("WimaJoinedAreaData, wuhuuu!");
areaCounter
++
;
_visualItems
.
append
(
&
_joinedArea
);
...
...
@@ -213,8 +212,9 @@ void WimaController::containerDataValidChanged(bool valid)
_missionController
->
removeAll
();
QmlObjectListModel
*
missionControllerVisualItems
=
_missionController
->
visualItems
();
for
(
auto
missionItem
:
tempMissionItems
)
for
(
auto
missionItem
:
tempMissionItems
)
{
_missionController
->
insertSimpleMissionItem
(
*
missionItem
,
missionControllerVisualItems
->
count
());
}
MissionSettingsItem
*
settingsItem
=
qobject_cast
<
MissionSettingsItem
*>
((
*
missionControllerVisualItems
)[
0
]);
if
(
settingsItem
==
nullptr
)
{
...
...
@@ -233,10 +233,7 @@ void WimaController::containerDataValidChanged(bool valid)
_missionItems
.
append
(
visualItemCopy
);
}
// remove warnings if you read this
qWarning
(
"WimaController::containerDataValidChanged(): Mission Item count:"
);
qWarning
()
<<
_missionItems
.
count
();
updateWaypointPath
();
_missionController
->
removeAll
();
if
(
areaCounter
==
numAreas
)
...
...
@@ -257,6 +254,22 @@ void WimaController::containerDataValidChanged(bool valid)
#endif
}
void
WimaController
::
updateWaypointPath
()
{
_waypointPath
.
clear
();
for
(
int
i
=
1
;
i
<
_missionItems
.
count
();
i
++
)
{
SimpleMissionItem
*
item
=
qobject_cast
<
SimpleMissionItem
*>
(
_missionItems
[
i
]);
if
(
item
==
nullptr
)
{
qWarning
(
"WimaController::updateWaypointPath(): nullptr"
);
return
;
}
_waypointPath
.
append
(
QVariant
::
fromValue
(
item
->
coordinate
()));
}
emit
waypointPathChanged
();
}
...
...
src/Wima/WimaController.h
View file @
de01b189
...
...
@@ -39,21 +39,23 @@ public:
Q_PROPERTY
(
QStringList
loadNameFilters
READ
loadNameFilters
CONSTANT
)
Q_PROPERTY
(
QStringList
saveNameFilters
READ
saveNameFilters
CONSTANT
)
Q_PROPERTY
(
QString
fileExtension
READ
fileExtension
CONSTANT
)
Q_PROPERTY
(
WimaDataContainer
*
dataContainer
READ
dataContainer
WRITE
setDataContainer
NOTIFY
dataContainerChanged
)
Q_PROPERTY
(
WimaDataContainer
*
dataContainer
READ
dataContainer
WRITE
setDataContainer
NOTIFY
dataContainerChanged
)
Q_PROPERTY
(
QmlObjectListModel
*
missionItems
READ
missionItems
NOTIFY
missionItemsChanged
)
Q_PROPERTY
(
QVariantList
waypointPath
READ
waypointPath
NOTIFY
waypointPathChanged
)
// Property accessors
PlanMasterController
*
masterController
(
void
)
{
return
_masterController
;
}
MissionController
*
missionController
(
void
)
{
return
_missionController
;
}
QmlObjectListModel
*
visualItems
(
void
)
;
QmlObjectListModel
*
visualItems
(
void
);
QString
currentFile
(
void
)
const
{
return
_currentFile
;
}
QStringList
loadNameFilters
(
void
)
const
;
QStringList
saveNameFilters
(
void
)
const
;
QString
fileExtension
(
void
)
const
{
return
wimaFileExtension
;
}
QGCMapPolygon
joinedArea
(
void
)
const
;
WimaDataContainer
*
dataContainer
(
void
)
const
;
WimaDataContainer
*
dataContainer
(
void
);
QmlObjectListModel
*
missionItems
(
void
);
QVariantList
waypointPath
(
void
);
// Property setters
...
...
@@ -90,9 +92,11 @@ signals:
void
dataContainerChanged
();
void
readyForSaveSendChanged
(
bool
ready
);
void
missionItemsChanged
(
void
);
void
waypointPathChanged
(
void
);
private
slots
:
void
containerDataValidChanged
(
bool
valid
);
void
updateWaypointPath
(
void
);
private:
PlanMasterController
*
_masterController
;
...
...
@@ -106,5 +110,6 @@ private:
WimaCorridorData
_corridor
;
// corridor connecting opArea and serArea
bool
_localPlanDataValid
;
QmlObjectListModel
_missionItems
;
// all mission itmes generaded by wimaPlaner, displayed in flightView
QVariantList
_waypointPath
;
};
src/Wima/WimaPlaner.cc
View file @
de01b189
...
...
@@ -242,7 +242,6 @@ bool WimaPlaner::updateMission()
qWarning
(
"WimaPlaner::updateMission(): settingsItem == nullptr"
);
return
false
;
}
// set altitudes, temporary measure to solve bugs
QGeoCoordinate
center
=
_serviceArea
.
center
();
center
.
setAltitude
(
0
);
...
...
@@ -253,15 +252,20 @@ bool WimaPlaner::updateMission()
center
=
_corridor
.
center
();
center
.
setAltitude
(
0
);
_corridor
.
setCenter
(
center
);
// set HomePos. to serArea center
settingsItem
->
setCoordinate
(
_serviceArea
.
center
());
// create take off position item
int
sequenceNumber
=
_missionController
->
insertSimpleMissionItem
(
_serviceArea
.
center
(),
missionItems
->
count
());
_missionController
->
setCurrentPlanViewIndex
(
sequenceNumber
,
true
);
_missionController
->
setCurrentPlanViewIndex
(
sequenceNumber
,
true
);
SimpleMissionItem
*
takeOffItem
=
qobject_cast
<
SimpleMissionItem
*>
(
missionItems
->
get
(
missionItems
->
count
()
-
1
));
if
(
takeOffItem
==
nullptr
){
qWarning
(
"WimaPlaner::updateMission(): takeOffItem == nullptr"
);
return
false
;
}
else
{
takeOffItem
->
setCoordinate
(
_serviceArea
.
center
());
//necessary, insertSimpleMissionItem does not copy coordinate (why?)
}
// create survey item, will be extened with more()-> mission types in the future
_missionController
->
insertComplexMissionItem
(
_missionController
->
circularSurveyComplexItemName
(),
_measurementArea
.
center
(),
missionItems
->
count
());
...
...
@@ -280,13 +284,9 @@ bool WimaPlaner::updateMission()
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."
);
...
...
@@ -345,6 +345,8 @@ bool WimaPlaner::updateMission()
MAV_CMD
landCmd
=
controllerVehicle
->
vtol
()
?
MAV_CMD_NAV_VTOL_LAND
:
MAV_CMD_NAV_LAND
;
if
(
controllerVehicle
->
firmwarePlugin
()
->
supportedMissionCommands
().
contains
(
landCmd
))
{
landItem
->
setCommand
(
landCmd
);
}
else
{
return
false
;
}
}
...
...
@@ -588,26 +590,6 @@ bool WimaPlaner::recalcJoinedArea(QString &errorString)
return
false
;
// this happens if all areas are pairwise disjoint
}
// join service area, op area and corridor
// // remove if debugging finished
// WimaServiceArea *test = new WimaServiceArea(this);
// WimaServiceArea *test1 = new WimaServiceArea(this);
// WimaServiceArea *test2 = new WimaServiceArea(this);
// WimaServiceArea *test3 = new WimaServiceArea(this);
// Circle circle(25, this);
// using namespace GeoUtilities;
// test->setPath(toGeo(circle.approximateSektor(0.5, 1, 3), _joinedArea.center()));
// _visualItems.append(test);
// test1->setPath(toGeo(circle.approximateSektor(0.5, 1, -1), _joinedArea.center()));
// _visualItems.append(test1);
// test2->setPath(toGeo(circle.approximateSektor(0.5,-1, 3), _joinedArea.center()));
// _visualItems.append(test2);
// test3->setPath(toGeo(circle.approximateSektor(0.5, -1, -3), _joinedArea.center()));
// _visualItems.append(test3);
return
true
;
}
...
...
@@ -682,6 +664,21 @@ WimaPlanData WimaPlaner::toPlanData()
// convert mission items to mavlink commands
QList
<
MissionItem
*>
rgMissionItems
;
MissionController
::
convertToMissionItems
(
_missionController
->
visualItems
(),
rgMissionItems
,
this
);
// remove warnings if you read this
// qWarning("WimaPlaner::toPlanData(): rgMissionItems");
// for (auto item : rgMissionItems) {
// qWarning() << item->command();
// qWarning() << item->param1();
// qWarning() << item->param2();
// qWarning() << item->param3();
// qWarning() << item->param4();
// qWarning() << item->param5();
// qWarning() << item->param6();
// qWarning() << item->param7();
// qWarning(" ");
// }
QList
<
const
MissionItem
*>
rgMissionItemsConst
;
for
(
auto
missionItem
:
rgMissionItems
)
rgMissionItemsConst
.
append
(
missionItem
);
...
...
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