Commit a4e6fd28 authored by Don Gagne's avatar Don Gagne

Merge pull request #2434 from DonLakeFlyer/APMFrame

Show APM Airframe config at appropriate times
parents 58b9c3f6 c44f6cb3
......@@ -36,10 +36,9 @@
<file alias="VehicleSummaryIcon.png">src/VehicleSetup/VehicleSummaryIcon.png</file>
<file alias="VehicleTailDown.png">src/AutoPilotPlugins/PX4/Images/VehicleTailDown.png</file>
<file alias="VehicleUpsideDown.png">src/AutoPilotPlugins/PX4/Images/VehicleUpsideDown.png</file>
<file alias="attitudeDial.svg">src/FlightMap/Images/attitudeDial.svg</file>
<file alias="attitudeInstrument.svg">src/FlightMap/Images/attitudeInstrument.svg</file>
<file alias="attitudePointer.svg">src//FlightMap/Images/attitudePointer.svg</file>
<file alias="attitudePointer.svg">src/FlightMap/Images/attitudePointer.svg</file>
<file alias="buttonHome.svg">src/FlightMap/Images/buttonHome.svg</file>
<file alias="buttonMore.svg">src/FlightMap/Images/buttonMore.svg</file>
<file alias="compassInstrumentAirplane.svg">src/FlightMap/Images/compassInstrumentAirplane.svg</file>
......@@ -54,8 +53,6 @@
<file alias="airplaneOpaque.svg">src/FlightMap/Images/airplaneOpaque.svg</file>
<file alias="ZoomPlus.svg">src/FlightMap/Images/ZoomPlus.svg</file>
<file alias="ZoomMinus.svg">src/FlightMap/Images/ZoomMinus.svg</file>
<!-- Map Buttons -->
<file alias="ArrowHead.svg">src/FlightMap/Images/ArrowHead.svg</file>
<file alias="Help.svg">src/FlightMap/Images/Help.svg</file>
<file alias="HelpBlack.svg">src/FlightMap/Images/HelpBlack.svg</file>
......@@ -72,8 +69,6 @@
<file alias="MapTypeBlack.svg">src/FlightMap/Images/MapTypeBlack.svg</file>
<file alias="TrashDelete.svg">src/FlightMap/Images/TrashDelete.svg</file>
<file alias="TrashDeleteBlack.svg">src/FlightMap/Images/TrashDeleteBlack.svg</file>
<!-- Toolbar -->
<file alias="Armed.svg">src/ui/toolbar/Images/Armed.svg</file>
<file alias="Battery.svg">src/ui/toolbar/Images/Battery.svg</file>
<file alias="Connect.svg">src/ui/toolbar/Images/Connect.svg</file>
......@@ -95,11 +90,8 @@
<file alias="Signal100.svg">src/ui/toolbar/Images/Signal100.svg</file>
<file alias="TelemRSSI.svg">src/ui/toolbar/Images/TelemRSSI.svg</file>
<file alias="Yield.svg">src/ui/toolbar/Images/Yield.svg</file>
<file alias="CogWheel.svg">src/MissionManager/CogWheel.svg</file>
</qresource>
<qresource prefix="/res">
<file alias="AntennaRC">resources/Antenna_RC.svg</file>
<file alias="AntennaT">resources/Antenna_T.svg</file>
......@@ -117,13 +109,11 @@
<file alias="XDelete.svg">resources/XDelete.svg</file>
<file alias="XDeleteBlack.svg">resources/XDeleteBlack.svg</file>
</qresource>
<qresource prefix="/res/firmware">
<file alias="px4.png">resources/firmware/px4.png</file>
<file alias="apm.png">resources/firmware/apm.png</file>
<file alias="3drradio.png">resources/firmware/3drradio.png</file>
</qresource>
<qresource prefix="/res/mavs">
<file alias="Helicopter">resources/mavs/helicopter.svg</file>
<file alias="Unknown">resources/mavs/unknown.svg</file>
......@@ -145,7 +135,6 @@
<file alias="SurfaceBoat">resources/mavs/surface-boat.svg</file>
<file alias="TriCopter">resources/mavs/tricopter.svg</file>
</qresource>
<qresource prefix="/res/calibration">
<file alias="accel_back.png">resources/calibration/accel_back.png</file>
<file alias="accel_front.png">resources/calibration/accel_front.png</file>
......@@ -154,7 +143,6 @@
<file alias="accel_up.png">resources/calibration/accel_up.png</file>
<file alias="accel_left.png">resources/calibration/accel_left.png</file>
</qresource>
<qresource prefix="/qml/calibration/mode1">
<file alias="radioCenter.png">resources/calibration/mode1/radioCenter.png</file>
<file alias="radioHome.png">resources/calibration/mode1/radioHome.png</file>
......@@ -168,7 +156,6 @@
<file alias="radioThrottleDown.png">resources/calibration/mode1/radioThrottleDown.png</file>
<file alias="radioSwitchMinMax.png">resources/calibration/mode1/radioSwitchMinMax.png</file>
</qresource>
<qresource prefix="/qml/calibration/mode2">
<file alias="radioCenter.png">resources/calibration/mode2/radioCenter.png</file>
<file alias="radioHome.png">resources/calibration/mode2/radioHome.png</file>
......@@ -182,7 +169,6 @@
<file alias="radioThrottleDown.png">resources/calibration/mode2/radioThrottleDown.png</file>
<file alias="radioSwitchMinMax.png">resources/calibration/mode2/radioSwitchMinMax.png</file>
</qresource>
<qresource prefix="/qml/calibration/joystick">
<file alias="joystickCenter.png">resources/calibration/joystick/joystickCenter.png</file>
<file alias="joystickRollLeft.png">resources/calibration/joystick/joystickRollLeft.png</file>
......@@ -194,24 +180,20 @@
<file alias="joystickThrottleUp.png">resources/calibration/joystick/joystickThrottleUp.png</file>
<file alias="joystickThrottleDown.png">resources/calibration/joystick/joystickThrottleDown.png</file>
</qresource>
<qresource prefix="/res/styles">
<file alias="style-dark.css">resources/styles/style-dark.css</file>
<file alias="style-light.css">resources/styles/style-light.css</file>
</qresource>
<qresource prefix="/res/audio">
<file alias="Alert">resources/audio/alert.wav</file>
</qresource>
<qresource prefix="/AutoPilotPlugins/PX4">
<file alias="AirframeFactMetaData.xml">src/AutoPilotPlugins/PX4/AirframeFactMetaData.xml</file>
<file alias="ParameterFactMetaData.xml">src/AutoPilotPlugins/PX4/ParameterFactMetaData.xml</file>
</qresource>
<qresource prefix="/AutoPilotPlugins/APM">
<file alias="AirframeFactMetaData.xml">src/AutoPilotPlugins/APM/AirframeFactMetaData.xml</file>
<file alias="APMAirframeFactMetaData.xml">src/AutoPilotPlugins/APM/APMAirframeFactMetaData.xml</file>
</qresource>
<qresource prefix="/FirmwarePlugin/APM">
<file alias="apm.pdef.xml">src/FirmwarePlugin/APM/apm.pdef.xml</file>
</qresource>
......
......@@ -29,10 +29,16 @@
APMAirframeComponent::APMAirframeComponent(Vehicle* vehicle, AutoPilotPlugin* autopilot, QObject* parent)
: APMComponent(vehicle, autopilot, parent)
, _copterFirmware(false)
, _requiresFrameSetup(false)
, _name("Airframe")
{
_copterFirmware = qobject_cast<ArduCopterFirmwarePlugin*>(_vehicle->firmwarePlugin()) != NULL;
if (qobject_cast<ArduCopterFirmwarePlugin*>(_vehicle->firmwarePlugin()) != NULL) {
_requiresFrameSetup = true;
MAV_TYPE vehicleType = vehicle->vehicleType();
if (vehicleType == MAV_TYPE_TRICOPTER || vehicleType == MAV_TYPE_HELICOPTER) {
_requiresFrameSetup = false;
}
}
}
QString APMAirframeComponent::name(void) const
......@@ -53,12 +59,12 @@ QString APMAirframeComponent::iconResource(void) const
bool APMAirframeComponent::requiresSetup(void) const
{
return _copterFirmware;
return _requiresFrameSetup;
}
bool APMAirframeComponent::setupComplete(void) const
{
if (_copterFirmware) {
if (_requiresFrameSetup) {
return _autopilot->getParameterFact(FactSystem::defaultComponentId, "FRAME")->rawValue().toInt() >= 0;
} else {
return true;
......@@ -69,7 +75,7 @@ QStringList APMAirframeComponent::setupCompleteChangedTriggerList(void) const
{
QStringList list;
if (_copterFirmware) {
if (_requiresFrameSetup) {
list << "FRAME";
}
......@@ -78,7 +84,7 @@ QStringList APMAirframeComponent::setupCompleteChangedTriggerList(void) const
QUrl APMAirframeComponent::setupSource(void) const
{
if (_copterFirmware) {
if (_requiresFrameSetup) {
return QUrl::fromUserInput("qrc:/qml/APMAirframeComponent.qml");
} else {
return QUrl();
......@@ -87,7 +93,7 @@ QUrl APMAirframeComponent::setupSource(void) const
QUrl APMAirframeComponent::summaryQmlSource(void) const
{
if (_copterFirmware) {
if (_requiresFrameSetup) {
return QUrl::fromUserInput("qrc:/qml/APMAirframeComponentSummary.qml");
} else {
return QUrl();
......
......@@ -47,7 +47,7 @@ public:
virtual QString prerequisiteSetup(void) const;
private:
bool _copterFirmware;
bool _requiresFrameSetup; ///< true: FRAME parameter must be set
const QString _name;
};
......
......@@ -40,7 +40,7 @@ void APMAirframeComponentAirframes::insert(const QString& group, int groupId, co
g = new AirframeType_t;
g->name = group;
g->type = groupId;
g->imageResource = QString("qrc:/qmlimages/") + (!image.isEmpty() ? image : QString("AirframeStandardPlane.png"));
g->imageResource = image.isEmpty() ? "" : QString("qrc:/qmlimages/") + image;
rgAirframeTypes.insert(group, g);
} else {
g = rgAirframeTypes.value(group);
......
<?xml version='1.0' encoding='UTF-8'?>
<airframes>
<version>1</version>
<airframe_group image="AirframeQuadRotorPlus.png" name="Plus Style" id="0">
<airframe_group image="AirframeQuadRotorPlus.png" name="Plus Frame" id="0">
<airframe name="3DR Aero M" file="3DR_AERO_M.param"/>
<airframe name="3DR Aero RTF" file="3DR_Aero_RTF.param"/>
<airframe name="3DR Rover" file="3DR_Rover.param"/>
......@@ -9,22 +9,26 @@
<airframe name="Parrot Bebop" file="Parrot_Bebop.param"/>
<airframe name="Storm32" file="SToRM32-MAVLink.param"/>
</airframe_group>
<airframe_group image="AirframeQuadRotorX.png" name="X Style" id="1">
<airframe_group image="AirframeQuadRotorX.png" name="X Frame, Y6A Frame" id="1">
<airframe name="3DR X8-M RTF" file="3DR_X8-M_RTF.param"/>
<airframe name="3DR Y6A" file="3DR_Y6A_RTF.param"/>
<airframe name="3DR X8+ RTF" file="3DR_X8+_RTF.param"/>
<airframe name="3DR QUAD X4 RTF" file="3DR_QUAD_X4_RTF.param"/>
<airframe name="3DR X8" file="3DR_X8_RTF.param"/>
</airframe_group>
<airframe_group image="AirframeSimulation.png" name="V Style" id="2">
<airframe_group image="AirframeQuadRotorH.png" name="V Frame (3DR Iris)" id="2">
<airframe name="Iris with GoPro" file="Iris with Front Mount Go Pro.param"/>
<airframe name="Iris with Tarot" file="Iris with Tarot Gimbal.param"/>
<airframe name="3DR Iris+" file="3DR_Iris+.param"/>
<airframe name="Iris" file="Iris.param"/>
</airframe_group>
<airframe_group image="AirframeQuadRotorH.png" name="H Style" id="3">
<airframe_group image="AirframeQuadRotorH.png" name="V Tail Frame" id="4">
</airframe_group>
<airframe_group image="AirframeHexaRotorX.png" name="Y6B" id="10">
<airframe_group image="AirframeQuadRotorH.png" name="A Tail Frame" id="5">
</airframe_group>
<airframe_group name="H Frame" id="3">
</airframe_group>
<airframe_group name="Y6B Frame (3DR TriCopter)" id="10">
<airframe name="3DR Y6B" file="3DR_Y6B_RTF.param"/>
</airframe_group>
<airframes>
......@@ -57,7 +57,7 @@ void APMAirframeLoader::loadAirframeFactMetaData(void)
Q_ASSERT(APMAirframeComponentAirframes::get().count() == 0);
QString airframeFilename = ":/AutoPilotPlugins/APM/AirframeFactMetaData.xml";
QString airframeFilename = ":/AutoPilotPlugins/APM/APMAirframeFactMetaData.xml";
qCDebug(APMAirframeLoaderLog) << "Loading meta data file:" << airframeFilename;
......
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