Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Q
qgroundcontrol
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Valentin Platzgummer
qgroundcontrol
Commits
cf97c4a0
Commit
cf97c4a0
authored
Jan 12, 2017
by
Don Gagne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ArduPilot support for new FRAME_CLASS, FRAME_TYPE
parent
63aecd5d
Changes
9
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
6867 additions
and
24 deletions
+6867
-24
APMAirframeComponent.cc
src/AutoPilotPlugins/APM/APMAirframeComponent.cc
+20
-5
APMAirframeComponent.h
src/AutoPilotPlugins/APM/APMAirframeComponent.h
+5
-0
APMAirframeComponent.qml
src/AutoPilotPlugins/APM/APMAirframeComponent.qml
+40
-5
APMAirframeComponentController.cc
src/AutoPilotPlugins/APM/APMAirframeComponentController.cc
+11
-4
APMAirframeComponentController.h
src/AutoPilotPlugins/APM/APMAirframeComponentController.h
+4
-1
APMAirframeComponentSummary.qml
src/AutoPilotPlugins/APM/APMAirframeComponentSummary.qml
+21
-8
APMFirmwarePlugin.cc
src/FirmwarePlugin/APM/APMFirmwarePlugin.cc
+3
-1
APMParameterFactMetaData.Copter.3.5.xml
...irmwarePlugin/APM/APMParameterFactMetaData.Copter.3.5.xml
+6762
-0
APMResources.qrc
src/FirmwarePlugin/APM/APMResources.qrc
+1
-0
No files found.
src/AutoPilotPlugins/APM/APMAirframeComponent.cc
View file @
cf97c4a0
...
...
@@ -11,16 +11,27 @@
#include "ArduCopterFirmwarePlugin.h"
#include "ParameterManager.h"
const
char
*
APMAirframeComponent
::
_oldFrameParam
=
"FRAME"
;
const
char
*
APMAirframeComponent
::
_newFrameParam
=
"FRAME_CLASS"
;
APMAirframeComponent
::
APMAirframeComponent
(
Vehicle
*
vehicle
,
AutoPilotPlugin
*
autopilot
,
QObject
*
parent
)
:
VehicleComponent
(
vehicle
,
autopilot
,
parent
)
,
_requiresFrameSetup
(
false
)
,
_name
(
"Airframe"
)
{
if
(
qobject_cast
<
ArduCopterFirmwarePlugin
*>
(
_vehicle
->
firmwarePlugin
())
!=
NULL
)
{
ParameterManager
*
paramMgr
=
_vehicle
->
parameterManager
();
_requiresFrameSetup
=
true
;
MAV_TYPE
vehicleType
=
vehicle
->
vehicleType
();
if
(
vehicleType
==
MAV_TYPE_TRICOPTER
||
vehicleType
==
MAV_TYPE_HELICOPTER
)
{
_requiresFrameSetup
=
false
;
if
(
paramMgr
->
parameterExists
(
FactSystem
::
defaultComponentId
,
_oldFrameParam
))
{
_useNewFrameParam
=
false
;
_frameParamFact
=
paramMgr
->
getParameter
(
FactSystem
::
defaultComponentId
,
_oldFrameParam
);
MAV_TYPE
vehicleType
=
vehicle
->
vehicleType
();
if
(
vehicleType
==
MAV_TYPE_TRICOPTER
||
vehicleType
==
MAV_TYPE_HELICOPTER
)
{
_requiresFrameSetup
=
false
;
}
}
else
{
_useNewFrameParam
=
true
;
_frameParamFact
=
paramMgr
->
getParameter
(
FactSystem
::
defaultComponentId
,
_newFrameParam
);
}
}
}
...
...
@@ -49,7 +60,11 @@ bool APMAirframeComponent::requiresSetup(void) const
bool
APMAirframeComponent
::
setupComplete
(
void
)
const
{
if
(
_requiresFrameSetup
)
{
return
_vehicle
->
parameterManager
()
->
getParameter
(
FactSystem
::
defaultComponentId
,
QStringLiteral
(
"FRAME"
))
->
rawValue
().
toInt
()
>=
0
;
if
(
_useNewFrameParam
)
{
return
_frameParamFact
->
rawValue
().
toInt
()
>
0
;
}
else
{
return
_frameParamFact
->
rawValue
().
toInt
()
>=
0
;
}
}
else
{
return
true
;
}
...
...
@@ -60,7 +75,7 @@ QStringList APMAirframeComponent::setupCompleteChangedTriggerList(void) const
QStringList
list
;
if
(
_requiresFrameSetup
)
{
list
<<
QStringLiteral
(
"FRAME"
);
list
<<
(
_useNewFrameParam
?
_newFrameParam
:
_oldFrameParam
);
}
return
list
;
...
...
src/AutoPilotPlugins/APM/APMAirframeComponent.h
View file @
cf97c4a0
...
...
@@ -36,6 +36,11 @@ public:
private:
bool
_requiresFrameSetup
;
///< true: FRAME parameter must be set
const
QString
_name
;
Fact
*
_frameParamFact
;
bool
_useNewFrameParam
;
static
const
char
*
_oldFrameParam
;
static
const
char
*
_newFrameParam
;
};
#endif
src/AutoPilotPlugins/APM/APMAirframeComponent.qml
View file @
cf97c4a0
...
...
@@ -14,6 +14,7 @@ import QtQuick.Dialogs 1.2
import
QtQuick
.
Layouts
1.2
import
QGroundControl
.
FactSystem
1.0
import
QGroundControl
.
FactControls
1.0
import
QGroundControl
.
Palette
1.0
import
QGroundControl
.
Controls
1.0
import
QGroundControl
.
Controllers
1.0
...
...
@@ -21,10 +22,13 @@ import QGroundControl.ScreenTools 1.0
SetupPage
{
id
:
airframePage
pageComponent
:
airf
ramePageComponent
pageComponent
:
_useOldFrameParam
?
oldFramePageComponent
:
newF
ramePageComponent
property
real
_margins
:
ScreenTools
.
defaultFontPixelWidth
property
Fact
_frame
:
controller
.
getParameterFact
(
-
1
,
"
FRAME
"
)
property
real
_margins
:
ScreenTools
.
defaultFontPixelWidth
property
bool
_useOldFrameParam
:
controller
.
parameterExists
(
-
1
,
"
FRAME
"
)
property
Fact
_oldFrameParam
:
controller
.
getParameterFact
(
-
1
,
"
FRAME
"
,
false
)
property
Fact
_newFrameParam
:
controller
.
getParameterFact
(
-
1
,
"
FRAME_CLASS
"
,
false
)
property
Fact
_frameTypeParam
:
controller
.
getParameterFact
(
-
1
,
"
FRAME_TYPE
"
,
false
)
APMAirframeComponentController
{
id
:
controller
...
...
@@ -88,7 +92,7 @@ SetupPage {
}
Component
{
id
:
airf
ramePageComponent
id
:
oldF
ramePageComponent
Column
{
width
:
availableWidth
...
...
@@ -129,5 +133,36 @@ SetupPage {
}
}
}
// Column
}
// Component - pageComponent
}
// Component - oldFramePageComponent
Component
{
id
:
newFramePageComponent
Grid
{
anchors.left
:
parent
.
left
anchors.right
:
parent
.
right
spacing
:
_margins
columns
:
2
QGCLabel
{
text
:
qsTr
(
"
Frame Class:
"
)
}
FactComboBox
{
fact
:
_newFrameParam
indexModel
:
false
width
:
ScreenTools
.
defaultFontPixelWidth
*
15
}
QGCLabel
{
text
:
qsTr
(
"
Frame Type:
"
)
}
FactComboBox
{
fact
:
_frameTypeParam
indexModel
:
false
width
:
ScreenTools
.
defaultFontPixelWidth
*
15
}
}
}
}
// SetupPage
src/AutoPilotPlugins/APM/APMAirframeComponentController.cc
View file @
cf97c4a0
...
...
@@ -28,18 +28,25 @@
bool
APMAirframeComponentController
::
_typesRegistered
=
false
;
const
char
*
APMAirframeComponentController
::
_oldFrameParam
=
"FRAME"
;
const
char
*
APMAirframeComponentController
::
_newFrameParam
=
"FRAME_CLASS"
;
APMAirframeComponentController
::
APMAirframeComponentController
(
void
)
:
_airframeTypesModel
(
new
QmlObjectListModel
(
this
))
{
if
(
!
_typesRegistered
)
{
_typesRegistered
=
true
;
qmlRegisterUncreatableType
<
APMAirframeType
>
(
"QGroundControl.Controllers"
,
1
,
0
,
"APMAiframeType"
,
QStringLiteral
(
"Can only reference APMAirframeType"
));
qmlRegisterUncreatableType
<
APMAirframe
>
(
"QGroundControl.Controllers"
,
1
,
0
,
"APMAiframe"
,
QStringLiteral
(
"Can only reference APMAirframe"
));
qmlRegisterUncreatableType
<
APMAirframeType
>
(
"QGroundControl.Controllers"
,
1
,
0
,
"APMAirframeType"
,
QStringLiteral
(
"Can only reference APMAirframeType"
));
}
_fillAirFrames
();
Fact
*
frame
=
getParameterFact
(
FactSystem
::
defaultComponentId
,
QStringLiteral
(
"FRAME"
));
connect
(
frame
,
&
Fact
::
vehicleUpdated
,
this
,
&
APMAirframeComponentController
::
_factFrameChanged
);
Fact
*
frame
;
if
(
parameterExists
(
FactSystem
::
defaultComponentId
,
_oldFrameParam
))
{
frame
=
getParameterFact
(
FactSystem
::
defaultComponentId
,
_oldFrameParam
);
}
else
{
frame
=
getParameterFact
(
FactSystem
::
defaultComponentId
,
_newFrameParam
);
}
connect
(
frame
,
&
Fact
::
rawValueChanged
,
this
,
&
APMAirframeComponentController
::
_factFrameChanged
);
_factFrameChanged
(
frame
->
rawValue
());
}
...
...
src/AutoPilotPlugins/APM/APMAirframeComponentController.h
View file @
cf97c4a0
...
...
@@ -71,9 +71,12 @@ private slots:
private:
void
_loadParametersFromDownloadFile
(
const
QString
&
downloadedParamFile
);
static
bool
_typesRegistered
;
APMAirframeType
*
_currentAirframeType
;
QmlObjectListModel
*
_airframeTypesModel
;
static
bool
_typesRegistered
;
static
const
char
*
_oldFrameParam
;
static
const
char
*
_newFrameParam
;
};
class
APMAirframe
:
public
QObject
...
...
src/AutoPilotPlugins/APM/APMAirframeComponentSummary.qml
View file @
cf97c4a0
...
...
@@ -18,18 +18,31 @@ FactPanel {
factPanel
:
panel
}
property
Fact
sysIdFact
:
controller
.
getParameterFact
(
-
1
,
"
FRAME
"
)
property
bool
_useOldFrameParam
:
controller
.
parameterExists
(
-
1
,
"
FRAME
"
)
property
Fact
_oldFrameParam
:
controller
.
getParameterFact
(
-
1
,
"
FRAME
"
,
false
)
property
Fact
_newFrameParam
:
controller
.
getParameterFact
(
-
1
,
"
FRAME_CLASS
"
,
false
)
property
Fact
_frameTypeParam
:
controller
.
getParameterFact
(
-
1
,
"
FRAME_TYPE
"
,
false
)
Column
{
anchors.fill
:
parent
VehicleSummaryRow
{
labelText
:
qsTr
(
"
Frame Type:
"
)
valueText
:
controller
.
currentAirframeTypeName
()
+
"
"
+
_oldFrameParam
.
enumStringValue
visible
:
_useOldFrameParam
}
VehicleSummaryRow
{
labelText
:
qsTr
(
"
Frame Class:
"
)
valueText
:
_newFrameParam
.
enumStringValue
visible
:
!
_useOldFrameParam
}
VehicleSummaryRow
{
id
:
nameRow
;
labelText
:
qsTr
(
"
Frame Type:
"
)
valueText
:
controller
.
currentAirframeTypeName
()
+
"
"
+
(
sysIdFact
.
valueString
===
"
0
"
?
"
Plus
"
:
sysIdFact
.
valueString
===
"
1
"
?
"
X
"
:
sysIdFact
.
valueString
===
"
2
"
?
"
V
"
:
sysIdFact
.
valueString
==
"
3
"
?
"
H
"
:
/* Fact.value == 10 */
"
New Y6
"
);
labelText
:
qsTr
(
"
Frame Type:
"
)
valueText
:
_frameTypeParam
.
enumStringValue
visible
:
!
_useOldFrameParam
}
...
...
src/FirmwarePlugin/APM/APMFirmwarePlugin.cc
View file @
cf97c4a0
...
...
@@ -744,8 +744,10 @@ QString APMFirmwarePlugin::internalParameterMetaDataFile(Vehicle* vehicle)
case
MAV_TYPE_HELICOPTER
:
if
(
vehicle
->
firmwareMajorVersion
()
<
3
||
(
vehicle
->
firmwareMajorVersion
()
==
3
&&
vehicle
->
firmwareMinorVersion
()
<=
3
))
{
return
QStringLiteral
(
":/FirmwarePlugin/APM/APMParameterFactMetaData.Copter.3.3.xml"
);
}
else
{
}
else
if
(
vehicle
->
firmwareMajorVersion
()
==
3
&&
vehicle
->
firmwareMinorVersion
()
==
4
)
{
return
QStringLiteral
(
":/FirmwarePlugin/APM/APMParameterFactMetaData.Copter.3.4.xml"
);
}
else
{
return
QStringLiteral
(
":/FirmwarePlugin/APM/APMParameterFactMetaData.Copter.3.5.xml"
);
}
case
MAV_TYPE_FIXED_WING
:
if
(
vehicle
->
firmwareMajorVersion
()
<
3
||
(
vehicle
->
firmwareMajorVersion
()
==
3
&&
vehicle
->
firmwareMinorVersion
()
<=
3
))
{
...
...
src/FirmwarePlugin/APM/APMParameterFactMetaData.Copter.3.5.xml
0 → 100644
View file @
cf97c4a0
This diff is collapsed.
Click to expand it.
src/FirmwarePlugin/APM/APMResources.qrc
View file @
cf97c4a0
...
...
@@ -45,6 +45,7 @@
<file alias="APMParameterFactMetaData.Plane.3.7.xml">APMParameterFactMetaData.Plane.3.7.xml</file>
<file alias="APMParameterFactMetaData.Copter.3.3.xml">APMParameterFactMetaData.Copter.3.3.xml</file>
<file alias="APMParameterFactMetaData.Copter.3.4.xml">APMParameterFactMetaData.Copter.3.4.xml</file>
<file alias="APMParameterFactMetaData.Copter.3.5.xml">APMParameterFactMetaData.Copter.3.5.xml</file>
<file alias="APMParameterFactMetaData.Rover.3.0.xml">APMParameterFactMetaData.Rover.3.0.xml</file>
<file alias="APMParameterFactMetaData.Sub.3.4.xml">APMParameterFactMetaData.Sub.3.4.xml</file>
<file alias="CopterGeoFenceEditor.qml">CopterGeoFenceEditor.qml</file>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment