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
1d5a457a
Commit
1d5a457a
authored
Dec 24, 2014
by
Don Gagne
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1145 from DonLakeFlyer/SummaryQml
Summary buttons in Qml
parents
5bfa227a
b65b4d56
Changes
20
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
308 additions
and
307 deletions
+308
-307
qgroundcontrol.qrc
qgroundcontrol.qrc
+10
-0
AirframeComponent.cc
src/AutoPilotPlugins/PX4/AirframeComponent.cc
+6
-61
AirframeComponent.h
src/AutoPilotPlugins/PX4/AirframeComponent.h
+1
-1
AirframeComponentSummary.qml
src/AutoPilotPlugins/PX4/AirframeComponentSummary.qml
+32
-0
FlightModesComponent.cc
src/AutoPilotPlugins/PX4/FlightModesComponent.cc
+2
-39
FlightModesComponent.h
src/AutoPilotPlugins/PX4/FlightModesComponent.h
+1
-1
FlightModesComponentSummary.qml
src/AutoPilotPlugins/PX4/FlightModesComponentSummary.qml
+54
-0
RadioComponent.cc
src/AutoPilotPlugins/PX4/RadioComponent.cc
+2
-49
RadioComponent.h
src/AutoPilotPlugins/PX4/RadioComponent.h
+1
-1
RadioComponentSummary.qml
src/AutoPilotPlugins/PX4/RadioComponentSummary.qml
+65
-0
SafetyComponent.cc
src/AutoPilotPlugins/PX4/SafetyComponent.cc
+2
-32
SafetyComponent.h
src/AutoPilotPlugins/PX4/SafetyComponent.h
+1
-1
SafetyComponent.qml
src/AutoPilotPlugins/PX4/SafetyComponent.qml
+1
-1
SafetyComponentSummary.qml
src/AutoPilotPlugins/PX4/SafetyComponentSummary.qml
+65
-0
SensorsComponent.cc
src/AutoPilotPlugins/PX4/SensorsComponent.cc
+2
-106
SensorsComponent.h
src/AutoPilotPlugins/PX4/SensorsComponent.h
+1
-1
SensorsComponentSummary.qml
src/AutoPilotPlugins/PX4/SensorsComponentSummary.qml
+54
-0
SetupViewConnected.qml
src/VehicleSetup/SetupViewConnected.qml
+4
-10
SetupViewDisconnected.qml
src/VehicleSetup/SetupViewDisconnected.qml
+2
-2
VehicleComponent.h
src/VehicleSetup/VehicleComponent.h
+2
-2
No files found.
qgroundcontrol.qrc
View file @
1d5a457a
...
...
@@ -235,7 +235,9 @@
<qresource prefix="/QLoggingCategory">
<file alias="qtlogging.ini">files/QLoggingCategory/qtlogging.ini</file>
</qresource>
<qresource prefix="/qml">
<file alias="test.qml">src/test.qml</file>
<file alias="QGroundControl/FactControls/qmldir">qml/QGroundControl/FactControls/qmldir</file>
...
...
@@ -254,7 +256,15 @@
<file alias="SetupPane.qml">src/VehicleSetup/SetupPane.qml</file>
<file alias="SafetyComponent.qml">src/AutoPilotPlugins/PX4/SafetyComponent.qml</file>
<file alias="SafetyComponentSummary.qml">src/AutoPilotPlugins/PX4/SafetyComponentSummary.qml</file>
<file alias="SensorsComponentSummary.qml">src/AutoPilotPlugins/PX4/SensorsComponentSummary.qml</file>
<file alias="RadioComponentSummary.qml">src/AutoPilotPlugins/PX4/RadioComponentSummary.qml</file>
<file alias="FlightModesComponentSummary.qml">src/AutoPilotPlugins/PX4/FlightModesComponentSummary.qml</file>
<file alias="AirframeComponentSummary.qml">src/AutoPilotPlugins/PX4/AirframeComponentSummary.qml</file>
</qresource>
<qresource prefix="/AutoPilotPlugins/PX4">
<file alias="ParameterFactMetaData.xml">src/AutoPilotPlugins/PX4/ParameterFactMetaData.xml</file>
</qresource>
...
...
src/AutoPilotPlugins/PX4/AirframeComponent.cc
View file @
1d5a457a
...
...
@@ -66,6 +66,8 @@ AirframeComponent::AirframeComponent(UASInterface* uas, AutoPilotPlugin* autopil
PX4Component
(
uas
,
autopilot
,
parent
),
_name
(
tr
(
"Airframe"
))
{
Q_UNUSED
(
mavTypeInfo
);
// Keeping this around for later use
// Validate that our mavTypeInfo array hasn't gotten out of sync
Q_ASSERT
(
cMavTypes
==
MAV_TYPE_ENUM_END
);
...
...
@@ -93,8 +95,9 @@ AirframeComponent::AirframeComponent(UASInterface* uas, AutoPilotPlugin* autopil
MAV_TYPE_VTOL_DUOROTOR
,
MAV_TYPE_VTOL_QUADROTOR
};
Q_UNUSED
(
mavTypes
);
// Keeping this around for later use
for
(
size_t
i
=
0
;
i
<
sizeof
(
mavTypes
)
/
sizeof
(
mavTypes
[
0
])
;
i
++
)
{
for
(
size_t
i
=
0
;
i
<
cMavTypes
;
i
++
)
{
Q_ASSERT
(
mavTypeInfo
[
i
].
type
==
mavTypes
[
i
]);
}
}
...
...
@@ -162,65 +165,7 @@ QWidget* AirframeComponent::setupWidget(void) const
return
new
QGCPX4AirframeConfig
;
}
const
QVariantList
&
AirframeComponent
::
summaryItems
(
void
)
QUrl
AirframeComponent
::
summaryQmlSource
(
void
)
const
{
// Fill the items on first reference
// FIXME: These items are not live
if
(
!
_summaryItems
.
count
())
{
QString
name
;
QString
state
;
QVariant
value
;
name
=
"System ID:"
;
if
(
_paramMgr
->
getParameterValue
(
_paramMgr
->
getDefaultComponentId
(),
"MAV_SYS_ID"
,
value
))
{
if
(
value
.
toInt
()
==
0
)
{
state
=
"Setup required"
;
}
else
{
state
=
value
.
toString
();
}
}
else
{
// Why is the parameter missing?
Q_ASSERT
(
false
);
}
VehicleComponentSummaryItem
*
item
=
new
VehicleComponentSummaryItem
(
name
,
state
,
this
);
_summaryItems
.
append
(
QVariant
::
fromValue
(
item
));
name
=
"Airframe:"
;
if
(
_paramMgr
->
getParameterValue
(
_paramMgr
->
getDefaultComponentId
(),
"SYS_AUTOSTART"
,
value
))
{
if
(
value
.
toInt
()
==
0
)
{
state
=
"Setup required"
;
}
else
{
state
=
value
.
toString
();
}
}
else
{
// Why is the parameter missing?
Q_ASSERT
(
false
);
}
item
=
new
VehicleComponentSummaryItem
(
name
,
state
,
this
);
_summaryItems
.
append
(
QVariant
::
fromValue
(
item
));
name
=
"Type:"
;
if
(
_paramMgr
->
getParameterValue
(
_paramMgr
->
getDefaultComponentId
(),
"MAV_TYPE"
,
value
))
{
int
index
=
value
.
toInt
();
if
(
index
<
0
||
index
>=
(
int
)
cMavTypes
)
{
state
=
"Unknown"
;
}
else
{
state
=
mavTypeInfo
[
index
].
description
;
}
}
else
{
// Why is the parameter missing?
Q_ASSERT
(
false
);
state
=
"Unknown"
;
}
item
=
new
VehicleComponentSummaryItem
(
name
,
state
,
this
);
_summaryItems
.
append
(
QVariant
::
fromValue
(
item
));
}
return
_summaryItems
;
return
QUrl
::
fromUserInput
(
"qrc:/qml/AirframeComponentSummary.qml"
);
}
src/AutoPilotPlugins/PX4/AirframeComponent.h
View file @
1d5a457a
...
...
@@ -49,7 +49,7 @@ public:
virtual
QString
setupStateDescription
(
void
)
const
;
virtual
QWidget
*
setupWidget
(
void
)
const
;
virtual
QStringList
paramFilterList
(
void
)
const
;
virtual
const
QVariantList
&
summaryItems
(
void
)
;
virtual
QUrl
summaryQmlSource
(
void
)
const
;
private:
const
QString
_name
;
...
...
src/AutoPilotPlugins/PX4/AirframeComponentSummary.qml
0 → 100644
View file @
1d5a457a
import
QtQuick
2.2
import
QtQuick
.
Controls
1.2
import
QtQuick
.
Controls
.
Styles
1.2
import
QGroundControl
.
FactSystem
1.0
import
QGroundControl
.
FactControls
1.0
Column
{
anchors.fill
:
parent
anchors.margins
:
8
Row
{
width
:
parent
.
width
Text
{
id
:
systemId
;
text
:
"
System ID:
"
}
Text
{
horizontalAlignment
:
Text
.
AlignRight
width
:
parent
.
width
-
systemId
.
contentWidth
text
:
autopilot
.
parameters
[
"
MAV_SYS_ID
"
].
value
}
}
Row
{
width
:
parent
.
width
Text
{
id
:
airframe
;
text
:
"
Airframe:
"
}
Text
{
horizontalAlignment
:
Text
.
AlignRight
width
:
parent
.
width
-
airframe
.
contentWidth
text
:
autopilot
.
parameters
[
"
SYS_AUTOSTART
"
].
value
==
0
?
"
Setup required
"
:
autopilot
.
parameters
[
"
SYS_AUTOSTART
"
].
value
}
}
}
src/AutoPilotPlugins/PX4/FlightModesComponent.cc
View file @
1d5a457a
...
...
@@ -117,44 +117,7 @@ QWidget* FlightModesComponent::setupWidget(void) const
return
new
FlightModeConfig
();
}
const
QVariantList
&
FlightModesComponent
::
summaryItems
(
void
)
QUrl
FlightModesComponent
::
summaryQmlSource
(
void
)
const
{
if
(
!
_summaryItems
.
count
())
{
// Create summary items for each mode switch
for
(
size_t
i
=
0
;
i
<
cSwitchList
;
i
++
)
{
QString
name
;
QString
state
;
QVariant
value
;
name
=
switchList
[
i
].
name
;
if
(
_paramMgr
->
getParameterValue
(
_paramMgr
->
getDefaultComponentId
(),
switchList
[
i
].
param
,
value
))
{
int
chan
=
value
.
toInt
();
if
(
chan
==
0
)
{
// Switch is not mapped
if
(
i
==
0
)
{
// Mode switch is required
Q_ASSERT
(
strcmp
(
switchList
[
0
].
param
,
"RC_MAP_MODE_SW"
)
==
0
);
state
=
"Setup required"
;
}
else
{
state
=
"None"
;
}
}
else
{
state
=
tr
(
"Chan %1"
).
arg
(
chan
);
}
}
else
{
// Why is the parameter missing?
Q_ASSERT
(
false
);
state
=
"Unknown"
;
}
VehicleComponentSummaryItem
*
item
=
new
VehicleComponentSummaryItem
(
name
,
state
,
this
);
_summaryItems
.
append
(
QVariant
::
fromValue
(
item
));
}
}
return
_summaryItems
;
return
QUrl
::
fromUserInput
(
"qrc:/qml/FlightModesComponentSummary.qml"
);
}
src/AutoPilotPlugins/PX4/FlightModesComponent.h
View file @
1d5a457a
...
...
@@ -49,7 +49,7 @@ public:
virtual
QString
setupStateDescription
(
void
)
const
;
virtual
QWidget
*
setupWidget
(
void
)
const
;
virtual
QStringList
paramFilterList
(
void
)
const
;
virtual
const
QVariantList
&
summaryItems
(
void
)
;
virtual
QUrl
summaryQmlSource
(
void
)
const
;
private:
const
QString
_name
;
...
...
src/AutoPilotPlugins/PX4/FlightModesComponentSummary.qml
0 → 100644
View file @
1d5a457a
import
QtQuick
2.2
import
QtQuick
.
Controls
1.2
import
QtQuick
.
Controls
.
Styles
1.2
import
QGroundControl
.
FactSystem
1.0
import
QGroundControl
.
FactControls
1.0
Column
{
anchors.fill
:
parent
anchors.margins
:
8
Row
{
width
:
parent
.
width
Text
{
id
:
mode
;
text
:
"
Mode switch:
"
}
Text
{
horizontalAlignment
:
Text
.
AlignRight
width
:
parent
.
width
-
mode
.
contentWidth
text
:
autopilot
.
parameters
[
"
RC_MAP_MODE_SW
"
].
value
==
0
?
"
Setup required
"
:
autopilot
.
parameters
[
"
RC_MAP_MODE_SW
"
].
value
}
}
Row
{
width
:
parent
.
width
Text
{
id
:
posctl
;
text
:
"
Position Ctl switch:
"
}
Text
{
horizontalAlignment
:
Text
.
AlignRight
width
:
parent
.
width
-
posctl
.
contentWidth
text
:
autopilot
.
parameters
[
"
RC_MAP_POSCTL_SW
"
].
value
==
0
?
"
Not mapped
"
:
autopilot
.
parameters
[
"
RC_MAP_POSCTL_SW
"
].
value
}
}
Row
{
width
:
parent
.
width
Text
{
id
:
loiter
;
text
:
"
Loiter switch:
"
}
Text
{
horizontalAlignment
:
Text
.
AlignRight
width
:
parent
.
width
-
loiter
.
contentWidth
text
:
autopilot
.
parameters
[
"
RC_MAP_LOITER_SW
"
].
value
==
0
?
"
Not mapped
"
:
autopilot
.
parameters
[
"
RC_MAP_LOITER_SW
"
].
value
}
}
Row
{
width
:
parent
.
width
Text
{
id
:
rtl
;
text
:
"
Return switch:
"
}
Text
{
horizontalAlignment
:
Text
.
AlignRight
width
:
parent
.
width
-
rtl
.
contentWidth
text
:
autopilot
.
parameters
[
"
RC_MAP_RETURN_SW
"
].
value
==
0
?
"
Not mapped
"
:
autopilot
.
parameters
[
"
RC_MAP_RETURN_SW
"
].
value
}
}
}
src/AutoPilotPlugins/PX4/RadioComponent.cc
View file @
1d5a457a
...
...
@@ -101,54 +101,7 @@ QWidget* RadioComponent::setupWidget(void) const
return
new
PX4RCCalibration
;
}
const
QVariantList
&
RadioComponent
::
summaryItems
(
void
)
QUrl
RadioComponent
::
summaryQmlSource
(
void
)
const
{
if
(
!
_summaryItems
.
count
())
{
QString
name
;
QString
state
;
// FIXME: Need to pull receiver type from RSSI value
name
=
"Receiver type:"
;
state
=
"n/a"
;
VehicleComponentSummaryItem
*
item
=
new
VehicleComponentSummaryItem
(
name
,
state
,
this
);
_summaryItems
.
append
(
QVariant
::
fromValue
(
item
));
static
const
char
*
stickParams
[]
=
{
"RC_MAP_ROLL"
,
"RC_MAP_PITCH"
,
"RC_MAP_YAW"
,
"RC_MAP_THROTTLE"
};
QString
summary
(
"Chan "
);
bool
allSticksMapped
=
true
;
for
(
size_t
i
=
0
;
i
<
sizeof
(
stickParams
)
/
sizeof
(
stickParams
[
0
]);
i
++
)
{
QVariant
value
;
if
(
_paramMgr
->
getParameterValue
(
_paramMgr
->
getDefaultComponentId
(),
stickParams
[
i
],
value
))
{
if
(
value
.
toInt
()
==
0
)
{
allSticksMapped
=
false
;
break
;
}
else
{
if
(
i
!=
0
)
{
summary
+=
","
;
}
summary
+=
value
.
toString
();
}
}
else
{
// Why is the parameter missing?
Q_ASSERT
(
false
);
summary
+=
"?"
;
}
}
if
(
!
allSticksMapped
)
{
summary
=
"Not mapped"
;
}
name
=
"Ail, Ele, Rud, Throt:"
;
state
=
summary
;
item
=
new
VehicleComponentSummaryItem
(
name
,
state
,
this
);
_summaryItems
.
append
(
QVariant
::
fromValue
(
item
));
}
return
_summaryItems
;
return
QUrl
::
fromUserInput
(
"qrc:/qml/RadioComponentSummary.qml"
);
}
src/AutoPilotPlugins/PX4/RadioComponent.h
View file @
1d5a457a
...
...
@@ -50,7 +50,7 @@ public:
virtual
QString
setupStateDescription
(
void
)
const
;
virtual
QWidget
*
setupWidget
(
void
)
const
;
virtual
QStringList
paramFilterList
(
void
)
const
;
virtual
const
QVariantList
&
summaryItems
(
void
)
;
virtual
QUrl
summaryQmlSource
(
void
)
const
;
private:
const
QString
_name
;
...
...
src/AutoPilotPlugins/PX4/RadioComponentSummary.qml
0 → 100644
View file @
1d5a457a
import
QtQuick
2.2
import
QtQuick
.
Controls
1.2
import
QtQuick
.
Controls
.
Styles
1.2
import
QGroundControl
.
FactSystem
1.0
import
QGroundControl
.
FactControls
1.0
Column
{
anchors.fill
:
parent
anchors.margins
:
8
Row
{
width
:
parent
.
width
Text
{
id
:
roll
;
text
:
"
Roll:
"
}
Text
{
horizontalAlignment
:
Text
.
AlignRight
width
:
parent
.
width
-
roll
.
contentWidth
text
:
autopilot
.
parameters
[
"
RC_MAP_ROLL
"
].
value
==
0
?
"
Setup required
"
:
autopilot
.
parameters
[
"
RC_MAP_ROLL
"
].
value
}
}
Row
{
width
:
parent
.
width
Text
{
id
:
pitch
;
text
:
"
Pitch:
"
}
Text
{
horizontalAlignment
:
Text
.
AlignRight
width
:
parent
.
width
-
pitch
.
contentWidth
text
:
autopilot
.
parameters
[
"
RC_MAP_PITCH
"
].
value
==
0
?
"
Setup required
"
:
autopilot
.
parameters
[
"
RC_MAP_PITCH
"
].
value
}
}
Row
{
width
:
parent
.
width
Text
{
id
:
yaw
;
text
:
"
Yaw:
"
}
Text
{
horizontalAlignment
:
Text
.
AlignRight
width
:
parent
.
width
-
yaw
.
contentWidth
text
:
autopilot
.
parameters
[
"
RC_MAP_YAW
"
].
value
==
0
?
"
Setup required
"
:
autopilot
.
parameters
[
"
RC_MAP_YAW
"
].
value
}
}
Row
{
width
:
parent
.
width
Text
{
id
:
throttle
;
text
:
"
Throttle:
"
}
Text
{
horizontalAlignment
:
Text
.
AlignRight
width
:
parent
.
width
-
throttle
.
contentWidth
text
:
autopilot
.
parameters
[
"
RC_MAP_THROTTLE
"
].
value
==
0
?
"
Setup required
"
:
autopilot
.
parameters
[
"
RC_MAP_THROTTLE
"
].
value
}
}
Row
{
width
:
parent
.
width
Text
{
id
:
mode
;
text
:
"
Mode switch:
"
}
Text
{
horizontalAlignment
:
Text
.
AlignRight
width
:
parent
.
width
-
mode
.
contentWidth
text
:
autopilot
.
parameters
[
"
RC_MAP_MODE_SW
"
].
value
==
0
?
"
Setup required
"
:
autopilot
.
parameters
[
"
RC_MAP_MODE_SW
"
].
value
}
}
}
src/AutoPilotPlugins/PX4/SafetyComponent.cc
View file @
1d5a457a
...
...
@@ -100,37 +100,7 @@ QWidget* SafetyComponent::setupWidget(void) const
return
holder
;
}
const
QVariantList
&
SafetyComponent
::
summaryItems
(
void
)
QUrl
SafetyComponent
::
summaryQmlSource
(
void
)
const
{
if
(
!
_summaryItems
.
count
())
{
QString
name
;
QString
state
;
name
=
"RTL min alt:"
;
VehicleComponentSummaryItem
*
item
=
new
VehicleComponentSummaryItem
(
name
,
state
,
this
);
_summaryItems
.
append
(
QVariant
::
fromValue
(
item
));
name
=
"RTL home alt:"
;
item
=
new
VehicleComponentSummaryItem
(
name
,
state
,
this
);
_summaryItems
.
append
(
QVariant
::
fromValue
(
item
));
name
=
"RTL home loiter:"
;
item
=
new
VehicleComponentSummaryItem
(
name
,
state
,
this
);
_summaryItems
.
append
(
QVariant
::
fromValue
(
item
));
name
=
"Telemetry loss RTL:"
;
item
=
new
VehicleComponentSummaryItem
(
name
,
state
,
this
);
_summaryItems
.
append
(
QVariant
::
fromValue
(
item
));
name
=
"RC loss RTL:"
;
item
=
new
VehicleComponentSummaryItem
(
name
,
state
,
this
);
_summaryItems
.
append
(
QVariant
::
fromValue
(
item
));
}
return
_summaryItems
;
return
QUrl
::
fromUserInput
(
"qrc:/qml/SafetyComponentSummary.qml"
);
}
src/AutoPilotPlugins/PX4/SafetyComponent.h
View file @
1d5a457a
...
...
@@ -50,7 +50,7 @@ public:
virtual
QString
setupStateDescription
(
void
)
const
;
virtual
QWidget
*
setupWidget
(
void
)
const
;
virtual
QStringList
paramFilterList
(
void
)
const
;
virtual
const
QVariantList
&
summaryItems
(
void
)
;
virtual
QUrl
summaryQmlSource
(
void
)
const
;
private:
const
QString
_name
;
...
...
src/AutoPilotPlugins/PX4/SafetyComponent.qml
View file @
1d5a457a
...
...
@@ -32,7 +32,7 @@ Rectangle {
id
:
homeLoiterCheckbox
property
Fact
fact
:
autopilot
.
parameters
[
"
RTL_LAND_DELAY
"
]
checked
:
fact
.
value
<
0
checked
:
fact
.
value
>
0
text
:
"
Loiter at Home altitude for
"
onClicked
:
{
...
...
src/AutoPilotPlugins/PX4/SafetyComponentSummary.qml
0 → 100644
View file @
1d5a457a
import
QtQuick
2.2
import
QtQuick
.
Controls
1.2
import
QtQuick
.
Controls
.
Styles
1.2
import
QGroundControl
.
FactSystem
1.0
import
QGroundControl
.
FactControls
1.0
Column
{
anchors.fill
:
parent
anchors.margins
:
8
Row
{
width
:
parent
.
width
Text
{
id
:
rtlMinAlt
;
text
:
"
RTL min alt:
"
}
Text
{
horizontalAlignment
:
Text
.
AlignRight
;
width
:
parent
.
width
-
rtlMinAlt
.
contentWidth
;
text
:
autopilot
.
parameters
[
"
RTL_RETURN_ALT
"
].
valueString
}
}
Row
{
width
:
parent
.
width
Text
{
id
:
rtlHomeAlt
;
text
:
"
RTL home alt:
"
}
Text
{
horizontalAlignment
:
Text
.
AlignRight
;
width
:
parent
.
width
-
rtlHomeAlt
.
contentWidth
;
text
:
autopilot
.
parameters
[
"
RTL_DESCEND_ALT
"
].
valueString
}
}
Row
{
width
:
parent
.
width
Text
{
id
:
rtlLoiter
;
text
:
"
RTL loiter delay:
"
}
Text
{
horizontalAlignment
:
Text
.
AlignRight
;
width
:
parent
.
width
-
rtlLoiter
.
contentWidth
;
text
:
autopilot
.
parameters
[
"
RTL_LAND_DELAY
"
].
value
<
0
?
"
Disabled
"
:
autopilot
.
parameters
[
"
RTL_LAND_DELAY
"
].
valueString
}
}
Row
{
width
:
parent
.
width
Text
{
id
:
commLoss
;
text
:
"
Telemetry loss RTL:
"
}
Text
{
horizontalAlignment
:
Text
.
AlignRight
;
width
:
parent
.
width
-
commLoss
.
contentWidth
;
text
:
autopilot
.
parameters
[
"
COM_DL_LOSS_EN
"
].
value
!=
1
?
"
Disabled
"
:
autopilot
.
parameters
[
"
NAV_DLL_N
"
].
valueString
}
}
Row
{
width
:
parent
.
width
Text
{
id
:
rcLoss
;
text
:
"
RC loss RTL (seconds):
"
}
Text
{
horizontalAlignment
:
Text
.
AlignRight
;
width
:
parent
.
width
-
rcLoss
.
contentWidth
;
text
:
autopilot
.
parameters
[
"
COM_RC_LOSS_T
"
].
valueString
}
}
}
src/AutoPilotPlugins/PX4/SensorsComponent.cc
View file @
1d5a457a
...
...
@@ -33,9 +33,6 @@
/// @brief Parameters which signal a change in setupComplete state
static
const
char
*
triggerParams
[]
=
{
"SENS_MAG_XOFF"
,
"SENS_GYRO_XOFF"
,
"SENS_ACC_XOFF"
,
"SENS_DPRES_OFF"
,
NULL
};
/// @brief Used to translate from parameter name to user string
static
const
char
*
triggerSensors
[]
=
{
"Compass"
,
"Gyro"
,
"Acceleromter"
,
"Airspeed"
,
NULL
};
SensorsComponent
::
SensorsComponent
(
UASInterface
*
uas
,
AutoPilotPlugin
*
autopilot
,
QObject
*
parent
)
:
PX4Component
(
uas
,
autopilot
,
parent
),
_name
(
tr
(
"Sensors"
))
...
...
@@ -117,108 +114,7 @@ QWidget* SensorsComponent::setupWidget(void) const
return
new
QGCPX4SensorCalibration
;
}
const
QVariantList
&
SensorsComponent
::
summaryItems
(
void
)
QUrl
SensorsComponent
::
summaryQmlSource
(
void
)
const
{
if
(
!
_summaryItems
.
count
())
{
QString
name
;
QString
state
;
// Summary item for each Sensor
int
i
=
0
;
while
(
triggerParams
[
i
]
!=
NULL
)
{
QVariant
value
;
name
=
tr
(
"%1:"
).
arg
(
triggerSensors
[
i
]);
if
(
_paramMgr
->
getParameterValue
(
_paramMgr
->
getDefaultComponentId
(),
triggerParams
[
i
],
value
))
{
if
(
value
.
toFloat
()
==
0.0
f
)
{
state
=
"Setup required"
;
}
else
{
state
=
"Ready"
;
}
}
else
{
// Why is the parameter missing?
Q_ASSERT
(
false
);
}
VehicleComponentSummaryItem
*
item
=
new
VehicleComponentSummaryItem
(
name
,
state
,
this
);
_summaryItems
.
append
(
QVariant
::
fromValue
(
item
));
i
++
;
}
// Summary item for each orientation param
static
const
char
*
orientationSensors
[]
=
{
"Autopilot orientation:"
,
"Compass orientation:"
};
static
const
char
*
orientationParams
[]
=
{
"SENS_BOARD_ROT"
,
"SENS_EXT_MAG_ROT"
};
static
const
size_t
cOrientationSensors
=
sizeof
(
orientationSensors
)
/
sizeof
(
orientationSensors
[
0
]);
static
const
char
*
orientationValues
[]
=
{
"Line of flight"
,
"Yaw:45"
,
"Yaw:90"
,
"Yaw:135"
,
"Yaw:180"
,
"Yaw:225"
,
"Yaw:270"
,
"Yaw:315"
,
"Roll:180"
,
"Roll:180 Yaw:45"
,
"Roll:180 Yaw:90"
,
"Roll:180 Yaw:135"
,
"Pitch:180"
,
"Roll:180 Yaw:225"
,
"Roll:180 Yaw:270"
,
"Roll:180 Yaw:315"
,
"Roll:90"
,
"Roll:90 Yaw:45"
,
"Roll:90 Yaw:90"
,
"Roll:90 Yaw:135"
,
"Roll:270"
,
"Roll:270 Yaw:45"
,
"Roll:270 Yaw:90"
,
"Roll:270 Yaw:135"
,
"Pitch:90"
,
"Pitch:270"
,
"Pitch:180"
,
"Pitch:180 Yaw:90"
,
"Pitch:180 Yaw:270"
,
"Roll:90 Pitch:90"
,
"Roll:180 Pitch:90"
,
"Roll:270 Pitch:90"
,
"Roll:90 Pitch:180"
,
"Roll:270 Pitch:180"
,
"Roll:90 Pitch:270"
,
"Roll:180 Pitch:270"
,
"Roll:270 Pitch:270"
,
"Roll:90 Pitch:180 Yaw:90"
,
"Roll:90 Yaw:270"
};
static
const
size_t
cOrientationValues
=
sizeof
(
orientationValues
)
/
sizeof
(
orientationValues
[
0
]);
for
(
size_t
i
=
0
;
i
<
cOrientationSensors
;
i
++
)
{
QVariant
value
;
name
=
orientationSensors
[
i
];
if
(
_paramMgr
->
getParameterValue
(
_paramMgr
->
getDefaultComponentId
(),
orientationParams
[
i
],
value
))
{
int
index
=
value
.
toInt
();
if
(
index
<
0
||
index
>=
(
int
)
cOrientationValues
)
{
state
=
"Setup required"
;
}
else
{
state
=
orientationValues
[
index
];
}
}
else
{
// Why is the parameter missing?
Q_ASSERT
(
false
);
state
=
"Unknown"
;
}
VehicleComponentSummaryItem
*
item
=
new
VehicleComponentSummaryItem
(
name
,
state
,
this
);
_summaryItems
.
append
(
QVariant
::
fromValue
(
item
));
}
}
return
_summaryItems
;
return
QUrl
::
fromUserInput
(
"qrc:/qml/SensorsComponentSummary.qml"
);
}
src/AutoPilotPlugins/PX4/SensorsComponent.h
View file @
1d5a457a
...
...
@@ -49,7 +49,7 @@ public:
virtual
QString
setupStateDescription
(
void
)
const
;
virtual
QWidget
*
setupWidget
(
void
)
const
;
virtual
QStringList
paramFilterList
(
void
)
const
;
virtual
const
QVariantList
&
summaryItems
(
void
)
;
virtual
QUrl
summaryQmlSource
(
void
)
const
;
private:
const
QString
_name
;
...
...
src/AutoPilotPlugins/PX4/SensorsComponentSummary.qml
0 → 100644
View file @
1d5a457a
import
QtQuick
2.2
import
QtQuick
.
Controls
1.2
import
QtQuick
.
Controls
.
Styles
1.2
import
QGroundControl
.
FactSystem
1.0
import
QGroundControl
.
FactControls
1.0
Column
{
anchors.fill
:
parent
anchors.margins
:
8
Row
{
width
:
parent
.
width
Text
{
id
:
compass
;
text
:
"
Compass:
"
}
Text
{
horizontalAlignment
:
Text
.
AlignRight
;
width
:
parent
.
width
-
compass
.
contentWidth
;
text
:
autopilot
.
parameters
[
"
SENS_MAG_XOFF
"
].
value
==
0.0
?
"
Setup required
"
:
"
Ready
"
}
}
Row
{
width
:
parent
.
width
Text
{
id
:
gyro
;
text
:
"
Gyro:
"
}
Text
{
horizontalAlignment
:
Text
.
AlignRight
;
width
:
parent
.
width
-
gyro
.
contentWidth
;
text
:
autopilot
.
parameters
[
"
SENS_GYRO_XOFF
"
].
value
==
0.0
?
"
Setup required
"
:
"
Ready
"
}
}
Row
{
width
:
parent
.
width
Text
{
id
:
accel
;
text
:
"
Accelerometer:
"
}
Text
{
horizontalAlignment
:
Text
.
AlignRight
;
width
:
parent
.
width
-
accel
.
contentWidth
;
text
:
autopilot
.
parameters
[
"
SENS_ACC_XOFF
"
].
value
==
0.0
?
"
Setup required
"
:
"
Ready
"
}
}
Row
{
width
:
parent
.
width
Text
{
id
:
airspeed
;
text
:
"
Airspeed:
"
}
Text
{
horizontalAlignment
:
Text
.
AlignRight
;
width
:
parent
.
width
-
airspeed
.
contentWidth
;
text
:
autopilot
.
parameters
[
"
SENS_DPRES_OFF
"
].
value
==
0.0
?
"
Setup required
"
:
"
Ready
"
}
}
}
src/VehicleSetup/SetupViewConnected.qml
View file @
1d5a457a
...
...
@@ -27,7 +27,7 @@ Rectangle {
spacing
:
5
Rectangle
{
id
:
header
;
color
:
"
lightblue
"
;
radius
:
10.0
;
width
:
parent
.
width
;
height
:
titleText
.
height
+
20
;
opacity
:
0.8
;
Text
{
id
:
titleText
;
anchors.centerIn
:
parent
;
font.pointSize
:
24
;
text
:
"
Vehicle S
ummary
"
}
Text
{
id
:
titleText
;
anchors.centerIn
:
parent
;
font.pointSize
:
24
;
text
:
"
Vehicle S
etup
"
}
}
Flow
{
...
...
@@ -42,7 +42,7 @@ Rectangle {
width
:
250
height
:
200
property
var
summary
Model
:
modelData
.
summaryItems
property
var
summary
QmlSource
:
modelData
.
summaryQmlSource
text
:
modelData
.
name
property
bool
setupComplete
:
modelData
.
setupComplete
...
...
@@ -100,15 +100,9 @@ Rectangle {
GradientStop
{
position
:
1
;
color
:
"
#000000
"
}
}
ListView
{
id
:
summaryList
Loader
{
anchors.fill
:
parent
anchors.margins
:
4
model
:
control
.
summaryModel
delegate
:
Row
{
width
:
parent
.
width
Text
{
id
:
firstCol
;
text
:
modelData
.
name
}
Text
{
horizontalAlignment
:
Text
.
AlignRight
;
width
:
parent
.
width
-
firstCol
.
contentWidth
;
text
:
modelData
.
state
}
}
source
:
summaryQmlSource
}
}
}
...
...
src/VehicleSetup/SetupViewDisconnected.qml
View file @
1d5a457a
...
...
@@ -14,7 +14,7 @@ Rectangle {
anchors.fill
:
parent
Rectangle
{
id
:
header
;
color
:
"
lightblue
"
;
radius
:
10.0
;
width
:
parent
.
width
;
height
:
titleText
.
height
+
20
;
opacity
:
0.8
;
Text
{
id
:
titleText
;
anchors.centerIn
:
parent
;
font.pointSize
:
24
;
text
:
"
Vehicle S
ummary
"
}
Text
{
id
:
titleText
;
anchors.centerIn
:
parent
;
font.pointSize
:
24
;
text
:
"
Vehicle S
etup
"
}
}
Text
{
width
:
parent
.
width
;
height
:
parent
.
height
-
header
.
height
-
footer
.
height
;
...
...
@@ -22,7 +22,7 @@ Rectangle {
color
:
palette
.
windowText
horizontalAlignment
:
Text
.
AlignHCenter
verticalAlignment
:
Text
.
AlignVCenter
text
:
"
No vehicle currently connected.
Vehicle Setup is only available while vehicle is connected.
"
}
text
:
"
Vehicle Setup is only available while vehicle is connected.
"
}
Rectangle
{
id
:
footer
;
anchors.bottom
:
parent
.
bottom
;
color
:
"
lightblue
"
;
radius
:
10.0
;
width
:
parent
.
width
;
height
:
titleText
.
height
+
20
;
opacity
:
0.8
;
...
...
src/VehicleSetup/VehicleComponent.h
View file @
1d5a457a
...
...
@@ -49,7 +49,7 @@ class VehicleComponent : public QObject
Q_PROPERTY
(
QString
setupStateDescription
READ
setupStateDescription
STORED
false
)
Q_PROPERTY
(
QString
icon
READ
icon
CONSTANT
)
Q_PROPERTY
(
QWidget
*
setupWidget
READ
setupWidget
STORED
false
)
Q_PROPERTY
(
Q
VariantList
summaryItems
READ
summaryItems
CONSTANT
);
Q_PROPERTY
(
Q
Url
summaryQmlSource
READ
summaryQmlSource
CONSTANT
);
public:
VehicleComponent
(
UASInterface
*
uas
,
AutoPilotPlugin
*
autopilot
,
QObject
*
parent
=
NULL
);
...
...
@@ -63,7 +63,7 @@ public:
virtual
QString
setupStateDescription
(
void
)
const
=
0
;
virtual
QWidget
*
setupWidget
(
void
)
const
=
0
;
virtual
QStringList
paramFilterList
(
void
)
const
=
0
;
virtual
const
QVariantList
&
summaryItems
(
void
)
=
0
;
virtual
QUrl
summaryQmlSource
(
void
)
const
=
0
;
virtual
void
addSummaryQmlComponent
(
QQmlContext
*
context
,
QQuickItem
*
parent
);
...
...
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