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
19c5257e
Commit
19c5257e
authored
Nov 15, 2017
by
DonLakeFlyer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Support ROI tool button in WaypointsOnly mode
parent
c7a2e09b
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
83 additions
and
29 deletions
+83
-29
MavCmdInfoCommon.json
src/FirmwarePlugin/PX4/MavCmdInfoCommon.json
+5
-0
MavCmdInfoCommon.json
src/MissionManager/MavCmdInfoCommon.json
+1
-1
MissionController.cc
src/MissionManager/MissionController.cc
+24
-0
MissionController.h
src/MissionManager/MissionController.h
+5
-0
SimpleMissionItem.cc
src/MissionManager/SimpleMissionItem.cc
+9
-7
PlanView.qml
src/PlanView/PlanView.qml
+39
-14
PositionManager.cpp
src/PositionManager/PositionManager.cpp
+0
-6
PositionManager.h
src/PositionManager/PositionManager.h
+0
-1
No files found.
src/FirmwarePlugin/PX4/MavCmdInfoCommon.json
View file @
19c5257e
...
@@ -13,6 +13,11 @@
...
@@ -13,6 +13,11 @@
"id"
:
21
,
"id"
:
21
,
"comment"
:
"MAV_CMD_NAV_LAND"
,
"comment"
:
"MAV_CMD_NAV_LAND"
,
"paramRemove"
:
"1"
"paramRemove"
:
"1"
},
{
"id"
:
201
,
"comment"
:
"MAV_CMD_DO_SET_ROI"
,
"paramRemove"
:
"1,2,3"
}
}
]
]
}
}
src/MissionManager/MavCmdInfoCommon.json
View file @
19c5257e
...
@@ -655,7 +655,7 @@
...
@@ -655,7 +655,7 @@
{
{
"id"
:
201
,
"id"
:
201
,
"rawName"
:
"MAV_CMD_DO_SET_ROI"
,
"rawName"
:
"MAV_CMD_DO_SET_ROI"
,
"friendlyName"
:
"Region of interest
(cmd)
"
,
"friendlyName"
:
"Region of interest"
,
"description"
:
"Sets the region of interest for cameras."
,
"description"
:
"Sets the region of interest for cameras."
,
"specifiesCoordinate"
:
true
,
"specifiesCoordinate"
:
true
,
"standaloneCoordinate"
:
true
,
"standaloneCoordinate"
:
true
,
...
...
src/MissionManager/MissionController.cc
View file @
19c5257e
...
@@ -359,6 +359,30 @@ int MissionController::insertSimpleMissionItem(QGeoCoordinate coordinate, int i)
...
@@ -359,6 +359,30 @@ int MissionController::insertSimpleMissionItem(QGeoCoordinate coordinate, int i)
return
newItem
->
sequenceNumber
();
return
newItem
->
sequenceNumber
();
}
}
int
MissionController
::
insertROIMissionItem
(
QGeoCoordinate
coordinate
,
int
i
)
{
int
sequenceNumber
=
_nextSequenceNumber
();
SimpleMissionItem
*
newItem
=
new
SimpleMissionItem
(
_controllerVehicle
,
this
);
newItem
->
setSequenceNumber
(
sequenceNumber
);
newItem
->
setCoordinate
(
coordinate
);
newItem
->
setCommand
(
MavlinkQmlSingleton
::
MAV_CMD_DO_SET_ROI
);
_initVisualItem
(
newItem
);
newItem
->
setDefaultsForCommand
();
double
prevAltitude
;
MAV_FRAME
prevFrame
;
if
(
_findPreviousAltitude
(
i
,
&
prevAltitude
,
&
prevFrame
))
{
newItem
->
missionItem
().
setFrame
(
prevFrame
);
newItem
->
missionItem
().
setParam7
(
prevAltitude
);
}
_visualItems
->
insert
(
i
,
newItem
);
_recalcAll
();
return
newItem
->
sequenceNumber
();
}
int
MissionController
::
insertComplexMissionItem
(
QString
itemName
,
QGeoCoordinate
mapCenterCoordinate
,
int
i
)
int
MissionController
::
insertComplexMissionItem
(
QString
itemName
,
QGeoCoordinate
mapCenterCoordinate
,
int
i
)
{
{
ComplexMissionItem
*
newItem
;
ComplexMissionItem
*
newItem
;
...
...
src/MissionManager/MissionController.h
View file @
19c5257e
...
@@ -95,6 +95,11 @@ public:
...
@@ -95,6 +95,11 @@ public:
/// @return Sequence number for new item
/// @return Sequence number for new item
Q_INVOKABLE
int
insertSimpleMissionItem
(
QGeoCoordinate
coordinate
,
int
i
);
Q_INVOKABLE
int
insertSimpleMissionItem
(
QGeoCoordinate
coordinate
,
int
i
);
/// Add a new ROI mission item to the list
/// @param i: index to insert at
/// @return Sequence number for new item
Q_INVOKABLE
int
insertROIMissionItem
(
QGeoCoordinate
coordinate
,
int
i
);
/// Add a new complex mission item to the list
/// Add a new complex mission item to the list
/// @param itemName: Name of complex item to create (from complexMissionItemNames)
/// @param itemName: Name of complex item to create (from complexMissionItemNames)
/// @param mapCenterCoordinate: coordinate for current center of map
/// @param mapCenterCoordinate: coordinate for current center of map
...
...
src/MissionManager/SimpleMissionItem.cc
View file @
19c5257e
...
@@ -349,19 +349,21 @@ QString SimpleMissionItem::commandName(void) const
...
@@ -349,19 +349,21 @@ QString SimpleMissionItem::commandName(void) const
QString
SimpleMissionItem
::
abbreviation
()
const
QString
SimpleMissionItem
::
abbreviation
()
const
{
{
if
(
homePosition
())
if
(
homePosition
())
return
QStringLiteral
(
"H"
);
return
tr
(
"H"
);
switch
(
command
())
{
switch
(
command
())
{
default:
return
QString
();
case
MavlinkQmlSingleton
:
:
MAV_CMD_NAV_TAKEOFF
:
case
MavlinkQmlSingleton
:
:
MAV_CMD_NAV_TAKEOFF
:
return
QStringLiteral
(
"Takeoff"
);
return
tr
(
"Takeoff"
);
case
MavlinkQmlSingleton
:
:
MAV_CMD_NAV_LAND
:
case
MavlinkQmlSingleton
:
:
MAV_CMD_NAV_LAND
:
return
QStringLiteral
(
"Land"
);
return
tr
(
"Land"
);
case
MavlinkQmlSingleton
:
:
MAV_CMD_NAV_VTOL_TAKEOFF
:
case
MavlinkQmlSingleton
:
:
MAV_CMD_NAV_VTOL_TAKEOFF
:
return
QStringLiteral
(
"VTOL Takeoff"
);
return
tr
(
"VTOL Takeoff"
);
case
MavlinkQmlSingleton
:
:
MAV_CMD_NAV_VTOL_LAND
:
case
MavlinkQmlSingleton
:
:
MAV_CMD_NAV_VTOL_LAND
:
return
QStringLiteral
(
"VTOL Land"
);
return
tr
(
"VTOL Land"
);
case
MavlinkQmlSingleton
:
:
MAV_CMD_DO_SET_ROI
:
return
tr
(
"ROI"
);
default:
return
QString
();
}
}
}
}
...
...
src/PlanView/PlanView.qml
View file @
19c5257e
...
@@ -32,13 +32,14 @@ QGCView {
...
@@ -32,13 +32,14 @@ QGCView {
viewPanel
:
panel
viewPanel
:
panel
z
:
QGroundControl
.
zOrderTopMost
z
:
QGroundControl
.
zOrderTopMost
readonly
property
int
_decimalPlaces
:
8
readonly
property
int
_decimalPlaces
:
8
readonly
property
real
_horizontalMargin
:
ScreenTools
.
defaultFontPixelWidth
/
2
readonly
property
real
_horizontalMargin
:
ScreenTools
.
defaultFontPixelWidth
/
2
readonly
property
real
_margin
:
ScreenTools
.
defaultFontPixelHeight
*
0.5
readonly
property
real
_margin
:
ScreenTools
.
defaultFontPixelHeight
*
0.5
readonly
property
var
_activeVehicle
:
QGroundControl
.
multiVehicleManager
.
activeVehicle
readonly
property
var
_activeVehicle
:
QGroundControl
.
multiVehicleManager
.
activeVehicle
readonly
property
real
_rightPanelWidth
:
Math
.
min
(
parent
.
width
/
3
,
ScreenTools
.
defaultFontPixelWidth
*
30
)
readonly
property
real
_rightPanelWidth
:
Math
.
min
(
parent
.
width
/
3
,
ScreenTools
.
defaultFontPixelWidth
*
30
)
readonly
property
real
_toolButtonTopMargin
:
parent
.
height
-
ScreenTools
.
availableHeight
+
(
ScreenTools
.
defaultFontPixelHeight
/
2
)
readonly
property
real
_toolButtonTopMargin
:
parent
.
height
-
ScreenTools
.
availableHeight
+
(
ScreenTools
.
defaultFontPixelHeight
/
2
)
readonly
property
var
_defaultVehicleCoordinate
:
QtPositioning
.
coordinate
(
37.803784
,
-
122.462276
)
readonly
property
var
_defaultVehicleCoordinate
:
QtPositioning
.
coordinate
(
37.803784
,
-
122.462276
)
readonly
property
bool
_waypointsOnlyMode
:
QGroundControl
.
corePlugin
.
options
.
missionWaypointsOnly
property
var
_planMasterController
:
masterController
property
var
_planMasterController
:
masterController
property
var
_missionController
:
_planMasterController
.
missionController
property
var
_missionController
:
_planMasterController
.
missionController
...
@@ -47,6 +48,7 @@ QGCView {
...
@@ -47,6 +48,7 @@ QGCView {
property
var
_visualItems
:
_missionController
.
visualItems
property
var
_visualItems
:
_missionController
.
visualItems
property
bool
_lightWidgetBorders
:
editorMap
.
isSatelliteMap
property
bool
_lightWidgetBorders
:
editorMap
.
isSatelliteMap
property
bool
_addWaypointOnClick
:
false
property
bool
_addWaypointOnClick
:
false
property
bool
_addROIOnClick
:
false
property
bool
_singleComplexItem
:
_missionController
.
complexMissionItemNames
.
length
===
1
property
bool
_singleComplexItem
:
_missionController
.
complexMissionItemNames
.
length
===
1
property
real
_toolbarHeight
:
_qgcView
.
height
-
ScreenTools
.
availableHeight
property
real
_toolbarHeight
:
_qgcView
.
height
-
ScreenTools
.
availableHeight
property
int
_editingLayer
:
_layerMission
property
int
_editingLayer
:
_layerMission
...
@@ -219,6 +221,16 @@ QGCView {
...
@@ -219,6 +221,16 @@ QGCView {
_missionController
.
setCurrentPlanViewIndex
(
sequenceNumber
,
true
)
_missionController
.
setCurrentPlanViewIndex
(
sequenceNumber
,
true
)
}
}
/// Inserts a new ROI mission item
/// @param coordinate Location to insert item
/// @param index Insert item at this index
function
insertROIMissionItem
(
coordinate
,
index
)
{
var
sequenceNumber
=
_missionController
.
insertROIMissionItem
(
coordinate
,
index
)
_missionController
.
setCurrentPlanViewIndex
(
sequenceNumber
,
true
)
_addROIOnClick
=
false
toolStrip
.
uncheckAll
()
}
property
int
_moveDialogMissionItemIndex
property
int
_moveDialogMissionItemIndex
QGCFileDialog
{
QGCFileDialog
{
...
@@ -329,6 +341,9 @@ QGCView {
...
@@ -329,6 +341,9 @@ QGCView {
case
_layerMission
:
case
_layerMission
:
if
(
_addWaypointOnClick
)
{
if
(
_addWaypointOnClick
)
{
insertSimpleMissionItem
(
coordinate
,
_missionController
.
visualItems
.
count
)
insertSimpleMissionItem
(
coordinate
,
_missionController
.
visualItems
.
count
)
}
else
if
(
_addROIOnClick
)
{
_addROIOnClick
=
false
insertROIMissionItem
(
coordinate
,
_missionController
.
visualItems
.
count
)
}
}
break
break
case
_layerRallyPoints
:
case
_layerRallyPoints
:
...
@@ -394,11 +409,11 @@ QGCView {
...
@@ -394,11 +409,11 @@ QGCView {
color
:
qgcPal
.
window
color
:
qgcPal
.
window
title
:
qsTr
(
"
Plan
"
)
title
:
qsTr
(
"
Plan
"
)
z
:
QGroundControl
.
zOrderWidgets
z
:
QGroundControl
.
zOrderWidgets
showAlternateIcon
:
[
false
,
false
,
masterController
.
dirty
,
false
,
false
,
false
]
showAlternateIcon
:
[
false
,
false
,
false
,
masterController
.
dirty
,
false
,
false
,
false
]
rotateImage
:
[
false
,
false
,
masterController
.
syncInProgress
,
false
,
false
,
false
]
rotateImage
:
[
false
,
false
,
false
,
masterController
.
syncInProgress
,
false
,
false
,
false
]
animateImage
:
[
false
,
false
,
masterController
.
dirty
,
false
,
false
,
false
]
animateImage
:
[
false
,
false
,
false
,
masterController
.
dirty
,
false
,
false
,
false
]
buttonEnabled
:
[
true
,
true
,
!
masterController
.
syncInProgress
,
true
,
true
,
true
]
buttonEnabled
:
[
true
,
true
,
true
,
!
masterController
.
syncInProgress
,
true
,
true
,
true
]
buttonVisible
:
[
true
,
true
,
true
,
true
,
_showZoom
,
_showZoom
]
buttonVisible
:
[
true
,
_waypointsOnlyMode
,
true
,
true
,
true
,
_showZoom
,
_showZoom
]
maxHeight
:
mapScale
.
y
-
toolStrip
.
y
maxHeight
:
mapScale
.
y
-
toolStrip
.
y
property
bool
_showZoom
:
!
ScreenTools
.
isMobile
property
bool
_showZoom
:
!
ScreenTools
.
isMobile
...
@@ -409,6 +424,11 @@ QGCView {
...
@@ -409,6 +424,11 @@ QGCView {
iconSource
:
"
/qmlimages/MapAddMission.svg
"
,
iconSource
:
"
/qmlimages/MapAddMission.svg
"
,
toggle
:
true
toggle
:
true
},
},
{
name
:
"
ROI
"
,
iconSource
:
"
/qmlimages/MapAddMission.svg
"
,
toggle
:
true
},
{
{
name
:
_singleComplexItem
?
_missionController
.
complexMissionItemNames
[
0
]
:
"
Pattern
"
,
name
:
_singleComplexItem
?
_missionController
.
complexMissionItemNames
[
0
]
:
"
Pattern
"
,
iconSource
:
"
/qmlimages/MapDrawShape.svg
"
,
iconSource
:
"
/qmlimages/MapDrawShape.svg
"
,
...
@@ -439,16 +459,21 @@ QGCView {
...
@@ -439,16 +459,21 @@ QGCView {
switch
(
index
)
{
switch
(
index
)
{
case
0
:
case
0
:
_addWaypointOnClick
=
checked
_addWaypointOnClick
=
checked
_addROIOnClick
=
false
break
break
case
1
:
case
1
:
_addROIOnClick
=
checked
_addWaypointOnClick
=
false
break
case
2
:
if
(
_singleComplexItem
)
{
if
(
_singleComplexItem
)
{
addComplexItem
(
_missionController
.
complexMissionItemNames
[
0
])
addComplexItem
(
_missionController
.
complexMissionItemNames
[
0
])
}
}
break
break
case
4
:
case
5
:
editorMap
.
zoomLevel
+=
0.5
editorMap
.
zoomLevel
+=
0.5
break
break
case
5
:
case
6
:
editorMap
.
zoomLevel
-=
0.5
editorMap
.
zoomLevel
-=
0.5
break
break
}
}
...
...
src/PositionManager/PositionManager.cpp
View file @
19c5257e
...
@@ -84,7 +84,6 @@ void QGCPositionManager::setPositionSource(QGCPositionManager::QGCPositionSource
...
@@ -84,7 +84,6 @@ void QGCPositionManager::setPositionSource(QGCPositionManager::QGCPositionSource
_currentSource
->
setPreferredPositioningMethods
(
QGeoPositionInfoSource
::
SatellitePositioningMethods
);
_currentSource
->
setPreferredPositioningMethods
(
QGeoPositionInfoSource
::
SatellitePositioningMethods
);
_currentSource
->
setUpdateInterval
(
_updateInterval
);
_currentSource
->
setUpdateInterval
(
_updateInterval
);
connect
(
_currentSource
,
&
QGeoPositionInfoSource
::
positionUpdated
,
this
,
&
QGCPositionManager
::
_positionUpdated
);
connect
(
_currentSource
,
&
QGeoPositionInfoSource
::
positionUpdated
,
this
,
&
QGCPositionManager
::
_positionUpdated
);
connect
(
_currentSource
,
&
QGeoPositionInfoSource
::
updateTimeout
,
this
,
&
QGCPositionManager
::
_updateTimeout
);
connect
(
_currentSource
,
SIGNAL
(
error
(
QGeoPositionInfoSource
::
Error
)),
this
,
SLOT
(
_error
(
QGeoPositionInfoSource
::
Error
)));
connect
(
_currentSource
,
SIGNAL
(
error
(
QGeoPositionInfoSource
::
Error
)),
this
,
SLOT
(
_error
(
QGeoPositionInfoSource
::
Error
)));
_currentSource
->
startUpdates
();
_currentSource
->
startUpdates
();
}
}
...
@@ -94,8 +93,3 @@ void QGCPositionManager::_error(QGeoPositionInfoSource::Error positioningError)
...
@@ -94,8 +93,3 @@ void QGCPositionManager::_error(QGeoPositionInfoSource::Error positioningError)
{
{
qWarning
()
<<
"QGCPositionManager error"
<<
positioningError
;
qWarning
()
<<
"QGCPositionManager error"
<<
positioningError
;
}
}
void
QGCPositionManager
::
_updateTimeout
(
void
)
{
qWarning
()
<<
"QGCPositionManager updateTimeout"
;
}
src/PositionManager/PositionManager.h
View file @
19c5257e
...
@@ -39,7 +39,6 @@ public:
...
@@ -39,7 +39,6 @@ public:
private
slots
:
private
slots
:
void
_positionUpdated
(
const
QGeoPositionInfo
&
update
);
void
_positionUpdated
(
const
QGeoPositionInfo
&
update
);
void
_error
(
QGeoPositionInfoSource
::
Error
positioningError
);
void
_error
(
QGeoPositionInfoSource
::
Error
positioningError
);
void
_updateTimeout
(
void
);
signals:
signals:
void
lastPositionUpdated
(
bool
valid
,
QVariant
lastPosition
);
void
lastPositionUpdated
(
bool
valid
,
QVariant
lastPosition
);
...
...
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