Browse Source

Added new _autopilot member

QGC4.4
Don Gagne 10 years ago
parent
commit
f08d592f23
  1. 4
      src/AutoPilotPlugins/PX4/AirframeComponent.cc
  2. 2
      src/AutoPilotPlugins/PX4/AirframeComponent.h
  3. 4
      src/AutoPilotPlugins/PX4/FlightModesComponent.cc
  4. 2
      src/AutoPilotPlugins/PX4/FlightModesComponent.h
  5. 13
      src/AutoPilotPlugins/PX4/PX4AutoPilotPlugin.cc
  6. 4
      src/AutoPilotPlugins/PX4/PX4Component.cc
  7. 3
      src/AutoPilotPlugins/PX4/PX4Component.h
  8. 4
      src/AutoPilotPlugins/PX4/RadioComponent.cc
  9. 2
      src/AutoPilotPlugins/PX4/RadioComponent.h
  10. 4
      src/AutoPilotPlugins/PX4/SensorsComponent.cc
  11. 2
      src/AutoPilotPlugins/PX4/SensorsComponent.h
  12. 9
      src/VehicleSetup/VehicleComponent.cc
  13. 15
      src/VehicleSetup/VehicleComponent.h

4
src/AutoPilotPlugins/PX4/AirframeComponent.cc

@ -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]);
AirframeComponent::AirframeComponent(UASInterface* uas, QObject* parent) :
PX4Component(uas, parent),
AirframeComponent::AirframeComponent(UASInterface* uas, AutoPilotPlugin* autopilot, QObject* parent) :
PX4Component(uas, autopilot, parent),
_name(tr("Airframe"))
{
// Validate that our mavTypeInfo array hasn't gotten out of sync

2
src/AutoPilotPlugins/PX4/AirframeComponent.h

@ -35,7 +35,7 @@ class AirframeComponent : public PX4Component @@ -35,7 +35,7 @@ class AirframeComponent : public PX4Component
Q_OBJECT
public:
AirframeComponent(UASInterface* uas, QObject* parent = NULL);
AirframeComponent(UASInterface* uas, AutoPilotPlugin* autopilot, QObject* parent = NULL);
// Virtuals from PX4Component
virtual const char** setupCompleteChangedTriggerList(void) const;

4
src/AutoPilotPlugins/PX4/FlightModesComponent.cc

@ -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]);
FlightModesComponent::FlightModesComponent(UASInterface* uas, QObject* parent) :
PX4Component(uas, parent),
FlightModesComponent::FlightModesComponent(UASInterface* uas, AutoPilotPlugin* autopilot, QObject* parent) :
PX4Component(uas, autopilot, parent),
_name(tr("Flight Modes"))
{
}

2
src/AutoPilotPlugins/PX4/FlightModesComponent.h

@ -35,7 +35,7 @@ class FlightModesComponent : public PX4Component @@ -35,7 +35,7 @@ class FlightModesComponent : public PX4Component
Q_OBJECT
public:
FlightModesComponent(UASInterface* uas, QObject* parent = NULL);
FlightModesComponent(UASInterface* uas, AutoPilotPlugin* autopilot, QObject* parent = NULL);
// Virtuals from PX4Component
virtual const char** setupCompleteChangedTriggerList(void) const;

13
src/AutoPilotPlugins/PX4/PX4AutoPilotPlugin.cc

@ -26,6 +26,7 @@ @@ -26,6 +26,7 @@
#include "RadioComponent.h"
#include "SensorsComponent.h"
#include "FlightModesComponent.h"
#include "SafetyComponent.h"
#include "AutoPilotPluginManager.h"
#include "UASManager.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);
component = new AirframeComponent(_uas);
component = new AirframeComponent(_uas, this);
Q_CHECK_PTR(component);
_components.append(QVariant::fromValue(component));
component = new RadioComponent(_uas);
component = new RadioComponent(_uas, this);
Q_CHECK_PTR(component);
_components.append(QVariant::fromValue(component));
component = new FlightModesComponent(_uas);
component = new FlightModesComponent(_uas, this);
Q_CHECK_PTR(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);
_components.append(QVariant::fromValue(component));
}

4
src/AutoPilotPlugins/PX4/PX4Component.cc

@ -26,8 +26,8 @@ @@ -26,8 +26,8 @@
#include "PX4Component.h"
PX4Component::PX4Component(UASInterface* uas, QObject* parent) :
VehicleComponent(uas, parent)
PX4Component::PX4Component(UASInterface* uas, AutoPilotPlugin* autopilot, QObject* parent) :
VehicleComponent(uas, autopilot, parent)
{
bool fSuccess = connect(_paramMgr, SIGNAL(parameterUpdated(int, QString, QVariant)), this, SLOT(_parameterUpdated(int, QString, QVariant)));
Q_ASSERT(fSuccess);

3
src/AutoPilotPlugins/PX4/PX4Component.h

@ -35,7 +35,7 @@ class PX4Component : public VehicleComponent @@ -35,7 +35,7 @@ class PX4Component : public VehicleComponent
Q_OBJECT
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
/// 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
/// setupCompleteChanged at appropriate times.
void _parameterUpdated(int compId, QString paramName, QVariant value);
};
#endif

4
src/AutoPilotPlugins/PX4/RadioComponent.cc

@ -31,8 +31,8 @@ @@ -31,8 +31,8 @@
/// @brief Parameters which signal a change in setupComplete state
static const char* triggerParams[] = { "RC_MAP_MODE_SW", NULL };
RadioComponent::RadioComponent(UASInterface* uas, QObject* parent) :
PX4Component(uas, parent),
RadioComponent::RadioComponent(UASInterface* uas, AutoPilotPlugin* autopilot, QObject* parent) :
PX4Component(uas, autopilot, parent),
_name(tr("Radio"))
{
}

2
src/AutoPilotPlugins/PX4/RadioComponent.h

@ -36,7 +36,7 @@ class RadioComponent : public PX4Component @@ -36,7 +36,7 @@ class RadioComponent : public PX4Component
Q_OBJECT
public:
RadioComponent(UASInterface* uas, QObject* parent = NULL);
RadioComponent(UASInterface* uas, AutoPilotPlugin* autopilot, QObject* parent = NULL);
// Virtuals from PX4Component
virtual const char** setupCompleteChangedTriggerList(void) const;

4
src/AutoPilotPlugins/PX4/SensorsComponent.cc

@ -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
static const char* triggerSensors[] = { "Compass", "Gyro", "Acceleromter", "Airspeed", NULL };
SensorsComponent::SensorsComponent(UASInterface* uas, QObject* parent) :
PX4Component(uas, parent),
SensorsComponent::SensorsComponent(UASInterface* uas, AutoPilotPlugin* autopilot, QObject* parent) :
PX4Component(uas, autopilot, parent),
_name(tr("Sensors"))
{
}

2
src/AutoPilotPlugins/PX4/SensorsComponent.h

@ -35,7 +35,7 @@ class SensorsComponent : public PX4Component @@ -35,7 +35,7 @@ class SensorsComponent : public PX4Component
Q_OBJECT
public:
SensorsComponent(UASInterface* uas, QObject* parent = NULL);
SensorsComponent(UASInterface* uas, AutoPilotPlugin* autopilot, QObject* parent = NULL);
// Virtuals from PX4Component
virtual const char** setupCompleteChangedTriggerList(void) const;

9
src/VehicleSetup/VehicleComponent.cc

@ -25,13 +25,18 @@ @@ -25,13 +25,18 @@
/// @author Don Gagne <don@thegagnes.com>
#include "VehicleComponent.h"
#include "AutoPilotPlugin.h"
VehicleComponent::VehicleComponent(UASInterface* uas, QObject* parent) :
VehicleComponent::VehicleComponent(UASInterface* uas, AutoPilotPlugin* autopilot, QObject* parent) :
QObject(parent),
_uas(uas),
_paramMgr(_uas->getParamManager())
_autopilot(autopilot)
{
Q_ASSERT(uas);
Q_ASSERT(autopilot);
_paramMgr = _uas->getParamManager();
Q_ASSERT(_paramMgr);
}
VehicleComponent::~VehicleComponent()

15
src/VehicleSetup/VehicleComponent.h

@ -21,6 +21,9 @@ @@ -21,6 +21,9 @@
======================================================================*/
/// @file
/// @author Don Gagne <don@thegagnes.com>
#ifndef VEHICLECOMPONENT_H
#define VEHICLECOMPONENT_H
@ -30,11 +33,10 @@ @@ -30,11 +33,10 @@
#include "UASInterface.h"
/// @file
/// @brief Vehicle Component class. A vehicle component is an object which
/// abstracts the physical portion of a vehicle into a set of
/// configurable values and user interface.
/// @author Don Gagne <don@thegagnes.com>
class AutoPilotPlugin;
/// A vehicle component is an object which abstracts the physical portion of a vehicle into a set of
/// configurable values and user interface.
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);
public:
VehicleComponent(UASInterface* uas, QObject* parent = NULL);
VehicleComponent(UASInterface* uas, AutoPilotPlugin* autopilot, QObject* parent = NULL);
~VehicleComponent();
virtual QString name(void) const = 0;
@ -70,6 +72,7 @@ signals: @@ -70,6 +72,7 @@ signals:
protected:
UASInterface* _uas;
AutoPilotPlugin* _autopilot;
QGCUASParamManagerInterface* _paramMgr;
};

Loading…
Cancel
Save