Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PX4 Actuator & Geometry Configuration and Testing UI #9952

Merged
merged 6 commits into from Dec 14, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
20 changes: 20 additions & 0 deletions qgroundcontrol.pro
Expand Up @@ -688,7 +688,16 @@ HEADERS += \
src/SHPFileHelper.h \
src/Terrain/TerrainQuery.h \
src/TerrainTile.h \
src/Vehicle/Actuators/ActuatorActions.h \
src/Vehicle/Actuators/Actuators.h \
src/Vehicle/Actuators/ActuatorOutputs.h \
src/Vehicle/Actuators/ActuatorTesting.h \
src/Vehicle/Actuators/Common.h \
src/Vehicle/Actuators/GeometryImage.h \
src/Vehicle/Actuators/Mixer.h \
src/Vehicle/Actuators/MotorAssignment.h \
src/Vehicle/CompInfo.h \
src/Vehicle/CompInfoActuators.h \
src/Vehicle/CompInfoEvents.h \
src/Vehicle/CompInfoParam.h \
src/Vehicle/CompInfoGeneral.h \
Expand Down Expand Up @@ -929,7 +938,16 @@ SOURCES += \
src/SHPFileHelper.cc \
src/Terrain/TerrainQuery.cc \
src/TerrainTile.cc\
src/Vehicle/Actuators/ActuatorActions.cc \
src/Vehicle/Actuators/Actuators.cc \
src/Vehicle/Actuators/ActuatorOutputs.cc \
src/Vehicle/Actuators/ActuatorTesting.cc \
src/Vehicle/Actuators/Common.cc \
src/Vehicle/Actuators/GeometryImage.cc \
src/Vehicle/Actuators/Mixer.cc \
src/Vehicle/Actuators/MotorAssignment.cc \
src/Vehicle/CompInfo.cc \
src/Vehicle/CompInfoActuators.cc \
src/Vehicle/CompInfoEvents.cc \
src/Vehicle/CompInfoParam.cc \
src/Vehicle/CompInfoGeneral.cc \
Expand Down Expand Up @@ -1168,6 +1186,7 @@ PX4FirmwarePlugin {
src/FirmwarePlugin/PX4 \

HEADERS+= \
src/AutoPilotPlugins/PX4/ActuatorComponent.h \
src/AutoPilotPlugins/PX4/AirframeComponent.h \
src/AutoPilotPlugins/PX4/AirframeComponentAirframes.h \
src/AutoPilotPlugins/PX4/AirframeComponentController.h \
Expand All @@ -1189,6 +1208,7 @@ PX4FirmwarePlugin {
src/FirmwarePlugin/PX4/PX4ParameterMetaData.h \

SOURCES += \
src/AutoPilotPlugins/PX4/ActuatorComponent.cc \
src/AutoPilotPlugins/PX4/AirframeComponent.cc \
src/AutoPilotPlugins/PX4/AirframeComponentAirframes.cc \
src/AutoPilotPlugins/PX4/AirframeComponentController.cc \
Expand Down
3 changes: 3 additions & 0 deletions qgroundcontrol.qrc
Expand Up @@ -66,6 +66,9 @@
<file alias="MockLink.qml">src/ui/preferences/MockLink.qml</file>
<file alias="MockLinkSettings.qml">src/ui/preferences/MockLinkSettings.qml</file>
<file alias="MotorComponent.qml">src/AutoPilotPlugins/Common/MotorComponent.qml</file>
<file alias="ActuatorComponent.qml">src/AutoPilotPlugins/PX4/ActuatorComponent.qml</file>
<file alias="ActuatorFact.qml">src/AutoPilotPlugins/PX4/ActuatorFact.qml</file>
<file alias="ActuatorSlider.qml">src/AutoPilotPlugins/PX4/ActuatorSlider.qml</file>
<file alias="OfflineMap.qml">src/QtLocationPlugin/QMLControl/OfflineMap.qml</file>
<file alias="PlanToolBar.qml">src/PlanView/PlanToolBar.qml</file>
<file alias="PlanToolBarIndicators.qml">src/PlanView/PlanToolBarIndicators.qml</file>
Expand Down
2 changes: 2 additions & 0 deletions src/AutoPilotPlugins/CMakeLists.txt
Expand Up @@ -34,6 +34,8 @@ add_library(AutoPilotPlugins

Generic/GenericAutoPilotPlugin.cc

PX4/ActuatorComponent.cc
PX4/ActuatorComponent.h
PX4/AirframeComponentAirframes.cc
PX4/AirframeComponentAirframes.h
PX4/AirframeComponent.cc
Expand Down
66 changes: 66 additions & 0 deletions src/AutoPilotPlugins/PX4/ActuatorComponent.cc
@@ -0,0 +1,66 @@
/****************************************************************************
*
* (c) 2021 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 "ActuatorComponent.h"

#include "QGCApplication.h"

static bool imageProviderAdded{false};

ActuatorComponent::ActuatorComponent(Vehicle* vehicle, AutoPilotPlugin* autopilot, QObject* parent) :
VehicleComponent(vehicle, autopilot, parent),
_name(tr("Actuators")), _actuators(*vehicle->actuators())
{
if (!imageProviderAdded) {
qgcApp()->qmlAppEngine()->addImageProvider(QLatin1String("actuators"), GeometryImage::VehicleGeometryImageProvider::instance());
imageProviderAdded = true;
}

connect(&_actuators, &Actuators::hasUnsetRequiredFunctionsChanged, this, [this]() { _triggerUpdated({}); });
}

QString ActuatorComponent::name(void) const
{
return _name;
}

QString ActuatorComponent::description(void) const
{
return "";
}

QString ActuatorComponent::iconResource(void) const
{
return QStringLiteral("/qmlimages/MotorComponentIcon.svg");
}

bool ActuatorComponent::requiresSetup(void) const
{
return true;
}

bool ActuatorComponent::setupComplete(void) const
{
return !_actuators.hasUnsetRequiredFunctions();
}

QStringList ActuatorComponent::setupCompleteChangedTriggerList(void) const
{
return QStringList();
}

QUrl ActuatorComponent::setupSource(void) const
{
return QUrl::fromUserInput(QStringLiteral("qrc:/qml/ActuatorComponent.qml"));
}

QUrl ActuatorComponent::summaryQmlSource(void) const
{
return QUrl();
}
41 changes: 41 additions & 0 deletions src/AutoPilotPlugins/PX4/ActuatorComponent.h
@@ -0,0 +1,41 @@
/****************************************************************************
*
* (c) 2021 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.
*
****************************************************************************/


#pragma once

#include "VehicleComponent.h"
#include "Fact.h"

#include "Actuators/Actuators.h"

class ActuatorComponent : public VehicleComponent
{
Q_OBJECT

public:
ActuatorComponent(Vehicle* vehicle, AutoPilotPlugin* autopilot, QObject* parent = nullptr);

// Virtuals from VehicleComponent
QStringList setupCompleteChangedTriggerList(void) const final;

// Virtuals from VehicleComponent
QString name(void) const final;
QString description(void) const final;
QString iconResource(void) const final;
bool requiresSetup(void) const final;
bool setupComplete(void) const final;
virtual QUrl setupSource(void) const;
QUrl summaryQmlSource(void) const final;

private:
const QString _name;
Actuators& _actuators;
};