Skip to content

Commit

Permalink
Camera: Move CameraMetaData list from FirmwarePlugin to CameraManager
Browse files Browse the repository at this point in the history
  • Loading branch information
HTRamsey committed Oct 26, 2024
1 parent 8202e60 commit c27ddf3
Show file tree
Hide file tree
Showing 15 changed files with 652 additions and 674 deletions.
1 change: 1 addition & 0 deletions qgroundcontrol.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -420,6 +420,7 @@
<file alias="VTOLLandingPattern.FactMetaData.json">src/MissionManager/VTOLLandingPattern.FactMetaData.json</file>
<file alias="Viewer3D.SettingsGroup.json">src/Settings/Viewer3D.SettingsGroup.json</file>
<file alias="GimbalController.SettingsGroup.json">src/Settings/GimbalController.SettingsGroup.json</file>
<file alias="CameraMetaData.json">src/Camera/CameraMetaData.json</file>
</qresource>
<qresource prefix="/MockLink">
<file alias="APMArduSubMockLink.params">src/Comms/MockLink/APMArduSubMockLink.params</file>
Expand Down
3 changes: 3 additions & 0 deletions src/Camera/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
find_package(Qt6 REQUIRED COMPONENTS Core Network Qml Xml)

qt_add_library(Camera STATIC
CameraMetaData.cc
CameraMetaData.h
MavlinkCameraControl.cc
MavlinkCameraControl.h
QGCCameraIO.cc
Expand All @@ -24,6 +26,7 @@ target_link_libraries(Camera
FirmwarePlugin
Joystick
Settings
Utilities
Vehicle
VideoManager
PUBLIC
Expand Down
41 changes: 41 additions & 0 deletions src/Camera/CameraMetaData.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/****************************************************************************
*
* (c) 2009-2024 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"
#include "QGCLoggingCategory.h"

QGC_LOGGING_CATEGORY(CameraMetaDataLog, "qgc.camera.camerametadata")

CameraMetaData::CameraMetaData(const QString &canonicalName,
const QString &brand,
const QString &model,
double sensorWidth,
double sensorHeight,
double imageWidth,
double imageHeight,
double focalLength,
bool landscape,
bool fixedOrientation,
double minTriggerInterval,
const QString &deprecatedTranslatedName)
: canonicalName(canonicalName)
, brand(brand)
, model(model)
, sensorWidth(sensorWidth)
, sensorHeight(sensorHeight)
, imageWidth(imageWidth)
, imageHeight(imageHeight)
, focalLength(focalLength)
, landscape(landscape)
, fixedOrientation(fixedOrientation)
, minTriggerInterval(minTriggerInterval)
, deprecatedTranslatedName(deprecatedTranslatedName)
{
// qCDebug(AudioOutputLog) << Q_FUNC_INFO << this;
}
63 changes: 32 additions & 31 deletions src/FirmwarePlugin/CameraMetaData.h → src/Camera/CameraMetaData.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,28 +9,14 @@

#pragma once

#include <QtCore/QObject>
#include <QtCore/QLoggingCategory>

Q_DECLARE_LOGGING_CATEGORY(CameraMetaDataLog)

/// Set of meta data which describes a camera available on the vehicle
class CameraMetaData : public QObject
class CameraMetaData
{
Q_OBJECT

public:
CameraMetaData(const QString& canonicalName,
const QString& brand,
const QString& model,
double sensorWidth,
double sensorHeight,
double imageWidth,
double imageHeight,
double focalLength,
bool landscape,
bool fixedOrientation,
double minTriggerInterval,
const QString& deprecatedTranslatedName,
QObject* parent = nullptr);

Q_GADGET
Q_PROPERTY(QString canonicalName MEMBER canonicalName CONSTANT)
Q_PROPERTY(QString deprecatedTranslatedName MEMBER deprecatedTranslatedName CONSTANT)
Q_PROPERTY(QString brand MEMBER brand CONSTANT)
Expand All @@ -44,21 +30,36 @@ class CameraMetaData : public QObject
Q_PROPERTY(bool fixedOrientation MEMBER fixedOrientation CONSTANT)
Q_PROPERTY(double minTriggerInterval MEMBER minTriggerInterval CONSTANT)

QString canonicalName; ///< Canonical name saved in plan files. Not translated.
QString brand; ///< Camera brand. Used for grouping.
QString model; ///< Camerar model
double sensorWidth; ///< Sensor size in millimeters
double sensorHeight; ///< Sensor size in millimeters
double imageWidth; ///< Image size in pixels
double imageHeight; ///< Image size in pixels
double focalLength; ///< Focal length in millimeters
bool landscape; ///< true: camera is in landscape orientation
bool fixedOrientation; ///< true: camera is in fixed orientation
double minTriggerInterval; ///< Minimum time in seconds between each photo taken, 0 for not specified
public:
CameraMetaData(const QString &canonicalName,
const QString &brand,
const QString &model,
double sensorWidth,
double sensorHeight,
double imageWidth,
double imageHeight,
double focalLength,
bool landscape,
bool fixedOrientation,
double minTriggerInterval,
const QString &deprecatedTranslatedName);

const QString canonicalName; ///< Canonical name saved in plan files. Not translated.
const QString brand; ///< Camera brand. Used for grouping.
const QString model; ///< Camerar model
const double sensorWidth; ///< Sensor size in millimeters
const double sensorHeight; ///< Sensor size in millimeters
const double imageWidth; ///< Image size in pixels
const double imageHeight; ///< Image size in pixels
const double focalLength; ///< Focal length in millimeters
const bool landscape; ///< true: camera is in landscape orientation
const bool fixedOrientation; ///< true: camera is in fixed orientation
const double minTriggerInterval; ///< Minimum time in seconds between each photo taken, 0 for not specified

/// In older builds camera names were incorrect marked for translation. This leads to plan files which have are language
/// dependant which is not a good thing. Newer plan files use the canonical name which is not translated. In order to support
/// loading older plan files we continue to include the incorrect translation so we can match against them as needed.
/// Newly added CameraMetaData entries should leave this value empty.
QString deprecatedTranslatedName;
const QString deprecatedTranslatedName;
};
Q_DECLARE_METATYPE(CameraMetaData)
Loading

0 comments on commit c27ddf3

Please sign in to comment.