Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Valentin Platzgummer
qgroundcontrol
Commits
1f7b0647
Commit
1f7b0647
authored
Mar 05, 2017
by
Don Gagne
Browse files
Camera list for survey comes from FirmwarePlugin
parent
9e75a02b
Changes
8
Show whitespace changes
Inline
Side-by-side
qgroundcontrol.pro
View file @
1f7b0647
...
@@ -754,6 +754,7 @@ HEADERS+= \
...
@@ -754,6 +754,7 @@ HEADERS+= \
src/AutoPilotPlugins/Common/MotorComponent.h \
src/AutoPilotPlugins/Common/MotorComponent.h \
src/AutoPilotPlugins/Common/RadioComponentController.h \
src/AutoPilotPlugins/Common/RadioComponentController.h \
src/AutoPilotPlugins/Generic/GenericAutoPilotPlugin.h \
src/AutoPilotPlugins/Generic/GenericAutoPilotPlugin.h \
src/FirmwarePlugin/CameraMetaData.h \
src/FirmwarePlugin/FirmwarePlugin.h \
src/FirmwarePlugin/FirmwarePlugin.h \
src/FirmwarePlugin/FirmwarePluginManager.h \
src/FirmwarePlugin/FirmwarePluginManager.h \
src/Vehicle/MultiVehicleManager.h \
src/Vehicle/MultiVehicleManager.h \
...
@@ -776,6 +777,7 @@ SOURCES += \
...
@@ -776,6 +777,7 @@ SOURCES += \
src/AutoPilotPlugins/Common/MotorComponent.cc \
src/AutoPilotPlugins/Common/MotorComponent.cc \
src/AutoPilotPlugins/Common/RadioComponentController.cc \
src/AutoPilotPlugins/Common/RadioComponentController.cc \
src/AutoPilotPlugins/Generic/GenericAutoPilotPlugin.cc \
src/AutoPilotPlugins/Generic/GenericAutoPilotPlugin.cc \
src/FirmwarePlugin/CameraMetaData.cc \
src/FirmwarePlugin/FirmwarePlugin.cc \
src/FirmwarePlugin/FirmwarePlugin.cc \
src/FirmwarePlugin/FirmwarePluginManager.cc \
src/FirmwarePlugin/FirmwarePluginManager.cc \
src/Vehicle/MultiVehicleManager.cc \
src/Vehicle/MultiVehicleManager.cc \
...
...
src/FirmwarePlugin/CameraMetaData.cc
0 → 100644
View file @
1f7b0647
/****************************************************************************
*
* (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.
*
****************************************************************************/
#include
"CameraMetaData.h"
CameraMetaData
::
CameraMetaData
(
const
QString
&
name
,
double
sensorWidth
,
double
sensorHeight
,
double
imageWidth
,
double
imageHeight
,
double
focalLength
,
QObject
*
parent
)
:
QObject
(
parent
)
,
_name
(
name
)
,
_sensorWidth
(
sensorWidth
)
,
_sensorHeight
(
sensorHeight
)
,
_imageWidth
(
imageWidth
)
,
_imageHeight
(
imageHeight
)
,
_focalLength
(
focalLength
)
{
}
src/FirmwarePlugin/CameraMetaData.h
0 → 100644
View file @
1f7b0647
/****************************************************************************
*
* (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.
*
****************************************************************************/
#ifndef CameraMetaData_H
#define CameraMetaData_H
#include
<QObject>
/// Set of meta data which describes a camera available on the vehicle
class
CameraMetaData
:
public
QObject
{
Q_OBJECT
public:
CameraMetaData
(
const
QString
&
name
,
double
sensorWidth
,
double
sensorHeight
,
double
imageWidth
,
double
imageHeight
,
double
focalLength
,
QObject
*
parent
=
NULL
);
Q_PROPERTY
(
QString
name
MEMBER
_name
CONSTANT
)
///< Camera name
Q_PROPERTY
(
double
sensorWidth
MEMBER
_sensorWidth
CONSTANT
)
///< Sensor size in millimeters
Q_PROPERTY
(
double
sensorHeight
MEMBER
_sensorHeight
CONSTANT
)
///< Sensor size in millimeters
Q_PROPERTY
(
double
imageWidth
MEMBER
_imageWidth
CONSTANT
)
///< Image size in pixels
Q_PROPERTY
(
double
imageHeight
MEMBER
_imageHeight
CONSTANT
)
///< Image size in pixels
Q_PROPERTY
(
double
focalLength
MEMBER
_focalLength
CONSTANT
)
///< Focal length in millimeters
private:
QString
_name
;
double
_sensorWidth
;
double
_sensorHeight
;
double
_imageWidth
;
double
_imageHeight
;
double
_focalLength
;
};
#endif
src/FirmwarePlugin/FirmwarePlugin.cc
View file @
1f7b0647
...
@@ -10,6 +10,7 @@
...
@@ -10,6 +10,7 @@
#include
"FirmwarePlugin.h"
#include
"FirmwarePlugin.h"
#include
"QGCApplication.h"
#include
"QGCApplication.h"
#include
"Generic/GenericAutoPilotPlugin.h"
#include
"Generic/GenericAutoPilotPlugin.h"
#include
"CameraMetaData.h"
#include
<QDebug>
#include
<QDebug>
...
@@ -17,6 +18,8 @@ static FirmwarePluginFactoryRegister* _instance = NULL;
...
@@ -17,6 +18,8 @@ static FirmwarePluginFactoryRegister* _instance = NULL;
const
char
*
guided_mode_not_supported_by_vehicle
=
"Guided mode not supported by Vehicle."
;
const
char
*
guided_mode_not_supported_by_vehicle
=
"Guided mode not supported by Vehicle."
;
QVariantList
FirmwarePlugin
::
_cameraList
;
const
char
*
FirmwarePlugin
::
px4FollowMeFlightMode
=
"Follow Me"
;
const
char
*
FirmwarePlugin
::
px4FollowMeFlightMode
=
"Follow Me"
;
FirmwarePluginFactory
::
FirmwarePluginFactory
(
void
)
FirmwarePluginFactory
::
FirmwarePluginFactory
(
void
)
...
@@ -352,3 +355,67 @@ QVariantList& FirmwarePlugin::toolBarIndicators(const Vehicle* vehicle)
...
@@ -352,3 +355,67 @@ QVariantList& FirmwarePlugin::toolBarIndicators(const Vehicle* vehicle)
}
}
return
_toolBarIndicatorList
;
return
_toolBarIndicatorList
;
}
}
const
QVariantList
&
FirmwarePlugin
::
cameraList
(
const
Vehicle
*
vehicle
)
{
Q_UNUSED
(
vehicle
);
if
(
_cameraList
.
size
()
==
0
)
{
CameraMetaData
*
metaData
;
metaData
=
new
CameraMetaData
(
tr
(
"Typhoon H CGO3+"
),
// Camera name
6.264
,
// sensorWidth
4.698
,
// sensorHeight
4000
,
// imageWidth
3000
,
// imageHeight
14
,
// focalLength
this
);
// parent
_cameraList
.
append
(
QVariant
::
fromValue
(
metaData
));
metaData
=
new
CameraMetaData
(
tr
(
"Sony ILCE-QX1"
),
//http://www.sony.co.uk/electronics/interchangeable-lens-cameras/ilce-qx1-body-kit/specifications
23.2
,
//http://www.sony.com/electronics/camera-lenses/sel16f28/specifications
15.4
,
5456
,
3632
,
16
,
this
);
_cameraList
.
append
(
QVariant
::
fromValue
(
metaData
));
metaData
=
new
CameraMetaData
(
tr
(
"Canon S100 PowerShot"
),
7.6
,
5.7
,
4000
,
3000
,
5.2
,
this
);
_cameraList
.
append
(
QVariant
::
fromValue
(
metaData
));
metaData
=
new
CameraMetaData
(
tr
(
"Canon SX260 HS PowerShot"
),
6.17
,
4.55
,
4000
,
3000
,
4.5
,
this
);
metaData
=
new
CameraMetaData
(
tr
(
"Canon EOS-M 22mm"
),
22.3
,
14.9
,
5184
,
3456
,
22
,
this
);
_cameraList
.
append
(
QVariant
::
fromValue
(
metaData
));
metaData
=
new
CameraMetaData
(
tr
(
"Sony a6000 16mm"
),
//http://www.sony.co.uk/electronics/interchangeable-lens-cameras/ilce-6000-body-kit#product_details_default
23.5
,
15.6
,
6000
,
4000
,
16
,
this
);
_cameraList
.
append
(
QVariant
::
fromValue
(
metaData
));
}
return
_cameraList
;
}
src/FirmwarePlugin/FirmwarePlugin.h
View file @
1f7b0647
...
@@ -261,12 +261,18 @@ public:
...
@@ -261,12 +261,18 @@ public:
/// @return A list of QUrl with the indicators (see MainToolBarIndicators.qml)
/// @return A list of QUrl with the indicators (see MainToolBarIndicators.qml)
virtual
QVariantList
&
toolBarIndicators
(
const
Vehicle
*
vehicle
);
virtual
QVariantList
&
toolBarIndicators
(
const
Vehicle
*
vehicle
);
/// Returns a list of CameraMetaData objects for available cameras on the vehicle.
virtual
const
QVariantList
&
cameraList
(
const
Vehicle
*
vehicle
);
// FIXME: Hack workaround for non pluginize FollowMe support
// FIXME: Hack workaround for non pluginize FollowMe support
static
const
char
*
px4FollowMeFlightMode
;
static
const
char
*
px4FollowMeFlightMode
;
protected:
protected:
QVariantList
_toolBarIndicatorList
;
QVariantList
_toolBarIndicatorList
;
private:
static
QVariantList
_cameraList
;
///< Standard QGC camera list
};
};
class
FirmwarePluginFactory
:
public
QObject
class
FirmwarePluginFactory
:
public
QObject
...
...
src/MissionEditor/SurveyItemEditor.qml
View file @
1f7b0647
...
@@ -26,75 +26,29 @@ Rectangle {
...
@@ -26,75 +26,29 @@ Rectangle {
property
real
_margin
:
ScreenTools
.
defaultFontPixelWidth
*
0.25
property
real
_margin
:
ScreenTools
.
defaultFontPixelWidth
*
0.25
property
int
_cameraIndex
:
1
property
int
_cameraIndex
:
1
property
real
_fieldWidth
:
ScreenTools
.
defaultFontPixelWidth
*
10.5
property
real
_fieldWidth
:
ScreenTools
.
defaultFontPixelWidth
*
10.5
property
var
_cameraList
:
[
qsTr
(
"
Manual Grid (no camera specs)
"
),
qsTr
(
"
Custom Camera Grid
"
)
]
property
var
_vehicle
:
QGroundControl
.
multiVehicleManager
.
activeVehicle
?
QGroundControl
.
multiVehicleManager
.
activeVehicle
:
QGroundControl
.
multiVehicleManager
.
offlineEditingVehicle
property
var
_vehicleCameraList
:
_vehicle
.
cameraList
readonly
property
int
_gridTypeManual
:
0
readonly
property
int
_gridTypeManual
:
0
readonly
property
int
_gridTypeCustomCamera
:
1
readonly
property
int
_gridTypeCustomCamera
:
1
readonly
property
int
_gridTypeCamera
:
2
readonly
property
int
_gridTypeCamera
:
2
ListModel
{
id
:
cameraModelList
Component.onCompleted
:
{
Component.onCompleted
:
{
cameraModelList
.
setProperty
(
_gridTypeCustomCamera
,
"
sensorWidth
"
,
missionItem
.
cameraSensorWidth
.
rawValue
)
for
(
var
i
=
0
;
i
<
_vehicle
.
cameraList
.
length
;
i
++
)
{
cameraModelList
.
setProperty
(
_gridTypeCustomCamera
,
"
sensorHeight
"
,
missionItem
.
cameraSensorHeight
.
rawValue
)
_cameraList
.
push
(
_vehicle
.
cameraList
[
i
].
name
)
cameraModelList
.
setProperty
(
_gridTypeCustomCamera
,
"
imageWidth
"
,
missionItem
.
cameraResolutionWidth
.
rawValue
)
}
cameraModelList
.
setProperty
(
_gridTypeCustomCamera
,
"
imageHeight
"
,
missionItem
.
cameraResolutionHeight
.
rawValue
)
gridTypeCombo
.
model
=
_cameraList
cameraModelList
.
setProperty
(
_gridTypeCustomCamera
,
"
focalLength
"
,
missionItem
.
cameraFocalLength
.
rawValue
)
if
(
missionItem
.
manualGrid
)
{
}
gridTypeCombo
.
currentIndex
=
_gridTypeManual
}
else
{
ListElement
{
var
index
=
gridTypeCombo
.
find
(
missionItem
.
camera
)
text
:
qsTr
(
"
Manual Grid (no camera specs)
"
)
if
(
index
==
-
1
)
{
}
console
.
log
(
"
Couldn't find camera
"
,
missionItem
.
camera
)
ListElement
{
gridTypeCombo
.
currentIndex
=
_gridTypeManual
text
:
qsTr
(
"
Custom Camera Grid
"
)
}
else
{
}
gridTypeCombo
.
currentIndex
=
index
ListElement
{
}
text
:
qsTr
(
"
Typhoon H CGO3+
"
)
sensorWidth
:
6.264
sensorHeight
:
4.698
imageWidth
:
4000
imageHeight
:
3000
focalLength
:
14
}
ListElement
{
text
:
qsTr
(
"
Sony ILCE-QX1
"
)
//http://www.sony.co.uk/electronics/interchangeable-lens-cameras/ilce-qx1-body-kit/specifications
sensorWidth
:
23.2
//http://www.sony.com/electronics/camera-lenses/sel16f28/specifications
sensorHeight
:
15.4
imageWidth
:
5456
imageHeight
:
3632
focalLength
:
16
}
ListElement
{
text
:
qsTr
(
"
Canon S100 PowerShot
"
)
sensorWidth
:
7.6
sensorHeight
:
5.7
imageWidth
:
4000
imageHeight
:
3000
focalLength
:
5.2
}
ListElement
{
text
:
qsTr
(
"
Canon SX260 HS PowerShot
"
)
sensorWidth
:
6.17
sensorHeight
:
4.55
imageWidth
:
4000
imageHeight
:
3000
focalLength
:
4.5
}
ListElement
{
text
:
qsTr
(
"
Canon EOS-M 22mm
"
)
sensorWidth
:
22.3
sensorHeight
:
14.9
imageWidth
:
5184
imageHeight
:
3456
focalLength
:
22
}
ListElement
{
text
:
qsTr
(
"
Sony a6000 16mm
"
)
//http://www.sony.co.uk/electronics/interchangeable-lens-cameras/ilce-6000-body-kit#product_details_default
sensorWidth
:
23.5
sensorHeight
:
15.6
imageWidth
:
6000
imageHeight
:
4000
focalLength
:
16
}
}
}
}
...
@@ -258,35 +212,25 @@ Rectangle {
...
@@ -258,35 +212,25 @@ Rectangle {
id
:
gridTypeCombo
id
:
gridTypeCombo
anchors.left
:
parent
.
left
anchors.left
:
parent
.
left
anchors.right
:
parent
.
right
anchors.right
:
parent
.
right
model
:
camera
Model
List
model
:
_
cameraList
currentIndex
:
-
1
currentIndex
:
-
1
Component.onCompleted
:
{
if
(
missionItem
.
manualGrid
)
{
gridTypeCombo
.
currentIndex
=
_gridTypeManual
}
else
{
var
index
=
gridTypeCombo
.
find
(
missionItem
.
camera
)
if
(
index
==
-
1
)
{
console
.
log
(
"
Couldn't find camera
"
,
missionItem
.
camera
)
gridTypeCombo
.
currentIndex
=
_gridTypeManual
}
else
{
gridTypeCombo
.
currentIndex
=
index
}
}
}
onActivated
:
{
onActivated
:
{
if
(
index
==
_gridTypeManual
)
{
if
(
index
==
_gridTypeManual
)
{
missionItem
.
manualGrid
=
true
missionItem
.
manualGrid
=
true
}
else
if
(
index
==
_gridTypeCustomCamera
)
{
missionItem
.
manualGrid
=
false
missionItem
.
camera
=
gridTypeCombo
.
textAt
(
index
)
}
else
{
}
else
{
missionItem
.
manualGrid
=
false
missionItem
.
manualGrid
=
false
missionItem
.
camera
=
gridTypeCombo
.
textAt
(
index
)
missionItem
.
camera
=
gridTypeCombo
.
textAt
(
index
)
_noCameraValueRecalc
=
true
_noCameraValueRecalc
=
true
missionItem
.
cameraSensorWidth
.
rawValue
=
cameraModelList
.
get
(
index
).
sensorWidth
var
listIndex
=
index
-
_gridTypeCamera
missionItem
.
cameraSensorHeight
.
rawValue
=
cameraModelList
.
get
(
index
).
sensorHeight
missionItem
.
cameraSensorWidth
.
rawValue
=
_vehicleCameraList
[
listIndex
].
sensorWidth
missionItem
.
cameraResolutionWidth
.
rawValue
=
cameraModelList
.
get
(
index
).
imageWidth
missionItem
.
cameraSensorHeight
.
rawValue
=
_vehicleCameraList
[
listIndex
].
sensorHeight
missionItem
.
cameraResolutionHeight
.
rawValue
=
cameraModelList
.
get
(
index
).
imageHeight
missionItem
.
cameraResolutionWidth
.
rawValue
=
_vehicleCameraList
[
listIndex
].
imageWidth
missionItem
.
cameraFocalLength
.
rawValue
=
cameraModelList
.
get
(
index
).
focalLength
missionItem
.
cameraResolutionHeight
.
rawValue
=
_vehicleCameraList
[
listIndex
].
imageHeight
missionItem
.
cameraFocalLength
.
rawValue
=
_vehicleCameraList
[
listIndex
].
focalLength
_noCameraValueRecalc
=
false
_noCameraValueRecalc
=
false
recalcFromCameraValues
()
recalcFromCameraValues
()
}
}
...
...
src/Vehicle/Vehicle.cc
View file @
1f7b0647
...
@@ -2384,6 +2384,16 @@ QVariantList& Vehicle::toolBarIndicators()
...
@@ -2384,6 +2384,16 @@ QVariantList& Vehicle::toolBarIndicators()
return
emptyList
;
return
emptyList
;
}
}
const
QVariantList
&
Vehicle
::
cameraList
(
void
)
const
{
if
(
_firmwarePlugin
)
{
return
_firmwarePlugin
->
cameraList
(
this
);
}
static
QVariantList
emptyList
;
return
emptyList
;
}
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
...
...
src/Vehicle/Vehicle.h
View file @
1f7b0647
...
@@ -308,6 +308,7 @@ public:
...
@@ -308,6 +308,7 @@ public:
Q_PROPERTY
(
unsigned
int
telemetryLNoise
READ
telemetryLNoise
NOTIFY
telemetryLNoiseChanged
)
Q_PROPERTY
(
unsigned
int
telemetryLNoise
READ
telemetryLNoise
NOTIFY
telemetryLNoiseChanged
)
Q_PROPERTY
(
unsigned
int
telemetryRNoise
READ
telemetryRNoise
NOTIFY
telemetryRNoiseChanged
)
Q_PROPERTY
(
unsigned
int
telemetryRNoise
READ
telemetryRNoise
NOTIFY
telemetryRNoiseChanged
)
Q_PROPERTY
(
QVariantList
toolBarIndicators
READ
toolBarIndicators
CONSTANT
)
Q_PROPERTY
(
QVariantList
toolBarIndicators
READ
toolBarIndicators
CONSTANT
)
Q_PROPERTY
(
QVariantList
cameraList
READ
cameraList
CONSTANT
)
/// true: Vehicle is flying, false: Vehicle is on ground
/// true: Vehicle is flying, false: Vehicle is on ground
Q_PROPERTY
(
bool
flying
READ
flying
WRITE
setFlying
NOTIFY
flyingChanged
)
Q_PROPERTY
(
bool
flying
READ
flying
WRITE
setFlying
NOTIFY
flyingChanged
)
...
@@ -653,6 +654,8 @@ public:
...
@@ -653,6 +654,8 @@ public:
QString
vehicleImageCompass
()
const
;
QString
vehicleImageCompass
()
const
;
QVariantList
&
toolBarIndicators
();
QVariantList
&
toolBarIndicators
();
const
QVariantList
&
cameraList
(
void
)
const
;
public
slots
:
public
slots
:
/// Sets the firmware plugin instance data associated with this Vehicle. This object will be parented to the Vehicle
/// Sets the firmware plugin instance data associated with this Vehicle. This object will be parented to the Vehicle
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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