Commit f08d592f authored by Don Gagne's avatar Don Gagne

Added new _autopilot member

parent 76e8afff
...@@ -62,8 +62,8 @@ static const struct mavType mavTypeInfo[] = { ...@@ -62,8 +62,8 @@ static const struct mavType mavTypeInfo[] = {
}; };
static size_t cMavTypes = sizeof(mavTypeInfo) / sizeof(mavTypeInfo[0]); static size_t cMavTypes = sizeof(mavTypeInfo) / sizeof(mavTypeInfo[0]);
AirframeComponent::AirframeComponent(UASInterface* uas, QObject* parent) : AirframeComponent::AirframeComponent(UASInterface* uas, AutoPilotPlugin* autopilot, QObject* parent) :
PX4Component(uas, parent), PX4Component(uas, autopilot, parent),
_name(tr("Airframe")) _name(tr("Airframe"))
{ {
// Validate that our mavTypeInfo array hasn't gotten out of sync // Validate that our mavTypeInfo array hasn't gotten out of sync
......
...@@ -35,7 +35,7 @@ class AirframeComponent : public PX4Component ...@@ -35,7 +35,7 @@ class AirframeComponent : public PX4Component
Q_OBJECT Q_OBJECT
public: public:
AirframeComponent(UASInterface* uas, QObject* parent = NULL); AirframeComponent(UASInterface* uas, AutoPilotPlugin* autopilot, QObject* parent = NULL);
// Virtuals from PX4Component // Virtuals from PX4Component
virtual const char** setupCompleteChangedTriggerList(void) const; virtual const char** setupCompleteChangedTriggerList(void) const;
......
...@@ -45,8 +45,8 @@ static const SwitchListItem switchList[] = { ...@@ -45,8 +45,8 @@ static const SwitchListItem switchList[] = {
}; };
static const size_t cSwitchList = sizeof(switchList) / sizeof(switchList[0]); static const size_t cSwitchList = sizeof(switchList) / sizeof(switchList[0]);
FlightModesComponent::FlightModesComponent(UASInterface* uas, QObject* parent) : FlightModesComponent::FlightModesComponent(UASInterface* uas, AutoPilotPlugin* autopilot, QObject* parent) :
PX4Component(uas, parent), PX4Component(uas, autopilot, parent),
_name(tr("Flight Modes")) _name(tr("Flight Modes"))
{ {
} }
......
...@@ -35,7 +35,7 @@ class FlightModesComponent : public PX4Component ...@@ -35,7 +35,7 @@ class FlightModesComponent : public PX4Component
Q_OBJECT Q_OBJECT
public: public:
FlightModesComponent(UASInterface* uas, QObject* parent = NULL); FlightModesComponent(UASInterface* uas, AutoPilotPlugin* autopilot, QObject* parent = NULL);
// Virtuals from PX4Component // Virtuals from PX4Component
virtual const char** setupCompleteChangedTriggerList(void) const; virtual const char** setupCompleteChangedTriggerList(void) const;
......
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
#include "RadioComponent.h" #include "RadioComponent.h"
#include "SensorsComponent.h" #include "SensorsComponent.h"
#include "FlightModesComponent.h" #include "FlightModesComponent.h"
#include "SafetyComponent.h"
#include "AutoPilotPluginManager.h" #include "AutoPilotPluginManager.h"
#include "UASManager.h" #include "UASManager.h"
#include "QGCUASParamManagerInterface.h" #include "QGCUASParamManagerInterface.h"
...@@ -196,19 +197,23 @@ const QVariantList& PX4AutoPilotPlugin::components(void) ...@@ -196,19 +197,23 @@ const QVariantList& PX4AutoPilotPlugin::components(void)
Q_ASSERT(_uas); Q_ASSERT(_uas);
component = new AirframeComponent(_uas); component = new AirframeComponent(_uas, this);
Q_CHECK_PTR(component); Q_CHECK_PTR(component);
_components.append(QVariant::fromValue(component)); _components.append(QVariant::fromValue(component));
component = new RadioComponent(_uas); component = new RadioComponent(_uas, this);
Q_CHECK_PTR(component); Q_CHECK_PTR(component);
_components.append(QVariant::fromValue(component)); _components.append(QVariant::fromValue(component));
component = new FlightModesComponent(_uas); component = new FlightModesComponent(_uas, this);
Q_CHECK_PTR(component); Q_CHECK_PTR(component);
_components.append(QVariant::fromValue(component)); _components.append(QVariant::fromValue(component));
component = new SensorsComponent(_uas); component = new SensorsComponent(_uas, this);
Q_CHECK_PTR(component);
_components.append(QVariant::fromValue(component));
component = new SafetyComponent(_uas, this);
Q_CHECK_PTR(component); Q_CHECK_PTR(component);
_components.append(QVariant::fromValue(component)); _components.append(QVariant::fromValue(component));
} }
......
...@@ -26,8 +26,8 @@ ...@@ -26,8 +26,8 @@
#include "PX4Component.h" #include "PX4Component.h"
PX4Component::PX4Component(UASInterface* uas, QObject* parent) : PX4Component::PX4Component(UASInterface* uas, AutoPilotPlugin* autopilot, QObject* parent) :
VehicleComponent(uas, parent) VehicleComponent(uas, autopilot, parent)
{ {
bool fSuccess = connect(_paramMgr, SIGNAL(parameterUpdated(int, QString, QVariant)), this, SLOT(_parameterUpdated(int, QString, QVariant))); bool fSuccess = connect(_paramMgr, SIGNAL(parameterUpdated(int, QString, QVariant)), this, SLOT(_parameterUpdated(int, QString, QVariant)));
Q_ASSERT(fSuccess); Q_ASSERT(fSuccess);
......
...@@ -35,7 +35,7 @@ class PX4Component : public VehicleComponent ...@@ -35,7 +35,7 @@ class PX4Component : public VehicleComponent
Q_OBJECT Q_OBJECT
public: public:
PX4Component(UASInterface* uas, QObject* parent = NULL); PX4Component(UASInterface* uas, AutoPilotPlugin* autopilot, QObject* parent = NULL);
/// @brief Returns an array of parameter names for which a change should cause the setupCompleteChanged /// @brief Returns an array of parameter names for which a change should cause the setupCompleteChanged
/// signal to be emitted. Last element is signalled by NULL. Must be implemented by upper level class. /// signal to be emitted. Last element is signalled by NULL. Must be implemented by upper level class.
...@@ -45,7 +45,6 @@ private slots: ...@@ -45,7 +45,6 @@ private slots:
/// @brief Connected to QGCUASParamManagerInterface::parameterUpdated signal in order to signal /// @brief Connected to QGCUASParamManagerInterface::parameterUpdated signal in order to signal
/// setupCompleteChanged at appropriate times. /// setupCompleteChanged at appropriate times.
void _parameterUpdated(int compId, QString paramName, QVariant value); void _parameterUpdated(int compId, QString paramName, QVariant value);
}; };
#endif #endif
...@@ -31,8 +31,8 @@ ...@@ -31,8 +31,8 @@
/// @brief Parameters which signal a change in setupComplete state /// @brief Parameters which signal a change in setupComplete state
static const char* triggerParams[] = { "RC_MAP_MODE_SW", NULL }; static const char* triggerParams[] = { "RC_MAP_MODE_SW", NULL };
RadioComponent::RadioComponent(UASInterface* uas, QObject* parent) : RadioComponent::RadioComponent(UASInterface* uas, AutoPilotPlugin* autopilot, QObject* parent) :
PX4Component(uas, parent), PX4Component(uas, autopilot, parent),
_name(tr("Radio")) _name(tr("Radio"))
{ {
} }
......
...@@ -36,7 +36,7 @@ class RadioComponent : public PX4Component ...@@ -36,7 +36,7 @@ class RadioComponent : public PX4Component
Q_OBJECT Q_OBJECT
public: public:
RadioComponent(UASInterface* uas, QObject* parent = NULL); RadioComponent(UASInterface* uas, AutoPilotPlugin* autopilot, QObject* parent = NULL);
// Virtuals from PX4Component // Virtuals from PX4Component
virtual const char** setupCompleteChangedTriggerList(void) const; virtual const char** setupCompleteChangedTriggerList(void) const;
......
...@@ -36,8 +36,8 @@ static const char* triggerParams[] = { "SENS_MAG_XOFF", "SENS_GYRO_XOFF", "SENS ...@@ -36,8 +36,8 @@ static const char* triggerParams[] = { "SENS_MAG_XOFF", "SENS_GYRO_XOFF", "SENS
/// @brief Used to translate from parameter name to user string /// @brief Used to translate from parameter name to user string
static const char* triggerSensors[] = { "Compass", "Gyro", "Acceleromter", "Airspeed", NULL }; static const char* triggerSensors[] = { "Compass", "Gyro", "Acceleromter", "Airspeed", NULL };
SensorsComponent::SensorsComponent(UASInterface* uas, QObject* parent) : SensorsComponent::SensorsComponent(UASInterface* uas, AutoPilotPlugin* autopilot, QObject* parent) :
PX4Component(uas, parent), PX4Component(uas, autopilot, parent),
_name(tr("Sensors")) _name(tr("Sensors"))
{ {
} }
......
...@@ -35,7 +35,7 @@ class SensorsComponent : public PX4Component ...@@ -35,7 +35,7 @@ class SensorsComponent : public PX4Component
Q_OBJECT Q_OBJECT
public: public:
SensorsComponent(UASInterface* uas, QObject* parent = NULL); SensorsComponent(UASInterface* uas, AutoPilotPlugin* autopilot, QObject* parent = NULL);
// Virtuals from PX4Component // Virtuals from PX4Component
virtual const char** setupCompleteChangedTriggerList(void) const; virtual const char** setupCompleteChangedTriggerList(void) const;
......
...@@ -25,13 +25,18 @@ ...@@ -25,13 +25,18 @@
/// @author Don Gagne <don@thegagnes.com> /// @author Don Gagne <don@thegagnes.com>
#include "VehicleComponent.h" #include "VehicleComponent.h"
#include "AutoPilotPlugin.h"
VehicleComponent::VehicleComponent(UASInterface* uas, QObject* parent) : VehicleComponent::VehicleComponent(UASInterface* uas, AutoPilotPlugin* autopilot, QObject* parent) :
QObject(parent), QObject(parent),
_uas(uas), _uas(uas),
_paramMgr(_uas->getParamManager()) _autopilot(autopilot)
{ {
Q_ASSERT(uas);
Q_ASSERT(autopilot);
_paramMgr = _uas->getParamManager();
Q_ASSERT(_paramMgr);
} }
VehicleComponent::~VehicleComponent() VehicleComponent::~VehicleComponent()
......
...@@ -21,6 +21,9 @@ ...@@ -21,6 +21,9 @@
======================================================================*/ ======================================================================*/
/// @file
/// @author Don Gagne <don@thegagnes.com>
#ifndef VEHICLECOMPONENT_H #ifndef VEHICLECOMPONENT_H
#define VEHICLECOMPONENT_H #define VEHICLECOMPONENT_H
...@@ -30,11 +33,10 @@ ...@@ -30,11 +33,10 @@
#include "UASInterface.h" #include "UASInterface.h"
/// @file class AutoPilotPlugin;
/// @brief Vehicle Component class. A vehicle component is an object which
/// abstracts the physical portion of a vehicle into a set of /// A vehicle component is an object which abstracts the physical portion of a vehicle into a set of
/// configurable values and user interface. /// configurable values and user interface.
/// @author Don Gagne <don@thegagnes.com>
class VehicleComponent : public QObject class VehicleComponent : public QObject
{ {
...@@ -50,7 +52,7 @@ class VehicleComponent : public QObject ...@@ -50,7 +52,7 @@ class VehicleComponent : public QObject
Q_PROPERTY(QVariantList summaryItems READ summaryItems CONSTANT); Q_PROPERTY(QVariantList summaryItems READ summaryItems CONSTANT);
public: public:
VehicleComponent(UASInterface* uas, QObject* parent = NULL); VehicleComponent(UASInterface* uas, AutoPilotPlugin* autopilot, QObject* parent = NULL);
~VehicleComponent(); ~VehicleComponent();
virtual QString name(void) const = 0; virtual QString name(void) const = 0;
...@@ -70,6 +72,7 @@ signals: ...@@ -70,6 +72,7 @@ signals:
protected: protected:
UASInterface* _uas; UASInterface* _uas;
AutoPilotPlugin* _autopilot;
QGCUASParamManagerInterface* _paramMgr; QGCUASParamManagerInterface* _paramMgr;
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment