Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Valentin Platzgummer
qgroundcontrol
Commits
6261e761
Commit
6261e761
authored
May 26, 2015
by
Don Gagne
Browse files
FactPanel V2
parent
c8b92a9a
Changes
48
Show whitespace changes
Inline
Side-by-side
QGCApplication.pro
View file @
6261e761
...
...
@@ -620,7 +620,6 @@ INCLUDEPATH += \
HEADERS
+=
\
src
/
FactSystem
/
Fact
.
h
\
src
/
FactSystem
/
FactBinder
.
h
\
src
/
FactSystem
/
FactMetaData
.
h
\
src
/
FactSystem
/
FactSystem
.
h
\
src
/
FactSystem
/
FactValidator
.
h
\
...
...
@@ -629,7 +628,6 @@ HEADERS += \
SOURCES
+=
\
src
/
FactSystem
/
Fact
.
cc
\
src
/
FactSystem
/
FactBinder
.
cc
\
src
/
FactSystem
/
FactMetaData
.
cc
\
src
/
FactSystem
/
FactSystem
.
cc
\
src
/
FactSystem
/
FactValidator
.
cc
\
...
...
src/AutoPilotPlugins/AutoPilotPlugin.cc
View file @
6261e761
...
...
@@ -112,14 +112,14 @@ void AutoPilotPlugin::refreshParametersPrefix(int componentId, const QString& na
_getParameterLoader
()
->
refreshParametersPrefix
(
componentId
,
namePrefix
);
}
bool
AutoPilotPlugin
::
parameterExists
(
const
QString
&
name
)
bool
AutoPilotPlugin
::
parameterExists
(
int
componentId
,
const
QString
&
name
)
{
return
_getParameterLoader
()
->
parameterExists
(
FactSystem
::
defaultC
omponentId
,
name
);
return
_getParameterLoader
()
->
parameterExists
(
c
omponentId
,
name
);
}
Fact
*
AutoPilotPlugin
::
getParameterFact
(
const
QString
&
name
)
Fact
*
AutoPilotPlugin
::
getParameterFact
(
int
componentId
,
const
QString
&
name
)
{
return
_getParameterLoader
()
->
getFact
(
FactSystem
::
defaultC
omponentId
,
name
);
return
_getParameterLoader
()
->
getFact
(
c
omponentId
,
name
);
}
bool
AutoPilotPlugin
::
factExists
(
FactSystem
::
Provider_t
provider
,
int
componentId
,
const
QString
&
name
)
...
...
src/AutoPilotPlugins/AutoPilotPlugin.h
View file @
6261e761
...
...
@@ -71,16 +71,16 @@ public:
Q_INVOKABLE
void
refreshParametersPrefix
(
int
componentId
,
const
QString
&
namePrefix
);
/// Returns true if the specifed parameter exists from the default component
Q_INVOKABLE
bool
parameterExists
(
const
QString
&
name
);
Q_INVOKABLE
bool
parameterExists
(
int
componentId
,
const
QString
&
name
);
/// Returns all parameter names
/// FIXME: component id missing, generic to fact
QStringList
parameterNames
(
void
);
/// Returns the specified parameter Fact from the default component
/// WARNING:
Will assert if fact
does not exists. If that possibility exists, check for existince first with
///
fact
Exists.
Fact
*
getParameterFact
(
const
QString
&
name
);
/// WARNING:
Returns a default Fact if parameter
does not exists. If that possibility exists, check for existince first with
///
parameter
Exists.
Fact
*
getParameterFact
(
int
componentId
,
const
QString
&
name
);
/// Writes the parameter facts to the specified stream
void
writeParametersToStream
(
QTextStream
&
stream
);
...
...
src/AutoPilotPlugins/PX4/AirframeComponent.cc
View file @
6261e761
...
...
@@ -142,7 +142,7 @@ bool AirframeComponent::requiresSetup(void) const
bool
AirframeComponent
::
setupComplete
(
void
)
const
{
return
_autopilot
->
getParameterFact
(
"SYS_AUTOSTART"
)
->
value
().
toInt
()
!=
0
;
return
_autopilot
->
getParameterFact
(
FactSystem
::
defaultComponentId
,
"SYS_AUTOSTART"
)
->
value
().
toInt
()
!=
0
;
}
QString
AirframeComponent
::
setupStateDescription
(
void
)
const
...
...
src/AutoPilotPlugins/PX4/AirframeComponent.qml
View file @
6261e761
...
...
@@ -31,6 +31,7 @@ import QGroundControl.FactControls 1.0
import
QGroundControl
.
Palette
1.0
import
QGroundControl
.
Controls
1.0
import
QGroundControl
.
Controllers
1.0
import
QGroundControl
.
ScreenTools
1.0
QGCView
{
id
:
rootQGCView
...
...
@@ -67,7 +68,7 @@ QGCView {
"
This configuration can only be modified through the Parameter Editor.
\n\n
"
+
"
If you want to Reset your airframe configuration and select a standard configuration, click 'Reset' above.
"
Fact
{
id
:
sys_autostart
;
name
:
"
SYS_AUTOSTART
"
}
property
Fact
sys_autostart
:
controller
.
getParameterFact
(
-
1
,
"
SYS_AUTOSTART
"
)
function
accept
()
{
sys_autostart
.
value
=
0
...
...
@@ -107,7 +108,7 @@ QGCView {
QGCLabel
{
id
:
header
width
:
parent
.
width
font.pointSize
:
20
font.pointSize
:
ScreenTools
.
largeFontPointSize
text
:
"
AIRFRAME CONFIG
"
}
...
...
src/AutoPilotPlugins/PX4/AirframeComponentController.cc
View file @
6261e761
...
...
@@ -48,16 +48,16 @@ AirframeComponentController::AirframeComponentController(void) :
qmlRegisterUncreatableType
<
Airframe
>
(
"QGroundControl.Controllers"
,
1
,
0
,
"Aiframe"
,
"Can only reference Airframe"
);
}
QStringList
used
Fact
s
;
used
Fact
s
<<
"SYS_AUTOSTART"
<<
"SYS_AUTOCONFIG"
;
if
(
!
_all
FactsExists
(
usedFact
s
))
{
QStringList
used
Param
s
;
used
Param
s
<<
"SYS_AUTOSTART"
<<
"SYS_AUTOCONFIG"
;
if
(
!
_all
ParametersExists
(
FactSystem
::
defaultComponentId
,
usedParam
s
))
{
return
;
}
// Load up member variables
bool
autostartFound
=
false
;
_autostartId
=
_autopilot
->
getParameterFact
(
"SYS_AUTOSTART"
)
->
value
().
toInt
();
_autostartId
=
getParameterFact
(
FactSystem
::
defaultComponentId
,
"SYS_AUTOSTART"
)
->
value
().
toInt
();
for
(
const
AirframeComponentAirframes
::
AirframeType_t
*
pType
=&
AirframeComponentAirframes
::
rgAirframeTypes
[
0
];
pType
->
name
!=
NULL
;
pType
++
)
{
AirframeType
*
airframeType
=
new
AirframeType
(
pType
->
name
,
pType
->
imageResource
,
this
);
...
...
@@ -99,9 +99,8 @@ void AirframeComponentController::changeAutostart(void)
qgcApp
()
->
setOverrideCursor
(
Qt
::
WaitCursor
);
_autopilot
->
getParameterFact
(
"SYS_AUTOSTART"
)
->
setValue
(
_autostartId
);
_autopilot
->
getParameterFact
(
"SYS_AUTOCONFIG"
)
->
setValue
(
1
);
getParameterFact
(
-
1
,
"SYS_AUTOSTART"
)
->
setValue
(
_autostartId
);
getParameterFact
(
-
1
,
"SYS_AUTOCONFIG"
)
->
setValue
(
1
);
// Wait for the parameters to flow through system
qgcApp
()
->
processEvents
(
QEventLoop
::
ExcludeUserInputEvents
);
...
...
src/AutoPilotPlugins/PX4/AirframeComponentSummary.qml
View file @
6261e761
...
...
@@ -5,15 +5,18 @@ import QGroundControl.FactSystem 1.0
import
QGroundControl
.
FactControls
1.0
import
QGroundControl
.
Controls
1.0
import
QGroundControl
.
Controllers
1.0
import
QGroundControl
.
Palette
1.0
FactPanel
{
id
:
panel
anchors.fill
:
parent
color
:
qgcPal
.
windowShadeDark
QGCPalette
{
id
:
qgcPal
;
colorGroupEnabled
:
enabled
}
AirframeComponentController
{
id
:
controller
;
factPanel
:
panel
}
Fact
{
id
:
sysIdFact
;
name
:
"
MAV_SYS_ID
"
;
onFactMissing
:
showMissingFactOverlay
(
name
)
}
Fact
{
id
:
sysAutoStartFact
;
name
:
"
SYS_AUTOSTART
"
;
onFactMissing
:
showMissingFactOverlay
(
name
)
}
property
Fact
sysIdFact
:
controller
.
getParameterFact
(
-
1
,
"
MAV_SYS_ID
"
)
property
Fact
sysAutoStartFact
:
controller
.
getParameterFact
(
-
1
,
"
SYS_AUTOSTART
"
)
property
bool
autoStartSet
:
sysAutoStartFact
.
value
!=
0
...
...
src/AutoPilotPlugins/PX4/FlightModesComponent.cc
View file @
6261e761
...
...
@@ -73,7 +73,7 @@ bool FlightModesComponent::requiresSetup(void) const
bool
FlightModesComponent
::
setupComplete
(
void
)
const
{
return
_autopilot
->
getParameterFact
(
"RC_MAP_MODE_SW"
)
->
value
().
toInt
()
!=
0
;
return
_autopilot
->
getParameterFact
(
FactSystem
::
defaultComponentId
,
"RC_MAP_MODE_SW"
)
->
value
().
toInt
()
!=
0
;
}
QString
FlightModesComponent
::
setupStateDescription
(
void
)
const
...
...
src/AutoPilotPlugins/PX4/FlightModesComponent.qml
View file @
6261e761
...
...
@@ -34,13 +34,14 @@ import QGroundControl.ScreenTools 1.0
Item
{
Loader
{
property
FlightModesComponentController
controller
:
FlightModesComponentController
{
}
property
QGCPalette
qgcPal
:
QGCPalette
{
colorGroupEnabled
:
true
}
property
bool
loading
:
true
id
:
loader
anchors.fill
:
parent
sourceComponent
:
controller
.
validConfiguration
?
validComponent
:
invalidComponent
property
FlightModesComponentController
controller
:
FlightModesComponentController
{
factPanel
:
loader
.
item
}
property
QGCPalette
qgcPal
:
QGCPalette
{
colorGroupEnabled
:
true
}
property
bool
loading
:
true
onLoaded
:
loading
=
false
}
...
...
@@ -48,30 +49,28 @@ Item {
id
:
validComponent
FactPanel
{
Fact
{
id
:
rc_map_throttle
;
name
:
"
RC_MAP_THROTTLE
"
;
onFactMissing
:
showMissingFactOverlay
(
name
)
}
Fact
{
id
:
rc_map_yaw
;
name
:
"
RC_MAP_YAW
"
;
onFactMissing
:
showMissingFactOverlay
(
name
)
}
Fact
{
id
:
rc_map_pitch
;
name
:
"
RC_MAP_PITCH
"
;
onFactMissing
:
showMissingFactOverlay
(
name
)
}
Fact
{
id
:
rc_map_roll
;
name
:
"
RC_MAP_ROLL
"
;
onFactMissing
:
showMissingFactOverlay
(
name
)
}
Fact
{
id
:
rc_map_flaps
;
name
:
"
RC_MAP_FLAPS
"
;
onFactMissing
:
showMissingFactOverlay
(
name
)
}
Fact
{
id
:
rc_map_aux1
;
name
:
"
RC_MAP_AUX1
"
;
onFactMissing
:
showMissingFactOverlay
(
name
)
}
Fact
{
id
:
rc_map_aux2
;
name
:
"
RC_MAP_AUX2
"
;
onFactMissing
:
showMissingFactOverlay
(
name
)
}
Fact
{
id
:
rc_map_mode_sw
;
name
:
"
RC_MAP_MODE_SW
"
;
onFactMissing
:
showMissingFactOverlay
(
name
)
}
Fact
{
id
:
rc_map_posctl_sw
;
name
:
"
RC_MAP_POSCTL_SW
"
;
onFactMissing
:
showMissingFactOverlay
(
name
)
}
Fact
{
id
:
rc_map_return_sw
;
name
:
"
RC_MAP_RETURN_SW
"
;
onFactMissing
:
showMissingFactOverlay
(
name
)
}
Fact
{
id
:
rc_map_offboard_sw
;
name
:
"
RC_MAP_OFFB_SW
"
;
onFactMissing
:
showMissingFactOverlay
(
name
)
}
Fact
{
id
:
rc_map_loiter_sw
;
name
:
"
RC_MAP_LOITER_SW
"
;
onFactMissing
:
showMissingFactOverlay
(
name
)
}
Fact
{
id
:
rc_map_acro_sw
;
name
:
"
RC_MAP_ACRO_SW
"
;
onFactMissing
:
showMissingFactOverlay
(
name
)
}
Fact
{
id
:
rc_posctl_th
;
name
:
"
RC_POSCTL_TH
"
;
onFactMissing
:
showMissingFactOverlay
(
name
)
}
Fact
{
id
:
rc_return_th
;
name
:
"
RC_RETURN_TH
"
;
onFactMissing
:
showMissingFactOverlay
(
name
)
}
Fact
{
id
:
rc_offboard_th
;
name
:
"
RC_OFFB_TH
"
;
onFactMissing
:
showMissingFactOverlay
(
name
)
}
Fact
{
id
:
rc_loiter_th
;
name
:
"
RC_LOITER_TH
"
;
onFactMissing
:
showMissingFactOverlay
(
name
)
}
Fact
{
id
:
rc_acro_th
;
name
:
"
RC_ACRO_TH
"
;
onFactMissing
:
showMissingFactOverlay
(
name
)
}
Fact
{
id
:
rc_assist_th
;
name
:
"
RC_ASSIST_TH
"
;
onFactMissing
:
showMissingFactOverlay
(
name
)
}
Fact
{
id
:
rc_auto_th
;
name
:
"
RC_AUTO_TH
"
;
onFactMissing
:
showMissingFactOverlay
(
name
)
}
Fact
{
id
:
rc_th_user
;
name
:
"
RC_TH_USER
"
;
onFactMissing
:
showMissingFactOverlay
(
name
)
}
property
Fact
rc_map_throttle
:
controller
.
getParameterFact
(
-
1
,
"
RC_MAP_THROTTLE
"
)
property
Fact
rc_map_yaw
:
controller
.
getParameterFact
(
-
1
,
"
RC_MAP_YAW
"
)
property
Fact
rc_map_pitch
:
controller
.
getParameterFact
(
-
1
,
"
RC_MAP_PITCH
"
)
property
Fact
rc_map_roll
:
controller
.
getParameterFact
(
-
1
,
"
RC_MAP_ROLL
"
)
property
Fact
rc_map_flaps
:
controller
.
getParameterFact
(
-
1
,
"
RC_MAP_FLAPS
"
)
property
Fact
rc_map_aux1
:
controller
.
getParameterFact
(
-
1
,
"
RC_MAP_AUX1
"
)
property
Fact
rc_map_aux2
:
controller
.
getParameterFact
(
-
1
,
"
RC_MAP_AUX2
"
)
property
Fact
rc_map_mode_sw
:
controller
.
getParameterFact
(
-
1
,
"
RC_MAP_MODE_SW
"
)
property
Fact
rc_map_posctl_sw
:
controller
.
getParameterFact
(
-
1
,
"
RC_MAP_POSCTL_SW
"
)
property
Fact
rc_map_return_sw
:
controller
.
getParameterFact
(
-
1
,
"
RC_MAP_RETURN_SW
"
)
property
Fact
rc_map_offboard_sw
:
controller
.
getParameterFact
(
-
1
,
"
RC_MAP_OFFB_SW
"
)
property
Fact
rc_map_loiter_sw
:
controller
.
getParameterFact
(
-
1
,
"
RC_MAP_LOITER_SW
"
)
property
Fact
rc_assist_th
:
controller
.
getParameterFact
(
-
1
,
"
RC_ASSIST_TH
"
)
property
Fact
rc_posctl_th
:
controller
.
getParameterFact
(
-
1
,
"
RC_POSCTL_TH
"
)
property
Fact
rc_auto_th
:
controller
.
getParameterFact
(
-
1
,
"
RC_AUTO_TH
"
)
property
Fact
rc_loiter_th
:
controller
.
getParameterFact
(
-
1
,
"
RC_LOITER_TH
"
)
property
Fact
rc_return_th
:
controller
.
getParameterFact
(
-
1
,
"
RC_RETURN_TH
"
)
property
Fact
rc_offboard_th
:
controller
.
getParameterFact
(
-
1
,
"
RC_OFFB_TH
"
)
property
Fact
rc_th_user
:
controller
.
getParameterFact
(
-
1
,
"
RC_TH_USER
"
)
property
int
throttleChannel
:
rc_map_throttle
.
value
property
int
yawChannel
:
rc_map_yaw
.
value
...
...
@@ -135,7 +134,7 @@ Item {
id
:
unassignedModeTileComponent
Rectangle
{
Fact
{
id
:
fact
;
name
:
tileParam
;
onFactMissing
:
showMissingFactOverlay
(
name
)
}
property
Fact
fact
:
controller
.
getParameterFact
(
-
1
,
tileParam
)
property
bool
dragEnabled
:
fact
.
value
==
0
id
:
outerRect
...
...
@@ -221,7 +220,8 @@ Item {
id
:
assignedModeTileComponent
Rectangle
{
Fact
{
id
:
fact
;
name
:
tileDragEnabled
?
tileParam
:
""
;
onFactMissing
:
showMissingFactOverlay
(
name
)
}
Fact
{
id
:
nullFact
}
property
Fact
fact
:
tileDragEnabled
?
controller
.
getParameterFact
(
-
1
,
tileParam
)
:
nullFact
width
:
tileWidth
height
:
tileHeight
...
...
@@ -362,7 +362,7 @@ Item {
QGCLabel
{
text
:
"
FLIGHT MODES CONFIG
"
font.pointSize
:
ScreenTools
.
f
ontPoint
Factor
*
(
20
);
font.pointSize
:
ScreenTools
.
largeF
ontPoint
Size
}
Item
{
height
:
20
;
width
:
10
}
// spacer
...
...
@@ -641,6 +641,7 @@ Item {
QGCCheckBox
{
checked
:
controller
.
sendLiveRCSwitchRanges
text
:
"
Show live RC display
"
onClicked
:
{
controller
.
sendLiveRCSwitchRanges
=
checked
}
...
...
@@ -882,7 +883,7 @@ Item {
Component
{
id
:
invalidComponent
Re
ctan
gl
e
{
Fa
ct
P
ane
l
{
anchors.fill
:
parent
color
:
qgcPal
.
window
...
...
src/AutoPilotPlugins/PX4/FlightModesComponentController.cc
View file @
6261e761
...
...
@@ -32,19 +32,16 @@
#include
<QVariant>
#include
<QQmlProperty>
FlightModesComponentController
::
FlightModesComponentController
(
QObject
*
parent
)
:
QObject
(
parent
),
FlightModesComponentController
::
FlightModesComponentController
(
void
)
:
_liveRCValues
(
false
),
_validConfiguration
(
false
),
_channelCount
(
18
),
_autoPilotPlugin
(
NULL
)
_channelCount
(
18
)
{
_uas
=
UASManager
::
instance
()
->
getActiveUAS
();
Q_ASSERT
(
_uas
);
_autoPilotPlugin
=
AutoPilotPluginManager
::
instance
()
->
getInstanceForAutoPilotPlugin
(
_uas
);
Q_ASSERT
(
_autoPilotPlugin
);
Q_ASSERT
(
_autoPilotPlugin
->
pluginReady
());
QStringList
usedParams
;
usedParams
<<
"RC_MAP_THROTTLE"
<<
"RC_MAP_YAW"
<<
"RC_MAP_PITCH"
<<
"RC_MAP_ROLL"
<<
"RC_MAP_FLAPS"
<<
"RC_MAP_AUX1"
<<
"RC_MAP_AUX2"
<<
"RC_MAP_ACRO_SW"
;
if
(
!
_allParametersExists
(
FactSystem
::
defaultComponentId
,
usedParams
))
{
return
;
}
_initRcValues
();
_validateConfiguration
();
...
...
@@ -69,16 +66,14 @@ void FlightModesComponentController::_validateConfiguration(void)
{
_validConfiguration
=
true
;
_channelCount
=
_autoPilotPlugin
->
parameterExists
(
"RC_CHAN_CNT"
)
?
_autoPilotPlugin
->
getParameterFact
(
"RC_CHAN_CNT"
)
->
value
().
toInt
()
:
_chanMax
;
_channelCount
=
parameterExists
(
FactSystem
::
defaultComponentId
,
"RC_CHAN_CNT"
)
?
getParameterFact
(
FactSystem
::
defaultComponentId
,
"RC_CHAN_CNT"
)
->
value
().
toInt
()
:
_chanMax
;
if
(
_channelCount
<=
0
||
_channelCount
>
_chanMax
)
{
// Parameter exists, but has not yet been set or is invalid. Use default
_channelCount
=
_chanMax
;
}
// Acro is not full supported yet. If Acro is mapped you uhave to set up the hard way.
if
(
_autoPilotPlugin
->
getParameterFact
(
"RC_MAP_ACRO_SW"
)
->
value
().
toInt
()
!=
0
)
{
if
(
getParameterFact
(
FactSystem
::
defaultComponentId
,
"RC_MAP_ACRO_SW"
)
->
value
().
toInt
()
!=
0
)
{
_validConfiguration
=
false
;
_configurationErrors
+=
"Flight Mode setup does not yet support Acro switch"
;
}
...
...
@@ -92,7 +87,7 @@ void FlightModesComponentController::_validateConfiguration(void)
switchNames
<<
"Mode Switch"
<<
"Return Switch"
<<
"Loiter Switch"
<<
"PosCtl Switch"
<<
"Offboard Switch"
;
for
(
int
i
=
0
;
i
<
switchParams
.
count
();
i
++
)
{
int
map
=
_autoPilotPlugin
->
getParameterFact
(
switchParams
[
i
])
->
value
().
toInt
();
int
map
=
getParameterFact
(
FactSystem
::
defaultComponentId
,
switchParams
[
i
])
->
value
().
toInt
();
switchMappings
<<
map
;
if
(
map
<
0
||
map
>
_channelCount
)
{
...
...
@@ -109,7 +104,7 @@ void FlightModesComponentController::_validateConfiguration(void)
attitudeNames
<<
"Throttle"
<<
"Yaw"
<<
"Pitch"
<<
"Roll"
<<
"Flaps"
<<
"Aux1"
<<
"Aux2"
<<
"Acro"
;
for
(
int
i
=
0
;
i
<
attitudeParams
.
count
();
i
++
)
{
int
map
=
_autoPilotPlugin
->
getParameterFact
(
attitudeParams
[
i
])
->
value
().
toInt
();
int
map
=
getParameterFact
(
FactSystem
::
defaultComponentId
,
attitudeParams
[
i
])
->
value
().
toInt
();
for
(
int
j
=
0
;
j
<
switchParams
.
count
();
j
++
)
{
if
(
map
!=
0
&&
map
==
switchMappings
[
j
])
{
...
...
@@ -127,7 +122,7 @@ void FlightModesComponentController::_validateConfiguration(void)
singleSwitchNames
<<
"Return Switch"
<<
"Offboard Switch"
;
for
(
int
i
=
0
;
i
<
singleSwitchParams
.
count
();
i
++
)
{
int
map
=
_autoPilotPlugin
->
getParameterFact
(
singleSwitchParams
[
i
])
->
value
().
toInt
();
int
map
=
getParameterFact
(
FactSystem
::
defaultComponentId
,
singleSwitchParams
[
i
])
->
value
().
toInt
();
for
(
int
j
=
0
;
j
<
switchParams
.
count
();
j
++
)
{
if
(
map
!=
0
&&
singleSwitchParams
[
i
]
!=
switchParams
[
j
]
&&
map
==
switchMappings
[
j
])
{
...
...
@@ -152,10 +147,10 @@ void FlightModesComponentController::setSendLiveRCSwitchRanges(bool start)
QVariant
value
;
_rgRCMin
[
i
]
=
_autoPilotPlugin
->
getParameterFact
(
rcMinParam
)
->
value
().
toInt
();
_rgRCMax
[
i
]
=
_autoPilotPlugin
->
getParameterFact
(
rcMaxParam
)
->
value
().
toInt
();
_rgRCMin
[
i
]
=
getParameterFact
(
FactSystem
::
defaultComponentId
,
rcMinParam
)
->
value
().
toInt
();
_rgRCMax
[
i
]
=
getParameterFact
(
FactSystem
::
defaultComponentId
,
rcMaxParam
)
->
value
().
toInt
();
float
floatReversed
=
_autoPilotPlugin
->
getParameterFact
(
rcRevParam
)
->
value
().
toFloat
();
float
floatReversed
=
getParameterFact
(
-
1
,
rcRevParam
)
->
value
().
toFloat
();
_rgRCReversed
[
i
]
=
floatReversed
==
-
1.0
f
;
}
...
...
@@ -196,7 +191,7 @@ double FlightModesComponentController::_switchLiveRange(const QString& param)
{
QVariant
value
;
int
channel
=
_autoPilotPlugin
->
getParameterFact
(
param
)
->
value
().
toInt
();
int
channel
=
getParameterFact
(
-
1
,
param
)
->
value
().
toInt
();
if
(
channel
==
0
)
{
return
1.0
;
}
else
{
...
...
src/AutoPilotPlugins/PX4/FlightModesComponentController.h
View file @
6261e761
...
...
@@ -33,14 +33,15 @@
#include
"UASInterface.h"
#include
"AutoPilotPlugin.h"
#include
"FactPanelController.h"
/// MVC Controller for FlightModesComponent.qml.
class
FlightModesComponentController
:
public
QObject
class
FlightModesComponentController
:
public
FactPanelController
{
Q_OBJECT
public:
FlightModesComponentController
(
QObject
*
parent
=
NULL
);
FlightModesComponentController
(
void
);
~
FlightModesComponentController
();
Q_PROPERTY
(
bool
validConfiguration
MEMBER
_validConfiguration
CONSTANT
)
...
...
@@ -79,8 +80,6 @@ private:
static
const
int
_chanMax
=
18
;
UASInterface
*
_uas
;
QList
<
double
>
_rcValues
;
bool
_liveRCValues
;
int
_rgRCMin
[
_chanMax
];
...
...
@@ -90,8 +89,6 @@ private:
bool
_validConfiguration
;
QString
_configurationErrors
;
int
_channelCount
;
AutoPilotPlugin
*
_autoPilotPlugin
;
};
#endif
src/AutoPilotPlugins/PX4/FlightModesComponentSummary.qml
View file @
6261e761
...
...
@@ -4,14 +4,20 @@ import QtQuick.Controls 1.2
import
QGroundControl
.
FactSystem
1.0
import
QGroundControl
.
FactControls
1.0
import
QGroundControl
.
Controls
1.0
import
QGroundControl
.
Palette
1.0
FactPanel
{
id
:
panel
anchors.fill
:
parent
color
:
qgcPal
.
windowShadeDark
Fact
{
id
:
modeSwFact
;
name
:
"
RC_MAP_MODE_SW
"
;
onFactMissing
:
showMissingFactOverlay
(
name
)
}
Fact
{
id
:
posCtlSwFact
;
name
:
"
RC_MAP_POSCTL_SW
"
;
onFactMissing
:
showMissingFactOverlay
(
name
)
}
Fact
{
id
:
loiterSwFact
;
name
:
"
RC_MAP_LOITER_SW
"
;
onFactMissing
:
showMissingFactOverlay
(
name
)
}
Fact
{
id
:
returnSwFact
;
name
:
"
RC_MAP_RETURN_SW
"
;
onFactMissing
:
showMissingFactOverlay
(
name
)
}
QGCPalette
{
id
:
qgcPal
;
colorGroupEnabled
:
enabled
}
FactPanelController
{
id
:
controller
;
factPanel
:
panel
}
property
Fact
modeSwFact
:
controller
.
getParameterFact
(
-
1
,
"
RC_MAP_MODE_SW
"
)
property
Fact
posCtlSwFact
:
controller
.
getParameterFact
(
-
1
,
"
RC_MAP_POSCTL_SW
"
)
property
Fact
loiterSwFact
:
controller
.
getParameterFact
(
-
1
,
"
RC_MAP_LOITER_SW
"
)
property
Fact
returnSwFact
:
controller
.
getParameterFact
(
-
1
,
"
RC_MAP_RETURN_SW
"
)
Column
{
anchors.fill
:
parent
...
...
src/AutoPilotPlugins/PX4/PX4AutoPilotPlugin.cc
View file @
6261e761
...
...
@@ -249,7 +249,7 @@ void PX4AutoPilotPlugin::_pluginReadyPreChecks(void)
// Check for older parameter version set
// FIXME: Firmware is moving to version stamp parameter set. Once that is complete the version stamp
// should be used instead.
if
(
parameterExists
(
"SENS_GYRO_XOFF"
))
{
if
(
parameterExists
(
FactSystem
::
defaultComponentId
,
"SENS_GYRO_XOFF"
))
{
_incorrectParameterVersion
=
true
;
QGCMessageBox
::
warning
(
"Setup"
,
"This version of GroundControl can only perform vehicle setup on a newer version of firmware. "
"Please perform a Firmware Upgrade if you wish to use Vehicle Setup."
);
...
...
src/AutoPilotPlugins/PX4/PX4Component.cc
View file @
6261e761
...
...
@@ -39,7 +39,7 @@ void PX4Component::setupTriggerSignals(void)
{
// Watch for changed on trigger list params
foreach
(
QString
paramName
,
setupCompleteChangedTriggerList
())
{
Fact
*
fact
=
_autopilot
->
getParameterFact
(
paramName
);
Fact
*
fact
=
_autopilot
->
getParameterFact
(
FactSystem
::
defaultComponentId
,
paramName
);
connect
(
fact
,
&
Fact
::
valueChanged
,
this
,
&
PX4Component
::
_triggerUpdated
);
}
...
...
src/AutoPilotPlugins/PX4/PowerComponent.cc
View file @
6261e761
...
...
@@ -58,9 +58,9 @@ bool PowerComponent::requiresSetup(void) const
bool
PowerComponent
::
setupComplete
(
void
)
const
{
QVariant
cvalue
,
evalue
,
nvalue
;
return
_autopilot
->
getParameterFact
(
"BAT_V_CHARGED"
)
->
value
().
toFloat
()
!=
0.0
f
&&
_autopilot
->
getParameterFact
(
"BAT_V_EMPTY"
)
->
value
().
toFloat
()
!=
0.0
f
&&
_autopilot
->
getParameterFact
(
"BAT_N_CELLS"
)
->
value
().
toInt
()
!=
0
;
return
_autopilot
->
getParameterFact
(
FactSystem
::
defaultComponentId
,
"BAT_V_CHARGED"
)
->
value
().
toFloat
()
!=
0.0
f
&&
_autopilot
->
getParameterFact
(
FactSystem
::
defaultComponentId
,
"BAT_V_EMPTY"
)
->
value
().
toFloat
()
!=
0.0
f
&&
_autopilot
->
getParameterFact
(
FactSystem
::
defaultComponentId
,
"BAT_N_CELLS"
)
->
value
().
toInt
()
!=
0
;
}
QString
PowerComponent
::
setupStateDescription
(
void
)
const
...
...
src/AutoPilotPlugins/PX4/PowerComponent.qml
View file @
6261e761
...
...
@@ -55,9 +55,10 @@ QGCView {
property
int
firstColumnWidth
:
220
property
int
textEditWidth
:
80
property
Fact
battNumCells
:
Fact
{
name
:
"
BAT_N_CELLS
"
;
onFactMissing
:
showMissingFactOverlay
(
name
)
}
property
Fact
battHighVolt
:
Fact
{
name
:
"
BAT_V_CHARGED
"
;
onFactMissing
:
showMissingFactOverlay
(
name
)
}
property
Fact
battLowVolt
:
Fact
{
name
:
"
BAT_V_EMPTY
"
;
onFactMissing
:
showMissingFactOverlay
(
name
)
}
property
Fact
battNumCells
:
controller
.
getParameterFact
(
-
1
,
"
BAT_N_CELLS
"
)
property
Fact
battHighVolt
:
controller
.
getParameterFact
(
-
1
,
"
BAT_V_CHARGED
"
)
property
Fact
battLowVolt
:
controller
.
getParameterFact
(
-
1
,
"
BAT_V_EMPTY
"
)
property
Fact
battVoltLoadDrop
:
controller
.
getParameterFact
(
-
1
,
"
BAT_V_LOAD_DROP
"
)
property
alias
battHigh
:
battHighRow
property
alias
battLow
:
battLowRow
...
...
@@ -150,7 +151,7 @@ QGCView {
FactTextField
{
id
:
cellsField
width
:
textEditWidth
fact
:
Fact
{
name
:
"
BAT_N_CELLS
"
;
onFactMissing
:
showMissingFactOverlay
(
name
)
}
fact
:
battNumCells
showUnits
:
true
}
}
...
...
@@ -161,7 +162,7 @@ QGCView {
FactTextField
{
id
:
battHighField
width
:
textEditWidth
fact
:
Fact
{
name
:
"
BAT_V_CHARGED
"
;
onFactMissing
:
showMissingFactOverlay
(
name
)
}
fact
:
battHighVolt
showUnits
:
true
}
}
...
...
@@ -172,7 +173,7 @@ QGCView {
FactTextField
{
id
:
battLowField
width
:
textEditWidth
fact
:
Fact
{
name
:
"
BAT_V_EMPTY
"
;
onFactMissing
:
showMissingFactOverlay
(
name
)
}
fact
:
battLowVolt
showUnits
:
true
}
}
...
...
@@ -332,7 +333,7 @@ QGCView {
FactTextField
{
id
:
battDropField
width
:
textEditWidth
fact
:
Fact
{
name
:
"
BAT_V_LOAD_DROP
"
;
onFactMissing
:
showMissingFactOverlay
(
name
)
}
fact
:
battVoltLoadDrop
showUnits
:
true
}
}
...
...
src/AutoPilotPlugins/PX4/PowerComponentSummary.qml
View file @
6261e761
...
...
@@ -31,13 +31,19 @@ import QtQuick.Controls 1.2
import
QGroundControl
.
FactSystem
1.0
import
QGroundControl
.
FactControls
1.0
import
QGroundControl
.
Controls
1.0
import
QGroundControl
.
Palette
1.0
FactPanel
{
id
:
panel
anchors.fill
:
parent
color
:
qgcPal
.
windowShadeDark
Fact
{
id
:
batVChargedFact
;
name
:
"
BAT_V_CHARGED
"
;
onFactMissing
:
showMissingFactOverlay
(
name
)
}
Fact
{
id
:
batVEmptyFact
;
name
:
"
BAT_V_EMPTY
"
;
onFactMissing
:
showMissingFactOverlay
(
name
)
}
Fact
{
id
:
batCellsFact
;
name
:
"
BAT_N_CELLS
"
;
onFactMissing
:
showMissingFactOverlay
(
name
)
}
QGCPalette
{
id
:
qgcPal
;
colorGroupEnabled
:
enabled
}
FactPanelController
{
id
:
controller
;
factPanel
:
panel
}
property
Fact
batVChargedFact
:
controller
.
getParameterFact
(
-
1
,
"
BAT_V_CHARGED
"
)
property
Fact
batVEmptyFact
:
controller
.
getParameterFact
(
-
1
,
"
BAT_V_EMPTY
"
)
property
Fact
batCellsFact
:
controller
.
getParameterFact
(
-
1
,
"
BAT_N_CELLS
"
)
Column
{
anchors.fill
:
parent
...
...
src/AutoPilotPlugins/PX4/RadioComponent.cc
View file @
6261e761
...
...
@@ -62,7 +62,7 @@ bool RadioComponent::setupComplete(void) const
QStringList
attitudeMappings
;
attitudeMappings
<<
"RC_MAP_ROLL"
<<
"RC_MAP_PITCH"
<<
"RC_MAP_YAW"
<<
"RC_MAP_THROTTLE"
;
foreach
(
QString
mapParam
,
attitudeMappings
)
{
if
(
_autopilot
->
getParameterFact
(
mapParam
)
->
value
().
toInt
()
==
0
)
{
if
(
_autopilot
->
getParameterFact
(
FactSystem
::
defaultComponentId
,
mapParam
)
->
value
().
toInt
()
==
0
)
{
return
false
;
}
}
...
...
@@ -80,13 +80,13 @@ bool RadioComponent::setupComplete(void) const
QString
param
;
param
=
QString
(
"RC%1_MIN"
).
arg
(
i
);
rcMin
=
_autopilot
->
getParameterFact
(
param
)
->
value
().
toInt
();
rcMin
=
_autopilot
->
getParameterFact
(
FactSystem
::
defaultComponentId
,
param
)
->
value
().
toInt
();
param
=
QString
(
"RC%1_MAX"
).
arg
(
i
);
rcMax
=
_autopilot
->
getParameterFact
(
param
)
->
value
().
toInt
();
rcMax
=
_autopilot
->
getParameterFact
(
FactSystem
::
defaultComponentId
,
param
)
->
value
().
toInt
();
param
=
QString
(
"RC%1_TRIM"
).
arg
(
i
);
rcTrim
=
_autopilot
->
getParameterFact
(
param
)
->
value
().
toInt
();
rcTrim
=
_autopilot
->
getParameterFact
(
FactSystem
::
defaultComponentId
,
param
)
->
value
().
toInt
();
if
(
rcMin
==
rcMinDefault
&&
rcMax
==
rcMaxDefault
&&
rcTrim
==
rcTrimDefault
)
{
return
false
;
...
...
src/AutoPilotPlugins/PX4/RadioComponentSummary.qml
View file @
6261e761
...
...
@@ -4,17 +4,23 @@ import QtQuick.Controls 1.2
import
QGroundControl
.
FactSystem
1.0
import
QGroundControl
.
FactControls
1.0
import
QGroundControl
.
Controls
1.0
import
QGroundControl
.
Palette
1.0
FactPanel
{
id
:
panel
anchors.fill
:
parent
color
:
qgcPal
.
windowShadeDark
Fact
{
id
:
mapRollFact
;
name
:
"
RC_MAP_ROLL
"
;
onFactMissing
:
showMissingFactOverlay
(
name
)
}
Fact
{
id
:
mapPitchFact
;
name
:
"
RC_MAP_PITCH
"
;
onFactMissing
:
showMissingFactOverlay
(
name
)
}
Fact
{
id
:
mapYawFact
;
name
:
"
RC_MAP_YAW
"
;
onFactMissing
:
showMissingFactOverlay
(
name
)
}
Fact
{
id
:
mapThrottleFact
;
name
:
"
RC_MAP_THROTTLE
"
;
onFactMissing
:
showMissingFactOverlay
(
name
)
}
Fact
{
id
:
mapFlapsFact
;
name
:
"
RC_MAP_FLAPS
"
;
onFactMissing
:
showMissingFactOverlay
(
name
)
}
Fact
{
id
:
mapAux1Fact
;
name
:
"
RC_MAP_AUX1
"
;
onFactMissing
:
showMissingFactOverlay
(
name
)
}
Fact
{
id
:
mapAux2Fact
;
name
:
"
RC_MAP_AUX2
"
;
onFactMissing
:
showMissingFactOverlay
(
name
)
}
QGCPalette
{
id
:
qgcPal
;
colorGroupEnabled
:
enabled
}
FactPanelController
{
id
:
controller
;
factPanel
:
panel
}
property
Fact
mapRollFact
:
controller
.
getParameterFact
(
-
1
,
"
RC_MAP_ROLL
"
)
property
Fact
mapPitchFact
:
controller
.
getParameterFact
(
-
1
,
"
RC_MAP_PITCH
"
)
property
Fact
mapYawFact
:
controller
.
getParameterFact
(
-
1
,
"
RC_MAP_YAW
"
)
property
Fact
mapThrottleFact
:
controller
.
getParameterFact
(
-
1
,
"
RC_MAP_THROTTLE
"
)
property
Fact
mapFlapsFact
:
controller
.
getParameterFact
(
-
1
,
"
RC_MAP_FLAPS
"
)
property
Fact
mapAux1Fact
:
controller
.
getParameterFact
(
-
1
,
"
RC_MAP_AUX1
"
)
property
Fact
mapAux2Fact
:
controller
.
getParameterFact
(
-
1
,
"
RC_MAP_AUX2
"
)
Column
{
anchors.fill
:
parent
...
...
src/AutoPilotPlugins/PX4/SafetyComponent.qml
View file @
6261e761
...
...
@@ -31,12 +31,11 @@ import QGroundControl.Palette 1.0
import
QGroundControl
.
Controls
1.0
import
QGroundControl
.
ScreenTools
1.0
Re
ctan
gl
e
{
QGCPalette
{
id
:
palette
;
colorGroupEnabled
:
true
}
Fa
ct
P
ane
l
{
id
:
panel
width
:
600
height
:
600
color
:
palette
.
window
QGCPalette
{
id
:
palette
;
colorGroupEnabled
:
true
}
FactPanelController
{
id
:
controller
;
factPanel
:
panel
}
property
int
flightLineWidth
:
2
// width of lines for flight graphic
property
int
loiterAltitudeColumnWidth
:
180
// width of loiter altitude column
...
...
@@ -53,7 +52,7 @@ Rectangle {
QGCLabel
{
text
:
"
SAFETY CONFIG
"
font.pointSize
:
ScreenTools
.
f
ontPoint
Factor
*
(
20
);
font.pointSize
:
ScreenTools
.
largeF
ontPoint
Size
}
Item
{
height
:
20
;
width
:
10
}
// spacer
...
...
@@ -61,7 +60,7 @@ Rectangle {
//-----------------------------------------------------------------
//-- Return Home Triggers
QGCLabel
{
text
:
"
Triggers For Return Home
"
;
color
:
palette
.
text
;
font.pointSize
:
ScreenTools
.
f
ontPoint
Factor
*
(
20
)
;
}
QGCLabel
{
text
:
"
Triggers For Return Home
"
;
font.pointSize
:
ScreenTools
.
mediumF
ontPoint
Size
;
}
Item
{
height
:
10
;
width
:
10
}
// spacer
...
...
@@ -85,7 +84,7 @@ Rectangle {
QGCLabel
{
text
:
"
Return Home after
"
;
anchors.baseline
:
rcLossField
.
baseline
}
FactTextField
{
id
:
rcLossField
fact
:
Fact
{
name
:
"
COM_RC_LOSS_T
"
}
fact
:
controller
.
getParameterFact
(
-
1
,
"
COM_RC_LOSS_T
"
)
showUnits
:
true
}
}
...
...
@@ -94,17 +93,17 @@ Rectangle {
spacing
:
10
FactCheckBox
{
id
:
telemetryTimeoutCheckbox
fact
:
Fact
{
name
:
"
COM_DL_LOSS_EN
"
}
anchors.baseline
:
telemetryLossField
.
baseline
width
:
firstColumnWidth
fact
:
controller
.
getParameterFact
(
-
1
,
"
COM_DL_LOSS_EN
"
)
checkedValue
:
1
uncheckedValue
:
0
text
:
"
Telemetry Signal Timeout
"
anchors.baseline
:
telemetryLossField
.
baseline
width
:
firstColumnWidth
}
QGCLabel
{
text
:
"
Return Home after
"
;
anchors.baseline
:
telemetryLossField
.
baseline
}
FactTextField
{
id
:
telemetryLossField
fact
:
Fact
{
name
:
"
COM_DL_LOSS_T
"
}
fact
:
controller
.
getParameterFact
(
-
1
,
"
COM_DL_LOSS_T
"
)
showUnits
:
true
enabled
:
telemetryTimeoutCheckbox
.
checked
}
...
...
@@ -120,7 +119,7 @@ Rectangle {
//-----------------------------------------------------------------
//-- Return Home Settings
QGCLabel
{
text
:
"
Return Home Settings
"
;
font.pointSize
:
ScreenTools
.
f
ontPoint
Factor
*
(
20
)
;
}
QGCLabel
{
text
:
"
Return Home Settings
"
;
font.pointSize
:
ScreenTools
.
mediumF
ontPoint
Size
;
}
Item
{
height
:
10
;
width
:
10
}
// spacer
...
...
@@ -149,7 +148,7 @@ Rectangle {
QGCLabel
{
text
:
"
Climb to altitude of
"
}
FactTextField
{
id
:
climbField
fact
:
Fact
{
name
:
"
RTL_RETURN_ALT
"
}
fact
:
controller
.
getParameterFact
(
-
1
,
"
RTL_RETURN_ALT
"
)
showUnits
:
true
}
}
...
...
@@ -161,16 +160,18 @@ Rectangle {
QGCCheckBox
{
id
:
homeLoiterCheckbox
property
Fact
fact
:
Fact
{
name
:
"
RTL_LAND_DELAY
"
}
checked
:
fact
.
value
>
0
text
:
"
Loiter at Home altitude for
"
property
Fact
fact
:
controller
.
getParameterFact
(
-
1
,
"
RTL_LAND_DELAY
"
)
onClicked
:
{
fact
.
value
=
checked
?
60
:
-
1
}
}
FactTextField
{
fact
:
Fact
{
name
:
"
RTL_LAND_DELAY
"
}
fact
:
controller
.
getParameterFact
(
-
1
,
"
RTL_LAND_DELAY
"
)
showUnits
:
true
enabled
:
homeLoiterCheckbox
.
checked
==
true
}
...
...
@@ -276,7 +277,7 @@ Rectangle {
}
FactTextField
{
id
:
descendField
;
fact
:
Fact
{
name
:
"
RTL_DESCEND_ALT
"
}
fact
:
controller
.
getParameterFact
(
-
1
,
"
RTL_DESCEND_ALT
"
)
enabled
:
homeLoiterCheckbox
.
checked
===
true
showUnits
:
true
}
...
...
@@ -288,20 +289,23 @@ Rectangle {
}
QGCLabel
{
property
Fact
fact
:
Fact
{
name
:
"
NAV_RCL_OBC
"
}
width
:
parent
.
width
font.pointSize
:
ScreenTools
.
f
ontPoint
Factor
*
(
14
);
font.pointSize
:
ScreenTools
.
mediumF
ontPoint
Size
text
:
"
Warning: You have an advanced safety configuration set using the NAV_RCL_OBC parameter. The above settings may not apply.
"
;
visible
:
fact
.
value
!==
0
wrapMode
:
Text
.
Wrap
property
Fact
fact
:
controller
.
getParameterFact
(
-
1
,
"
NAV_RCL_OBC
"
)
}
QGCLabel
{
property
Fact
fact
:
Fact
{
name
:
"
NAV_DLL_OBC
"
}
width
:
parent
.
width
font.pointSize
:
ScreenTools
.
f
ontPoint
Factor
*
(
14
);
font.pointSize
:
ScreenTools
.
mediumF
ontPoint
Size
text
:
"
Warning: You have an advanced safety configuration set using the NAV_DLL_OBC parameter. The above settings may not apply.
"
;
visible
:
fact
.
value
!==
0
wrapMode
:
Text
.
Wrap
property
Fact
fact
:
controller
.
getParameterFact
(
-
1
,
"
NAV_DLL_OBC
"
)
}
}
}
Prev
1
2
3
Next
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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