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
3ee40d01
Unverified
Commit
3ee40d01
authored
Jul 27, 2019
by
Gus Grubba
Committed by
GitHub
Jul 27, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #7627 from mavlink/customGimbalControl
Custom gimbal control
parents
37050a59
28ce0811
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
119 additions
and
14 deletions
+119
-14
CustomCameraControl.qml
custom-example/res/CustomCameraControl.qml
+45
-6
CustomFlyView.qml
custom-example/res/CustomFlyView.qml
+37
-1
CustomQuickInterface.cc
custom-example/src/CustomQuickInterface.cc
+20
-2
CustomQuickInterface.h
custom-example/src/CustomQuickInterface.h
+9
-1
VideoManager.cc
src/FlightDisplay/VideoManager.cc
+2
-0
JoystickThumbPad.qml
src/QmlControls/JoystickThumbPad.qml
+6
-4
No files found.
custom-example/res/CustomCameraControl.qml
View file @
3ee40d01
...
@@ -39,6 +39,7 @@ Item {
...
@@ -39,6 +39,7 @@ Item {
property
real
_spacers
:
ScreenTools
.
defaultFontPixelHeight
property
real
_spacers
:
ScreenTools
.
defaultFontPixelHeight
property
real
_labelFieldWidth
:
ScreenTools
.
defaultFontPixelWidth
*
28
property
real
_labelFieldWidth
:
ScreenTools
.
defaultFontPixelWidth
*
28
property
real
_editFieldWidth
:
ScreenTools
.
defaultFontPixelWidth
*
30
property
real
_editFieldWidth
:
ScreenTools
.
defaultFontPixelWidth
*
30
property
real
_editFieldHeight
:
ScreenTools
.
defaultFontPixelHeight
*
2
property
var
_dynamicCameras
:
activeVehicle
?
activeVehicle
.
dynamicCameras
:
null
property
var
_dynamicCameras
:
activeVehicle
?
activeVehicle
.
dynamicCameras
:
null
property
bool
_isCamera
:
_dynamicCameras
?
_dynamicCameras
.
cameras
.
count
>
0
:
false
property
bool
_isCamera
:
_dynamicCameras
?
_dynamicCameras
.
cameras
.
count
>
0
:
false
...
@@ -364,6 +365,7 @@ Item {
...
@@ -364,6 +365,7 @@ Item {
QGCComboBox
{
QGCComboBox
{
model
:
_isCamera
?
_dynamicCameras
.
cameraLabels
:
[]
model
:
_isCamera
?
_dynamicCameras
.
cameraLabels
:
[]
width
:
_editFieldWidth
width
:
_editFieldWidth
height
:
_editFieldHeight
onActivated
:
_dynamicCameras
.
currentCamera
=
index
onActivated
:
_dynamicCameras
.
currentCamera
=
index
currentIndex
:
_dynamicCameras
?
_dynamicCameras
.
currentCamera
:
0
currentIndex
:
_dynamicCameras
?
_dynamicCameras
.
currentCamera
:
0
}
}
...
@@ -388,6 +390,7 @@ Item {
...
@@ -388,6 +390,7 @@ Item {
QGCComboBox
{
QGCComboBox
{
model
:
_camera
?
_camera
.
streamLabels
:
[]
model
:
_camera
?
_camera
.
streamLabels
:
[]
width
:
_editFieldWidth
width
:
_editFieldWidth
height
:
_editFieldHeight
onActivated
:
_camera
.
currentStream
=
index
onActivated
:
_camera
.
currentStream
=
index
currentIndex
:
_camera
?
_camera
.
currentStream
:
0
currentIndex
:
_camera
?
_camera
.
currentStream
:
0
}
}
...
@@ -412,6 +415,7 @@ Item {
...
@@ -412,6 +415,7 @@ Item {
}
}
QGCComboBox
{
QGCComboBox
{
width
:
_editFieldWidth
width
:
_editFieldWidth
height
:
_editFieldHeight
model
:
parent
.
thermalModes
model
:
parent
.
thermalModes
currentIndex
:
_camera
?
_camera
.
thermalMode
:
0
currentIndex
:
_camera
?
_camera
.
thermalMode
:
0
onActivated
:
_camera
.
thermalMode
=
index
onActivated
:
_camera
.
thermalMode
=
index
...
@@ -436,6 +440,7 @@ Item {
...
@@ -436,6 +440,7 @@ Item {
}
}
Slider
{
Slider
{
width
:
_editFieldWidth
width
:
_editFieldWidth
height
:
_editFieldHeight
to
:
100
to
:
100
from
:
0
from
:
0
value
:
_camera
?
_camera
.
thermalOpacity
:
0
value
:
_camera
?
_camera
.
thermalOpacity
:
0
...
@@ -477,6 +482,7 @@ Item {
...
@@ -477,6 +482,7 @@ Item {
}
}
FactComboBox
{
FactComboBox
{
width
:
parent
.
_isCombo
?
_editFieldWidth
:
0
width
:
parent
.
_isCombo
?
_editFieldWidth
:
0
height
:
parent
.
_isCombo
?
_editFieldHeight
:
0
fact
:
parent
.
parent
.
_fact
fact
:
parent
.
parent
.
_fact
indexModel
:
false
indexModel
:
false
visible
:
parent
.
_isCombo
visible
:
parent
.
_isCombo
...
@@ -485,6 +491,7 @@ Item {
...
@@ -485,6 +491,7 @@ Item {
QGCButton
{
QGCButton
{
visible
:
parent
.
_isEdit
visible
:
parent
.
_isEdit
width
:
parent
.
_isEdit
?
_editFieldWidth
:
0
width
:
parent
.
_isEdit
?
_editFieldWidth
:
0
height
:
parent
.
_isEdit
?
_editFieldHeight
:
0
text
:
parent
.
parent
.
_fact
.
valueString
text
:
parent
.
parent
.
_fact
.
valueString
onClicked
:
{
onClicked
:
{
showEditFact
(
parent
.
parent
.
_fact
)
showEditFact
(
parent
.
parent
.
_fact
)
...
@@ -492,6 +499,7 @@ Item {
...
@@ -492,6 +499,7 @@ Item {
}
}
QGCSlider
{
QGCSlider
{
width
:
parent
.
_isSlider
?
_editFieldWidth
:
0
width
:
parent
.
_isSlider
?
_editFieldWidth
:
0
height
:
parent
.
_isSlider
?
_editFieldHeight
:
0
maximumValue
:
parent
.
parent
.
_fact
.
max
maximumValue
:
parent
.
parent
.
_fact
.
max
minimumValue
:
parent
.
parent
.
_fact
.
min
minimumValue
:
parent
.
parent
.
_fact
.
min
stepSize
:
parent
.
parent
.
_fact
.
increment
stepSize
:
parent
.
parent
.
_fact
.
increment
...
@@ -507,6 +515,7 @@ Item {
...
@@ -507,6 +515,7 @@ Item {
}
}
CustomOnOffSwitch
{
CustomOnOffSwitch
{
width
:
parent
.
_isBool
?
_editFieldWidth
:
0
width
:
parent
.
_isBool
?
_editFieldWidth
:
0
height
:
parent
.
_isBool
?
_editFieldHeight
:
0
checked
:
parent
.
parent
.
_fact
?
parent
.
parent
.
_fact
.
value
:
false
checked
:
parent
.
parent
.
_fact
?
parent
.
parent
.
_fact
.
value
:
false
onClicked
:
parent
.
parent
.
_fact
.
value
=
checked
?
1
:
0
onClicked
:
parent
.
parent
.
_fact
.
value
=
checked
?
1
:
0
visible
:
parent
.
_isBool
visible
:
parent
.
_isBool
...
@@ -535,6 +544,7 @@ Item {
...
@@ -535,6 +544,7 @@ Item {
}
}
QGCComboBox
{
QGCComboBox
{
width
:
_editFieldWidth
width
:
_editFieldWidth
height
:
_editFieldHeight
model
:
parent
.
photoModes
model
:
parent
.
photoModes
currentIndex
:
_camera
?
_camera
.
photoMode
:
0
currentIndex
:
_camera
?
_camera
.
photoMode
:
0
onActivated
:
_camera
.
photoMode
=
index
onActivated
:
_camera
.
photoMode
=
index
...
@@ -559,6 +569,7 @@ Item {
...
@@ -559,6 +569,7 @@ Item {
}
}
QGCSlider
{
QGCSlider
{
width
:
_editFieldWidth
width
:
_editFieldWidth
height
:
_editFieldHeight
maximumValue
:
60
maximumValue
:
60
minimumValue
:
_camera
?
(
_camera
.
isE90
?
3
:
5
)
:
5
minimumValue
:
_camera
?
(
_camera
.
isE90
?
3
:
5
)
:
5
stepSize
:
1
stepSize
:
1
...
@@ -579,6 +590,31 @@ Item {
...
@@ -579,6 +590,31 @@ Item {
visible
:
_cameraPhotoMode
&&
_camera
.
photoMode
===
QGCCameraControl
.
PHOTO_CAPTURE_TIMELAPSE
&&
!
_noSdCard
visible
:
_cameraPhotoMode
&&
_camera
.
photoMode
===
QGCCameraControl
.
PHOTO_CAPTURE_TIMELAPSE
&&
!
_noSdCard
}
}
//-------------------------------------------
//-------------------------------------------
//-- Gimbal Control
Row
{
spacing
:
ScreenTools
.
defaultFontPixelWidth
visible
:
_camera
&&
!
_camera
.
isThermal
anchors.horizontalCenter
:
parent
.
horizontalCenter
QGCLabel
{
text
:
qsTr
(
"
Show Gimbal Control
"
)
width
:
_labelFieldWidth
anchors.verticalCenter
:
parent
.
verticalCenter
}
CustomOnOffSwitch
{
checked
:
CustomQuickInterface
.
showGimbalControl
width
:
_editFieldWidth
height
:
_editFieldHeight
anchors.verticalCenter
:
parent
.
verticalCenter
onClicked
:
CustomQuickInterface
.
showGimbalControl
=
checked
}
}
Rectangle
{
color
:
qgcPal
.
button
height
:
1
width
:
cameraSettingsCol
.
width
visible
:
_camera
&&
!
_camera
.
isThermal
}
//-------------------------------------------
//-- Screen Grid
//-- Screen Grid
Row
{
Row
{
spacing
:
ScreenTools
.
defaultFontPixelWidth
spacing
:
ScreenTools
.
defaultFontPixelWidth
...
@@ -592,6 +628,7 @@ Item {
...
@@ -592,6 +628,7 @@ Item {
CustomOnOffSwitch
{
CustomOnOffSwitch
{
checked
:
QGroundControl
.
settingsManager
.
videoSettings
.
gridLines
.
rawValue
checked
:
QGroundControl
.
settingsManager
.
videoSettings
.
gridLines
.
rawValue
width
:
_editFieldWidth
width
:
_editFieldWidth
height
:
_editFieldHeight
anchors.verticalCenter
:
parent
.
verticalCenter
anchors.verticalCenter
:
parent
.
verticalCenter
onClicked
:
QGroundControl
.
settingsManager
.
videoSettings
.
gridLines
.
rawValue
=
checked
onClicked
:
QGroundControl
.
settingsManager
.
videoSettings
.
gridLines
.
rawValue
=
checked
}
}
...
@@ -615,6 +652,7 @@ Item {
...
@@ -615,6 +652,7 @@ Item {
}
}
FactComboBox
{
FactComboBox
{
width
:
_editFieldWidth
width
:
_editFieldWidth
height
:
_editFieldHeight
fact
:
QGroundControl
.
settingsManager
.
videoSettings
.
videoFit
fact
:
QGroundControl
.
settingsManager
.
videoSettings
.
videoFit
indexModel
:
false
indexModel
:
false
anchors.verticalCenter
:
parent
.
verticalCenter
anchors.verticalCenter
:
parent
.
verticalCenter
...
@@ -640,6 +678,7 @@ Item {
...
@@ -640,6 +678,7 @@ Item {
text
:
qsTr
(
"
Reset
"
)
text
:
qsTr
(
"
Reset
"
)
onClicked
:
resetPrompt
.
open
()
onClicked
:
resetPrompt
.
open
()
width
:
_editFieldWidth
width
:
_editFieldWidth
height
:
_editFieldHeight
enabled
:
!
_recordingVideo
enabled
:
!
_recordingVideo
anchors.verticalCenter
:
parent
.
verticalCenter
anchors.verticalCenter
:
parent
.
verticalCenter
MessageDialog
{
MessageDialog
{
...
...
custom-example/res/CustomFlyView.qml
View file @
3ee40d01
...
@@ -60,7 +60,7 @@ Item {
...
@@ -60,7 +60,7 @@ Item {
property
real
_distance
:
0.0
property
real
_distance
:
0.0
property
string
_messageTitle
:
""
property
string
_messageTitle
:
""
property
string
_messageText
:
""
property
string
_messageText
:
""
property
bool
_showAttitude
:
fals
e
property
bool
_showAttitude
:
tru
e
function
secondsToHHMMSS
(
timeS
)
{
function
secondsToHHMMSS
(
timeS
)
{
var
sec_num
=
parseInt
(
timeS
,
10
);
var
sec_num
=
parseInt
(
timeS
,
10
);
...
@@ -508,6 +508,42 @@ Item {
...
@@ -508,6 +508,42 @@ Item {
}
}
}
}
//-- Gimbal Control
Item
{
id
:
gimbalControl
visible
:
camControlLoader
.
visible
&&
CustomQuickInterface
.
showGimbalControl
anchors.top
:
camControlLoader
.
bottom
anchors.topMargin
:
height
*
-
0.5
anchors.right
:
camControlLoader
.
left
anchors.rightMargin
:
ScreenTools
.
defaultFontPixelWidth
*
2
height
:
parent
.
width
*
0.125
width
:
height
property
real
curPitch
:
0
property
real
curYaw
:
0
Timer
{
interval
:
100
//-- 10Hz
running
:
gimbalControl
.
visible
&&
activeVehicle
repeat
:
true
onTriggered
:
{
if
(
activeVehicle
)
{
var
p
=
Math
.
round
(
stick
.
yAxis
*
-
90
)
var
y
=
Math
.
round
(
stick
.
xAxis
*
180
)
if
(
p
!==
gimbalControl
.
curPitch
||
y
!==
gimbalControl
.
curYaw
)
{
gimbalControl
.
curPitch
=
p
gimbalControl
.
curYaw
=
y
activeVehicle
.
gimbalControlValue
(
p
,
y
)
}
}
}
}
JoystickThumbPad
{
id
:
stick
anchors.fill
:
parent
lightColors
:
true
yAxisThrottleCentered
:
true
springYToCenter
:
false
}
}
//-- Connection Lost While Armed
//-- Connection Lost While Armed
Popup
{
Popup
{
id
:
connectionLostArmed
id
:
connectionLostArmed
...
...
custom-example/src/CustomQuickInterface.cc
View file @
3ee40d01
...
@@ -21,8 +21,10 @@
...
@@ -21,8 +21,10 @@
#include "CustomPlugin.h"
#include "CustomPlugin.h"
#include "CustomQuickInterface.h"
#include "CustomQuickInterface.h"
#include <QDirIterator>
#include <QSettings>
#include <QtAlgorithms>
static
const
char
*
kGroupName
=
"CustomSettings"
;
static
const
char
*
kShowGimbalCtl
=
"ShowGimbalCtl"
;
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
CustomQuickInterface
::
CustomQuickInterface
(
QObject
*
parent
)
CustomQuickInterface
::
CustomQuickInterface
(
QObject
*
parent
)
...
@@ -41,4 +43,20 @@ CustomQuickInterface::~CustomQuickInterface()
...
@@ -41,4 +43,20 @@ CustomQuickInterface::~CustomQuickInterface()
void
void
CustomQuickInterface
::
init
()
CustomQuickInterface
::
init
()
{
{
QSettings
settings
;
settings
.
beginGroup
(
kGroupName
);
_showGimbalControl
=
settings
.
value
(
kShowGimbalCtl
,
true
).
toBool
();
}
//-----------------------------------------------------------------------------
void
CustomQuickInterface
::
setShowGimbalControl
(
bool
set
)
{
if
(
_showGimbalControl
!=
set
)
{
_showGimbalControl
=
set
;
QSettings
settings
;
settings
.
beginGroup
(
kGroupName
);
settings
.
setValue
(
kShowGimbalCtl
,
set
);
emit
showGimbalControlChanged
();
}
}
}
custom-example/src/CustomQuickInterface.h
View file @
3ee40d01
...
@@ -28,5 +28,13 @@ class CustomQuickInterface : public QObject
...
@@ -28,5 +28,13 @@ class CustomQuickInterface : public QObject
public:
public:
CustomQuickInterface
(
QObject
*
parent
=
nullptr
);
CustomQuickInterface
(
QObject
*
parent
=
nullptr
);
~
CustomQuickInterface
();
~
CustomQuickInterface
();
Q_PROPERTY
(
bool
showGimbalControl
READ
showGimbalControl
WRITE
setShowGimbalControl
NOTIFY
showGimbalControlChanged
)
bool
showGimbalControl
()
{
return
_showGimbalControl
;
}
void
setShowGimbalControl
(
bool
set
);
void
init
();
void
init
();
signals:
void
showGimbalControlChanged
();
private:
bool
_showGimbalControl
=
true
;
};
};
src/FlightDisplay/VideoManager.cc
View file @
3ee40d01
...
@@ -172,12 +172,14 @@ VideoManager::hasThermal()
...
@@ -172,12 +172,14 @@ VideoManager::hasThermal()
bool
bool
VideoManager
::
autoStreamConfigured
()
VideoManager
::
autoStreamConfigured
()
{
{
#if defined(QGC_GST_STREAMING)
if
(
_activeVehicle
&&
_activeVehicle
->
dynamicCameras
())
{
if
(
_activeVehicle
&&
_activeVehicle
->
dynamicCameras
())
{
QGCVideoStreamInfo
*
pInfo
=
_activeVehicle
->
dynamicCameras
()
->
currentStreamInstance
();
QGCVideoStreamInfo
*
pInfo
=
_activeVehicle
->
dynamicCameras
()
->
currentStreamInstance
();
if
(
pInfo
)
{
if
(
pInfo
)
{
return
!
pInfo
->
uri
().
isEmpty
();
return
!
pInfo
->
uri
().
isEmpty
();
}
}
}
}
#endif
return
false
;
return
false
;
}
}
...
...
src/QmlControls/JoystickThumbPad.qml
View file @
3ee40d01
...
@@ -14,6 +14,7 @@ Item {
...
@@ -14,6 +14,7 @@ Item {
property
bool
yAxisThrottleCentered
:
false
///< false: center yAxis in throttle for reverser and forward
property
bool
yAxisThrottleCentered
:
false
///< false: center yAxis in throttle for reverser and forward
property
real
xPositionDelta
:
0
///< Amount to move the control on x axis
property
real
xPositionDelta
:
0
///< Amount to move the control on x axis
property
real
yPositionDelta
:
0
///< Amount to move the control on y axis
property
real
yPositionDelta
:
0
///< Amount to move the control on y axis
property
bool
springYToCenter
:
true
///< true: Spring Y to center on release
property
real
_centerXY
:
width
/
2
property
real
_centerXY
:
width
/
2
property
bool
_processTouchPoints
:
false
property
bool
_processTouchPoints
:
false
...
@@ -72,7 +73,6 @@ Item {
...
@@ -72,7 +73,6 @@ Item {
}
else
{
}
else
{
yPositionDelta
=
touchPoints
[
0
].
y
-
_centerXY
yPositionDelta
=
touchPoints
[
0
].
y
-
_centerXY
}
}
// We need to wait until we move the control to the right position before we process touch points
// We need to wait until we move the control to the right position before we process touch points
_processTouchPoints
=
true
_processTouchPoints
=
true
}
}
...
@@ -199,8 +199,10 @@ Item {
...
@@ -199,8 +199,10 @@ Item {
minimumTouchPoints
:
1
minimumTouchPoints
:
1
maximumTouchPoints
:
1
maximumTouchPoints
:
1
touchPoints
:
[
TouchPoint
{
id
:
touchPoint
}
]
touchPoints
:
[
TouchPoint
{
id
:
touchPoint
}
]
onPressed
:
_joyRoot
.
thumbDown
(
touchPoints
)
onPressed
:
_joyRoot
.
thumbDown
(
touchPoints
)
onReleased
:
_joyRoot
.
reCenter
()
onReleased
:
{
if
(
springYToCenter
)
_joyRoot
.
reCenter
()
}
}
}
}
}
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