Rework AutoPilotPlugin to support knowing if VehicleComponent available
This commit is contained in:
@@ -12,7 +12,7 @@
|
||||
#include "Vehicle.h"
|
||||
|
||||
APMAirframeComponent::APMAirframeComponent(Vehicle* vehicle, AutoPilotPlugin* autopilot, QObject* parent)
|
||||
: VehicleComponent (vehicle, autopilot, parent)
|
||||
: VehicleComponent (vehicle, autopilot, AutoPilotPlugin::UnknownVehicleComponent, parent)
|
||||
, _requiresFrameSetup (false)
|
||||
, _name (tr("Frame"))
|
||||
{
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
#include "Vehicle.h"
|
||||
|
||||
APMCameraComponent::APMCameraComponent(Vehicle* vehicle, AutoPilotPlugin* autopilot, QObject* parent)
|
||||
: VehicleComponent(vehicle, autopilot, parent)
|
||||
: VehicleComponent(vehicle, autopilot, AutoPilotPlugin::UnknownVehicleComponent, parent)
|
||||
, _name(tr("Camera"))
|
||||
{
|
||||
}
|
||||
|
||||
@@ -10,9 +10,9 @@
|
||||
|
||||
#include "APMFlightModesComponent.h"
|
||||
|
||||
APMFlightModesComponent::APMFlightModesComponent(Vehicle* vehicle, AutoPilotPlugin* autopilot, QObject* parent) :
|
||||
VehicleComponent(vehicle, autopilot, parent),
|
||||
_name(tr("Flight Modes"))
|
||||
APMFlightModesComponent::APMFlightModesComponent(Vehicle* vehicle, AutoPilotPlugin* autopilot, QObject* parent)
|
||||
: VehicleComponent(vehicle, autopilot, AutoPilotPlugin::KnownFlightModesVehicleComponent, parent)
|
||||
, _name(tr("Flight Modes"))
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -11,8 +11,8 @@
|
||||
#include "APMAutoPilotPlugin.h"
|
||||
|
||||
APMFollowComponent::APMFollowComponent(Vehicle *vehicle, AutoPilotPlugin *autopilot, QObject *parent)
|
||||
: VehicleComponent(vehicle, autopilot, parent),
|
||||
_name(QStringLiteral("Follow Me"))
|
||||
: VehicleComponent(vehicle, autopilot, AutoPilotPlugin::UnknownVehicleComponent, parent)
|
||||
, _name(QStringLiteral("Follow Me"))
|
||||
{
|
||||
// qCDebug() << Q_FUNC_INFO << this;
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
#include "APMAutoPilotPlugin.h"
|
||||
|
||||
APMHeliComponent::APMHeliComponent(Vehicle* vehicle, AutoPilotPlugin* autopilot, QObject* parent)
|
||||
: VehicleComponent(vehicle, autopilot, parent)
|
||||
: VehicleComponent(vehicle, autopilot, AutoPilotPlugin::UnknownVehicleComponent, parent)
|
||||
, _name(tr("Heli"))
|
||||
{
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
#include "APMLightsComponent.h"
|
||||
|
||||
APMLightsComponent::APMLightsComponent(Vehicle* vehicle, AutoPilotPlugin* autopilot, QObject* parent)
|
||||
: VehicleComponent(vehicle, autopilot, parent)
|
||||
: VehicleComponent(vehicle, autopilot, AutoPilotPlugin::UnknownVehicleComponent, parent)
|
||||
, _name(tr("Lights"))
|
||||
{
|
||||
}
|
||||
|
||||
@@ -11,8 +11,8 @@
|
||||
#include "APMPowerComponent.h"
|
||||
|
||||
APMPowerComponent::APMPowerComponent(Vehicle* vehicle, AutoPilotPlugin* autopilot, QObject* parent)
|
||||
: VehicleComponent(vehicle, autopilot, parent),
|
||||
_name(tr("Power"))
|
||||
: VehicleComponent(vehicle, autopilot, AutoPilotPlugin::KnownPowerVehicleComponent, parent)
|
||||
, _name(tr("Power"))
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -13,9 +13,9 @@
|
||||
#include "Fact.h"
|
||||
#include "Vehicle.h"
|
||||
|
||||
APMRadioComponent::APMRadioComponent(Vehicle* vehicle, AutoPilotPlugin* autopilot, QObject* parent) :
|
||||
VehicleComponent(vehicle, autopilot, parent),
|
||||
_name(tr("Radio"))
|
||||
APMRadioComponent::APMRadioComponent(Vehicle* vehicle, AutoPilotPlugin* autopilot, QObject* parent)
|
||||
: VehicleComponent(vehicle, autopilot, AutoPilotPlugin::KnownRadioVehicleComponent, parent)
|
||||
, _name(tr("Radio"))
|
||||
{
|
||||
_mapParams << QStringLiteral("RCMAP_ROLL") << QStringLiteral("RCMAP_PITCH") << QStringLiteral("RCMAP_YAW") << QStringLiteral("RCMAP_THROTTLE");
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
#include "APMRemoteSupportComponent.h"
|
||||
|
||||
APMRemoteSupportComponent::APMRemoteSupportComponent(Vehicle* vehicle, AutoPilotPlugin* autopilot, QObject* parent)
|
||||
: VehicleComponent(vehicle, autopilot, parent)
|
||||
: VehicleComponent(vehicle, autopilot, AutoPilotPlugin::UnknownVehicleComponent, parent)
|
||||
, _name(tr("Remote Support"))
|
||||
{
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
#include "QGCMAVLink.h"
|
||||
|
||||
APMSafetyComponent::APMSafetyComponent(Vehicle* vehicle, AutoPilotPlugin* autopilot, QObject* parent)
|
||||
: VehicleComponent(vehicle, autopilot, parent)
|
||||
: VehicleComponent(vehicle, autopilot, AutoPilotPlugin::KnownSafetyVehicleComponent, parent)
|
||||
, _name(tr("Safety"))
|
||||
{
|
||||
}
|
||||
|
||||
@@ -14,9 +14,9 @@
|
||||
|
||||
// These two list must be kept in sync
|
||||
|
||||
APMSensorsComponent::APMSensorsComponent(Vehicle* vehicle, AutoPilotPlugin* autopilot, QObject* parent) :
|
||||
VehicleComponent(vehicle, autopilot, parent),
|
||||
_name(tr("Sensors"))
|
||||
APMSensorsComponent::APMSensorsComponent(Vehicle* vehicle, AutoPilotPlugin* autopilot, QObject* parent)
|
||||
: VehicleComponent(vehicle, autopilot, AutoPilotPlugin::KnownSensorsVehicleComponent, parent)
|
||||
, _name(tr("Sensors"))
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
#include "APMSubFrameComponent.h"
|
||||
|
||||
APMSubFrameComponent::APMSubFrameComponent(Vehicle* vehicle, AutoPilotPlugin* autopilot, QObject* parent)
|
||||
: VehicleComponent(vehicle, autopilot, parent)
|
||||
: VehicleComponent(vehicle, autopilot, AutoPilotPlugin::UnknownVehicleComponent, parent)
|
||||
, _name(tr("Frame"))
|
||||
{
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
#include "Vehicle.h"
|
||||
|
||||
APMTuningComponent::APMTuningComponent(Vehicle* vehicle, AutoPilotPlugin* autopilot, QObject* parent)
|
||||
: VehicleComponent(vehicle, autopilot, parent)
|
||||
: VehicleComponent(vehicle, autopilot, AutoPilotPlugin::UnknownVehicleComponent, parent)
|
||||
, _name(tr("Tuning"))
|
||||
{
|
||||
}
|
||||
|
||||
@@ -76,8 +76,22 @@ void AutoPilotPlugin::parametersReadyPreChecks(void)
|
||||
if (!_setupComplete) {
|
||||
qgcApp()->showAppMessage(tr("One or more vehicle components require setup prior to flight."));
|
||||
|
||||
// Take the user to Vehicle Summary
|
||||
qgcApp()->showSetupView();
|
||||
// Take the user to Vehicle Config Summary
|
||||
qgcApp()->showVehicleConfig();
|
||||
QCoreApplication::processEvents(QEventLoop::ExcludeUserInputEvents);
|
||||
}
|
||||
}
|
||||
|
||||
VehicleComponent* AutoPilotPlugin::findKnownVehicleComponent(KnownVehicleComponent knownVehicleComponent)
|
||||
{
|
||||
if (knownVehicleComponent != UnknownVehicleComponent) {
|
||||
for(const QVariant& componentVariant: vehicleComponents()) {
|
||||
VehicleComponent* component = qobject_cast<VehicleComponent*>(qvariant_cast<QObject *>(componentVariant));
|
||||
if (component && component->KnownVehicleComponent() == knownVehicleComponent) {
|
||||
return component;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -32,6 +32,17 @@ public:
|
||||
AutoPilotPlugin(Vehicle* vehicle, QObject* parent);
|
||||
~AutoPilotPlugin();
|
||||
|
||||
// Vehicle Components which are available for firmware types
|
||||
enum KnownVehicleComponent {
|
||||
KnownRadioVehicleComponent,
|
||||
KnownFlightModesVehicleComponent,
|
||||
KnownSensorsVehicleComponent,
|
||||
KnownSafetyVehicleComponent,
|
||||
KnownPowerVehicleComponent,
|
||||
UnknownVehicleComponent // Firmware specific vehicle components
|
||||
};
|
||||
Q_ENUM(KnownVehicleComponent)
|
||||
|
||||
Q_PROPERTY(QVariantList vehicleComponents READ vehicleComponents NOTIFY vehicleComponentsChanged) ///< List of VehicleComponent objects
|
||||
Q_PROPERTY(bool setupComplete READ setupComplete NOTIFY setupCompleteChanged) ///< false: One or more vehicle components require setup
|
||||
|
||||
@@ -45,6 +56,10 @@ public:
|
||||
/// Returns the name of the vehicle component which must complete setup prior to this one. Empty string for none.
|
||||
Q_INVOKABLE virtual QString prerequisiteSetup(VehicleComponent* component) const = 0;
|
||||
|
||||
Q_INVOKABLE VehicleComponent* findKnownVehicleComponent(KnownVehicleComponent knownVehicleComponent);
|
||||
|
||||
Q_INVOKABLE bool knownVehicleComponentAvailable(KnownVehicleComponent knownVehicleComponent) { return findKnownVehicleComponent(knownVehicleComponent) != nullptr; }
|
||||
|
||||
// Property accessors
|
||||
bool setupComplete(void) const;
|
||||
|
||||
@@ -53,9 +68,6 @@ signals:
|
||||
void vehicleComponentsChanged (void);
|
||||
|
||||
protected:
|
||||
/// All access to AutoPilotPugin objects is through getInstanceForAutoPilotPlugin
|
||||
AutoPilotPlugin(QObject* parent = nullptr) : QObject(parent) { }
|
||||
|
||||
Vehicle* _vehicle;
|
||||
FirmwarePlugin* _firmwarePlugin;
|
||||
bool _setupComplete;
|
||||
|
||||
@@ -13,6 +13,8 @@ qt_add_library(AutoPilotPlugins STATIC
|
||||
AutoPilotPlugin.h
|
||||
Generic/GenericAutoPilotPlugin.cc
|
||||
Generic/GenericAutoPilotPlugin.h
|
||||
VehicleComponent.cc
|
||||
VehicleComponent.h
|
||||
)
|
||||
|
||||
target_link_libraries(AutoPilotPlugins
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
#include "AutoPilotPlugin.h"
|
||||
|
||||
ESP8266Component::ESP8266Component(Vehicle* vehicle, AutoPilotPlugin* autopilot, QObject* parent)
|
||||
: VehicleComponent(vehicle, autopilot, parent)
|
||||
: VehicleComponent(vehicle, autopilot, AutoPilotPlugin::UnknownVehicleComponent, parent)
|
||||
, _name(tr("WiFi Bridge"))
|
||||
{
|
||||
|
||||
|
||||
@@ -10,9 +10,9 @@
|
||||
#include "MotorComponent.h"
|
||||
#include "AutoPilotPlugin.h"
|
||||
|
||||
MotorComponent::MotorComponent(Vehicle* vehicle, AutoPilotPlugin* autopilot, QObject* parent) :
|
||||
VehicleComponent(vehicle, autopilot, parent),
|
||||
_name(tr("Motors"))
|
||||
MotorComponent::MotorComponent(Vehicle* vehicle, AutoPilotPlugin* autopilot, QObject* parent)
|
||||
: VehicleComponent(vehicle, autopilot, AutoPilotPlugin::UnknownVehicleComponent, parent)
|
||||
, _name(tr("Motors"))
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
#include "AutoPilotPlugin.h"
|
||||
|
||||
SyslinkComponent::SyslinkComponent(Vehicle* vehicle, AutoPilotPlugin* autopilot, QObject* parent)
|
||||
: VehicleComponent(vehicle, autopilot, parent)
|
||||
: VehicleComponent(vehicle, autopilot, AutoPilotPlugin::UnknownVehicleComponent, parent)
|
||||
, _name(tr("Syslink"))
|
||||
{
|
||||
|
||||
|
||||
@@ -16,9 +16,10 @@
|
||||
|
||||
static bool imageProviderAdded{false};
|
||||
|
||||
ActuatorComponent::ActuatorComponent(Vehicle* vehicle, AutoPilotPlugin* autopilot, QObject* parent) :
|
||||
VehicleComponent(vehicle, autopilot, parent),
|
||||
_name(tr("Actuators")), _actuators(*vehicle->actuators())
|
||||
ActuatorComponent::ActuatorComponent(Vehicle* vehicle, AutoPilotPlugin* autopilot, QObject* parent)
|
||||
: VehicleComponent(vehicle, autopilot, AutoPilotPlugin::UnknownVehicleComponent, parent)
|
||||
, _name(tr("Actuators"))
|
||||
, _actuators(*vehicle->actuators())
|
||||
{
|
||||
if (!imageProviderAdded) {
|
||||
// TODO: qmlAppEngine should not be accessed inside app
|
||||
|
||||
@@ -15,9 +15,9 @@
|
||||
#include "ParameterManager.h"
|
||||
#include "Vehicle.h"
|
||||
|
||||
AirframeComponent::AirframeComponent(Vehicle* vehicle, AutoPilotPlugin* autopilot, QObject* parent) :
|
||||
VehicleComponent(vehicle, autopilot, parent),
|
||||
_name(tr("Airframe"))
|
||||
AirframeComponent::AirframeComponent(Vehicle* vehicle, AutoPilotPlugin* autopilot, QObject* parent)
|
||||
: VehicleComponent(vehicle, autopilot, AutoPilotPlugin::UnknownVehicleComponent, parent)
|
||||
, _name(tr("Airframe"))
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@@ -20,9 +20,9 @@ struct SwitchListItem {
|
||||
const char* name;
|
||||
};
|
||||
|
||||
FlightModesComponent::FlightModesComponent(Vehicle* vehicle, AutoPilotPlugin* autopilot, QObject* parent) :
|
||||
VehicleComponent(vehicle, autopilot, parent),
|
||||
_name(tr("Flight Modes"))
|
||||
FlightModesComponent::FlightModesComponent(Vehicle* vehicle, AutoPilotPlugin* autopilot, QObject* parent)
|
||||
: VehicleComponent(vehicle, autopilot, AutoPilotPlugin::KnownFlightModesVehicleComponent, parent)
|
||||
, _name(tr("Flight Modes"))
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
#include "Vehicle.h"
|
||||
|
||||
PX4FlightBehavior::PX4FlightBehavior(Vehicle* vehicle, AutoPilotPlugin* autopilot, QObject* parent)
|
||||
: VehicleComponent(vehicle, autopilot, parent)
|
||||
: VehicleComponent(vehicle, autopilot, AutoPilotPlugin::UnknownVehicleComponent, parent)
|
||||
, _name(tr("Flight Behavior"))
|
||||
{
|
||||
}
|
||||
|
||||
@@ -12,9 +12,9 @@
|
||||
#include "ParameterManager.h"
|
||||
#include "Vehicle.h"
|
||||
|
||||
PX4RadioComponent::PX4RadioComponent(Vehicle* vehicle, AutoPilotPlugin* autopilot, QObject* parent) :
|
||||
VehicleComponent(vehicle, autopilot, parent),
|
||||
_name(tr("Radio"))
|
||||
PX4RadioComponent::PX4RadioComponent(Vehicle* vehicle, AutoPilotPlugin* autopilot, QObject* parent)
|
||||
: VehicleComponent(vehicle, autopilot, AutoPilotPlugin::KnownRadioVehicleComponent, parent)
|
||||
, _name(tr("Radio"))
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
#include "Vehicle.h"
|
||||
|
||||
PX4TuningComponent::PX4TuningComponent(Vehicle* vehicle, AutoPilotPlugin* autopilot, QObject* parent)
|
||||
: VehicleComponent(vehicle, autopilot, parent)
|
||||
: VehicleComponent(vehicle, autopilot, AutoPilotPlugin::UnknownVehicleComponent, parent)
|
||||
, _name(tr("PID Tuning"))
|
||||
{
|
||||
}
|
||||
|
||||
@@ -15,9 +15,9 @@
|
||||
#include "ParameterManager.h"
|
||||
#include "Vehicle.h"
|
||||
|
||||
PowerComponent::PowerComponent(Vehicle* vehicle, AutoPilotPlugin* autopilot, QObject* parent) :
|
||||
VehicleComponent(vehicle, autopilot, parent),
|
||||
_name(tr("Power"))
|
||||
PowerComponent::PowerComponent(Vehicle* vehicle, AutoPilotPlugin* autopilot, QObject* parent)
|
||||
: VehicleComponent(vehicle, autopilot, AutoPilotPlugin::KnownPowerVehicleComponent, parent)
|
||||
, _name(tr("Power"))
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
#include "SafetyComponent.h"
|
||||
|
||||
SafetyComponent::SafetyComponent(Vehicle* vehicle, AutoPilotPlugin* autopilot, QObject* parent) :
|
||||
VehicleComponent(vehicle, autopilot, parent),
|
||||
VehicleComponent(vehicle, autopilot, AutoPilotPlugin::KnownSafetyVehicleComponent, parent),
|
||||
_name(tr("Safety"))
|
||||
{
|
||||
}
|
||||
|
||||
@@ -11,9 +11,9 @@
|
||||
#include "ParameterManager.h"
|
||||
#include "Vehicle.h"
|
||||
|
||||
SensorsComponent::SensorsComponent(Vehicle* vehicle, AutoPilotPlugin* autopilot, QObject* parent) :
|
||||
VehicleComponent(vehicle, autopilot, parent),
|
||||
_name(tr("Sensors"))
|
||||
SensorsComponent::SensorsComponent(Vehicle* vehicle, AutoPilotPlugin* autopilot, QObject* parent)
|
||||
: VehicleComponent(vehicle, autopilot, AutoPilotPlugin::KnownSensorsVehicleComponent, parent)
|
||||
, _name(tr("Sensors"))
|
||||
{
|
||||
_deviceIds = QStringList({QStringLiteral("CAL_GYRO0_ID"), QStringLiteral("CAL_ACC0_ID") });
|
||||
|
||||
|
||||
@@ -18,10 +18,11 @@
|
||||
#include <QtQml/QQmlContext>
|
||||
#include <QtQuick/QQuickItem>
|
||||
|
||||
VehicleComponent::VehicleComponent(Vehicle* vehicle, AutoPilotPlugin* autopilot, QObject* parent) :
|
||||
QObject(parent),
|
||||
_vehicle(vehicle),
|
||||
_autopilot(autopilot)
|
||||
VehicleComponent::VehicleComponent(Vehicle* vehicle, AutoPilotPlugin* autopilot, AutoPilotPlugin::KnownVehicleComponent KnownVehicleComponent, QObject* parent)
|
||||
: QObject (parent)
|
||||
, _vehicle (vehicle)
|
||||
, _autopilot (autopilot)
|
||||
, _KnownVehicleComponent (KnownVehicleComponent)
|
||||
{
|
||||
if (!vehicle || !autopilot) {
|
||||
qWarning() << "Internal error";
|
||||
@@ -7,18 +7,15 @@
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
|
||||
/// @file
|
||||
/// @author Don Gagne <don@thegagnes.com>
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "AutoPilotPlugin.h"
|
||||
|
||||
#include <QtCore/QObject>
|
||||
#include <QtCore/QUrl>
|
||||
#include <QtCore/QVariant>
|
||||
#include <QtCore/QStringList>
|
||||
|
||||
class AutoPilotPlugin;
|
||||
class Vehicle;
|
||||
class QQuickItem;
|
||||
class QQmlContext;
|
||||
@@ -39,9 +36,10 @@ class VehicleComponent : public QObject
|
||||
Q_PROPERTY(QUrl summaryQmlSource READ summaryQmlSource CONSTANT)
|
||||
Q_PROPERTY(bool allowSetupWhileArmed READ allowSetupWhileArmed CONSTANT)
|
||||
Q_PROPERTY(bool allowSetupWhileFlying READ allowSetupWhileFlying CONSTANT)
|
||||
Q_PROPERTY(AutoPilotPlugin::KnownVehicleComponent KnownVehicleComponent READ KnownVehicleComponent CONSTANT)
|
||||
|
||||
public:
|
||||
VehicleComponent(Vehicle* vehicle, AutoPilotPlugin* autopilot, QObject* parent = nullptr);
|
||||
VehicleComponent(Vehicle* vehicle, AutoPilotPlugin* autopilot, AutoPilotPlugin::KnownVehicleComponent KnownVehicleComponent, QObject* parent = nullptr);
|
||||
~VehicleComponent();
|
||||
|
||||
virtual QString name(void) const = 0;
|
||||
@@ -68,6 +66,8 @@ public:
|
||||
/// signals which are used to track parameter changes which affect setupComplete state.
|
||||
virtual void setupTriggerSignals(void);
|
||||
|
||||
AutoPilotPlugin::KnownVehicleComponent KnownVehicleComponent(void) const { return _KnownVehicleComponent; }
|
||||
|
||||
signals:
|
||||
void setupCompleteChanged (void);
|
||||
void setupSourceChanged (void);
|
||||
@@ -76,6 +76,7 @@ protected slots:
|
||||
void _triggerUpdated(QVariant value);
|
||||
|
||||
protected:
|
||||
Vehicle* _vehicle;
|
||||
AutoPilotPlugin* _autopilot;
|
||||
Vehicle* _vehicle;
|
||||
AutoPilotPlugin* _autopilot;
|
||||
AutoPilotPlugin::KnownVehicleComponent _KnownVehicleComponent;
|
||||
};
|
||||
@@ -116,9 +116,9 @@ public:
|
||||
/// @return true: Firmware supports all specified capabilites
|
||||
virtual bool isCapable(const Vehicle *vehicle, FirmwareCapabilities capabilities);
|
||||
|
||||
/// Returns VehicleComponents for specified Vehicle
|
||||
/// Returns ComponentInformation for specified Vehicle
|
||||
/// @param vehicle Vehicle to associate with components
|
||||
/// @return List of VehicleComponents for the specified vehicle. Caller owns returned objects and must
|
||||
/// @return List of ComponentInformation for the specified vehicle. Caller owns returned objects and must
|
||||
/// free when no longer needed.
|
||||
virtual QList<VehicleComponent*> componentsForVehicle(AutoPilotPlugin* vehicle);
|
||||
|
||||
|
||||
@@ -532,11 +532,11 @@ QQuickWindow *QGCApplication::mainRootWindow()
|
||||
return _mainRootWindow;
|
||||
}
|
||||
|
||||
void QGCApplication::showSetupView()
|
||||
void QGCApplication::showVehicleConfig()
|
||||
{
|
||||
if (_rootQmlObject()) {
|
||||
QVariant arg = "";
|
||||
QMetaObject::invokeMethod(_rootQmlObject(), "showVehicleSetupTool", Q_ARG(QVariant, arg));
|
||||
QMetaObject::invokeMethod(_rootQmlObject(), "showVehicleConfig", Q_ARG(QVariant, arg));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -99,7 +99,7 @@ signals:
|
||||
void languageChanged(const QLocale locale);
|
||||
|
||||
public slots:
|
||||
void showSetupView();
|
||||
void showVehicleConfig();
|
||||
|
||||
void qmlAttemptWindowClose();
|
||||
|
||||
|
||||
@@ -143,10 +143,20 @@ ApplicationWindow {
|
||||
showTool(qsTr("Analyze Tools"), "AnalyzeView.qml", "/qmlimages/Analyze.svg")
|
||||
}
|
||||
|
||||
function showVehicleSetupTool(setupPage = "") {
|
||||
function showVehicleConfig() {
|
||||
showTool(qsTr("Vehicle Configuration"), "SetupView.qml", "/qmlimages/Gears.svg")
|
||||
if (setupPage !== "") {
|
||||
toolDrawerLoader.item.showNamedComponentPanel(setupPage)
|
||||
}
|
||||
|
||||
function showVehicleConfigParametersPage() {
|
||||
showVehicleConfig()
|
||||
toolDrawerLoader.item.showParametersPanel()
|
||||
}
|
||||
|
||||
function showKnownVehicleComponentConfigPage(knownVehicleComponent) {
|
||||
showVehicleConfig()
|
||||
let vehicleComponent = globals.activeVehicle.autopilotPlugin.findKnownVehicleComponent(knownVehicleComponent)
|
||||
if (vehicleComponent) {
|
||||
toolDrawerLoader.item.showVehicleComponentPanel(vehicleComponent)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -343,7 +353,7 @@ ApplicationWindow {
|
||||
onClicked: {
|
||||
if (mainWindow.allowViewSwitch()) {
|
||||
mainWindow.closeIndicatorDrawer()
|
||||
mainWindow.showVehicleSetupTool()
|
||||
mainWindow.showVehicleConfig()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@ import QGroundControl.ScreenTools
|
||||
import QGroundControl.Palette
|
||||
import QGroundControl.FactSystem
|
||||
import QGroundControl.FactControls
|
||||
import QGroundControl.AutoPilotPlugin
|
||||
import MAVLink
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
@@ -398,12 +399,14 @@ Item {
|
||||
}
|
||||
|
||||
SettingsGroupLayout {
|
||||
visible: _activeVehicle.autopilotPlugin.knownVehicleComponentAvailable(AutoPilotPlugin.KnownPowerVehicleComponent)
|
||||
|
||||
LabelledButton {
|
||||
label: qsTr("Vehicle Power")
|
||||
buttonText: qsTr("Configure")
|
||||
|
||||
onClicked: {
|
||||
mainWindow.showVehicleSetupTool(qsTr("Power"))
|
||||
mainWindow.showKnownVehicleComponentConfigPage(AutoPilotPlugin.KnownPowerVehicleComponent)
|
||||
mainWindow.closeIndicatorDrawer()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ import QGroundControl.ScreenTools
|
||||
import QGroundControl.Palette
|
||||
import QGroundControl.FactSystem
|
||||
import QGroundControl.FactControls
|
||||
import QGroundControl.AutoPilotPlugin
|
||||
|
||||
RowLayout {
|
||||
id: control
|
||||
@@ -217,11 +218,12 @@ RowLayout {
|
||||
|
||||
LabelledButton {
|
||||
Layout.fillWidth: true
|
||||
label: qsTr("RC Transmitter")
|
||||
label: qsTr("Flight Modes")
|
||||
buttonText: qsTr("Configure")
|
||||
visible: _activeVehicle.autopilotPlugin.knownVehicleComponentAvailable(AutoPilotPlugin.KnownFlightModesVehicleComponent)
|
||||
|
||||
onClicked: {
|
||||
mainWindow.showVehicleSetupTool(qsTr("Radio"))
|
||||
mainWindow.showKnownVehicleComponentConfigPage(AutoPilotPlugin.KnownFlightModesVehicleComponent)
|
||||
mainWindow.closeIndicatorDrawer()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -94,7 +94,7 @@ RowLayout {
|
||||
}
|
||||
} else {
|
||||
// Best we can do is determine readiness based on AutoPilot component setup and health indicators from SYS_STATUS
|
||||
if (_activeVehicle.allSensorsHealthy && _activeVehicle.autopilot.setupComplete) {
|
||||
if (_activeVehicle.allSensorsHealthy && _activeVehicle.autopilotPlugin.setupComplete) {
|
||||
_mainStatusBGColor = "green"
|
||||
return mainStatusLabel._readyToFlyText
|
||||
} else {
|
||||
@@ -328,7 +328,7 @@ RowLayout {
|
||||
QGCButton {
|
||||
text: qsTr("Configure")
|
||||
onClicked: {
|
||||
mainWindow.showVehicleSetupTool(qsTr("Parameters"))
|
||||
mainWindow.showVehicleConfigParametersPage()
|
||||
mainWindow.closeIndicatorDrawer()
|
||||
}
|
||||
}
|
||||
@@ -337,7 +337,7 @@ RowLayout {
|
||||
QGCButton {
|
||||
text: qsTr("Configure")
|
||||
onClicked: {
|
||||
mainWindow.showVehicleSetupTool()
|
||||
mainWindow.showVehicleConfig()
|
||||
mainWindow.closeIndicatorDrawer()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -134,7 +134,7 @@ public:
|
||||
Q_ENUM(CheckList)
|
||||
|
||||
Q_PROPERTY(int id READ id CONSTANT)
|
||||
Q_PROPERTY(AutoPilotPlugin* autopilot MEMBER _autopilotPlugin CONSTANT)
|
||||
Q_PROPERTY(AutoPilotPlugin* autopilotPlugin MEMBER _autopilotPlugin CONSTANT)
|
||||
Q_PROPERTY(QGeoCoordinate coordinate READ coordinate NOTIFY coordinateChanged)
|
||||
Q_PROPERTY(QGeoCoordinate homePosition READ homePosition NOTIFY homePositionChanged)
|
||||
Q_PROPERTY(QGeoCoordinate armedPosition READ armedPosition NOTIFY armedPositionChanged)
|
||||
@@ -458,7 +458,7 @@ public:
|
||||
/// guarantee that it makes it to the vehicle.
|
||||
void sendMessageMultiple(mavlink_message_t message);
|
||||
|
||||
/// Provides access to uas from vehicle. Temporary workaround until AutoPilotPlugin is fully phased out.
|
||||
/// Provides access to AutoPilotPlugin for this vehicle.
|
||||
AutoPilotPlugin* autopilotPlugin() { return _autopilotPlugin; }
|
||||
|
||||
/// Provides access to the Firmware Plugin for this Vehicle
|
||||
|
||||
@@ -3,8 +3,6 @@ find_package(Qt6 REQUIRED COMPONENTS Core Gui Qml Quick)
|
||||
qt_add_library(VehicleSetup STATIC
|
||||
JoystickConfigController.cc
|
||||
JoystickConfigController.h
|
||||
VehicleComponent.cc
|
||||
VehicleComponent.h
|
||||
)
|
||||
|
||||
target_link_libraries(VehicleSetup
|
||||
|
||||
@@ -47,7 +47,7 @@ Rectangle {
|
||||
|
||||
function _showSummaryPanel() {
|
||||
if (_fullParameterVehicleAvailable) {
|
||||
if (QGroundControl.multiVehicleManager.activeVehicle.autopilot.vehicleComponents.length === 0) {
|
||||
if (QGroundControl.multiVehicleManager.activeVehicle.autopilotPlugin.vehicleComponents.length === 0) {
|
||||
panelLoader.setSourceComponent(noComponentsVehicleSummaryComponent)
|
||||
} else {
|
||||
panelLoader.setSource("VehicleSummary.qml")
|
||||
@@ -70,7 +70,7 @@ Rectangle {
|
||||
function showVehicleComponentPanel(vehicleComponent)
|
||||
{
|
||||
if (mainWindow.allowViewSwitch()) {
|
||||
var autopilotPlugin = QGroundControl.multiVehicleManager.activeVehicle.autopilot
|
||||
var autopilotPlugin = QGroundControl.multiVehicleManager.activeVehicle.autopilotPlugin
|
||||
var prereq = autopilotPlugin.prerequisiteSetup(vehicleComponent)
|
||||
if (prereq !== "") {
|
||||
_messagePanelText = qsTr("%1 setup must be completed prior to %2 setup.").arg(prereq).arg(vehicleComponent.name)
|
||||
@@ -88,18 +88,10 @@ Rectangle {
|
||||
}
|
||||
}
|
||||
|
||||
function showNamedComponentPanel(panelButtonName) {
|
||||
function showParametersPanel() {
|
||||
if (mainWindow.allowViewSwitch()) {
|
||||
for (var i=0; i<componentRepeater.count; i++) {
|
||||
var panelButton = componentRepeater.itemAt(i)
|
||||
if (panelButton.text === panelButtonName) {
|
||||
showVehicleComponentPanel(panelButton.componentUrl)
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (panelButtonName === parametersButton.text) {
|
||||
parametersButton.clicked()
|
||||
}
|
||||
parametersButton.checked = true
|
||||
panelLoader.setSource("SetupParameterEditor.qml")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -251,7 +243,7 @@ Rectangle {
|
||||
|
||||
Repeater {
|
||||
id: componentRepeater
|
||||
model: _fullParameterVehicleAvailable ? QGroundControl.multiVehicleManager.activeVehicle.autopilot.vehicleComponents : 0
|
||||
model: _fullParameterVehicleAvailable ? QGroundControl.multiVehicleManager.activeVehicle.autopilotPlugin.vehicleComponents : 0
|
||||
|
||||
ConfigButton {
|
||||
icon.source: modelData.iconResource
|
||||
|
||||
@@ -86,7 +86,7 @@ Rectangle {
|
||||
qsTr("Below you will find a summary of the settings for your vehicle. To the left are the setup menus for each component.") :
|
||||
qsTr("WARNING: Your vehicle requires setup prior to flight. Please resolve the items marked in red using the menu on the left.")
|
||||
|
||||
property bool setupComplete: QGroundControl.multiVehicleManager.activeVehicle ? QGroundControl.multiVehicleManager.activeVehicle.autopilot.setupComplete : false
|
||||
property bool setupComplete: QGroundControl.multiVehicleManager.activeVehicle ? QGroundControl.multiVehicleManager.activeVehicle.autopilotPlugin.setupComplete : false
|
||||
}
|
||||
|
||||
Flow {
|
||||
@@ -95,7 +95,7 @@ Rectangle {
|
||||
spacing: _summaryBoxSpace
|
||||
|
||||
Repeater {
|
||||
model: QGroundControl.multiVehicleManager.activeVehicle ? QGroundControl.multiVehicleManager.activeVehicle.autopilot.vehicleComponents : undefined
|
||||
model: QGroundControl.multiVehicleManager.activeVehicle ? QGroundControl.multiVehicleManager.activeVehicle.autopilotPlugin.vehicleComponents : undefined
|
||||
|
||||
// Outer summary item rectangle
|
||||
Rectangle {
|
||||
|
||||
Reference in New Issue
Block a user