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
d2cc809e
Commit
d2cc809e
authored
Dec 25, 2014
by
Don Gagne
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1146 from DonLakeFlyer/Setup
Setup work
parents
1d5a457a
e3acbf3b
Changes
17
Hide whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
128 additions
and
38 deletions
+128
-38
AirframeComponent.cc
src/AutoPilotPlugins/PX4/AirframeComponent.cc
+5
-0
AirframeComponent.h
src/AutoPilotPlugins/PX4/AirframeComponent.h
+2
-1
FlightModeConfig.cc
src/AutoPilotPlugins/PX4/FlightModeConfig.cc
+0
-6
FlightModesComponent.cc
src/AutoPilotPlugins/PX4/FlightModesComponent.cc
+15
-0
FlightModesComponent.h
src/AutoPilotPlugins/PX4/FlightModesComponent.h
+1
-0
PX4AutoPilotPlugin.cc
src/AutoPilotPlugins/PX4/PX4AutoPilotPlugin.cc
+21
-24
PX4AutoPilotPlugin.h
src/AutoPilotPlugins/PX4/PX4AutoPilotPlugin.h
+20
-3
PX4Component.cc
src/AutoPilotPlugins/PX4/PX4Component.cc
+1
-1
RadioComponent.cc
src/AutoPilotPlugins/PX4/RadioComponent.cc
+13
-0
RadioComponent.h
src/AutoPilotPlugins/PX4/RadioComponent.h
+1
-0
SafetyComponent.cc
src/AutoPilotPlugins/PX4/SafetyComponent.cc
+13
-0
SafetyComponent.h
src/AutoPilotPlugins/PX4/SafetyComponent.h
+1
-0
SensorsComponent.cc
src/AutoPilotPlugins/PX4/SensorsComponent.cc
+13
-0
SensorsComponent.h
src/AutoPilotPlugins/PX4/SensorsComponent.h
+1
-0
SetupView.cc
src/VehicleSetup/SetupView.cc
+17
-0
VehicleComponent.h
src/VehicleSetup/VehicleComponent.h
+3
-1
UASParameterDataModel.cc
src/uas/UASParameterDataModel.cc
+1
-2
No files found.
src/AutoPilotPlugins/PX4/AirframeComponent.cc
View file @
d2cc809e
...
...
@@ -169,3 +169,8 @@ QUrl AirframeComponent::summaryQmlSource(void) const
{
return
QUrl
::
fromUserInput
(
"qrc:/qml/AirframeComponentSummary.qml"
);
}
QString
AirframeComponent
::
prerequisiteSetup
(
void
)
const
{
return
QString
();
}
src/AutoPilotPlugins/PX4/AirframeComponent.h
View file @
d2cc809e
...
...
@@ -49,7 +49,8 @@ public:
virtual
QString
setupStateDescription
(
void
)
const
;
virtual
QWidget
*
setupWidget
(
void
)
const
;
virtual
QStringList
paramFilterList
(
void
)
const
;
virtual
QUrl
summaryQmlSource
(
void
)
const
;
virtual
QUrl
summaryQmlSource
(
void
)
const
;
virtual
QString
prerequisiteSetup
(
void
)
const
;
private:
const
QString
_name
;
...
...
src/AutoPilotPlugins/PX4/FlightModeConfig.cc
View file @
d2cc809e
...
...
@@ -104,12 +104,6 @@ void FlightModeConfig::_initUi(void) {
}
_updateAllSwitches
();
// Finally if RC Calibration has not been performed disable the entire widget and inform user
if
(
_getChannelMapForParam
(
_modeSwitchParam
)
==
0
)
{
// FIXME: Do something more than disable
setEnabled
(
false
);
}
}
void
FlightModeConfig
::
_updateAllSwitches
(
void
)
...
...
src/AutoPilotPlugins/PX4/FlightModesComponent.cc
View file @
d2cc809e
...
...
@@ -27,6 +27,7 @@
#include "FlightModesComponent.h"
#include "FlightModeConfig.h"
#include "VehicleComponentSummaryItem.h"
#include "PX4AutoPilotPlugin.h"
/// @brief Parameters which signal a change in setupComplete state
static
const
char
*
triggerParams
[]
=
{
"RC_MAP_MODE_SW"
,
NULL
};
...
...
@@ -121,3 +122,17 @@ QUrl FlightModesComponent::summaryQmlSource(void) const
{
return
QUrl
::
fromUserInput
(
"qrc:/qml/FlightModesComponentSummary.qml"
);
}
QString
FlightModesComponent
::
prerequisiteSetup
(
void
)
const
{
PX4AutoPilotPlugin
*
plugin
=
dynamic_cast
<
PX4AutoPilotPlugin
*>
(
_autopilot
);
Q_ASSERT
(
plugin
);
if
(
!
plugin
->
airframeComponent
()
->
setupComplete
())
{
return
plugin
->
airframeComponent
()
->
name
();
}
else
if
(
!
plugin
->
radioComponent
()
->
setupComplete
())
{
return
plugin
->
radioComponent
()
->
name
();
}
return
QString
();
}
src/AutoPilotPlugins/PX4/FlightModesComponent.h
View file @
d2cc809e
...
...
@@ -50,6 +50,7 @@ public:
virtual
QWidget
*
setupWidget
(
void
)
const
;
virtual
QStringList
paramFilterList
(
void
)
const
;
virtual
QUrl
summaryQmlSource
(
void
)
const
;
virtual
QString
prerequisiteSetup
(
void
)
const
;
private:
const
QString
_name
;
...
...
src/AutoPilotPlugins/PX4/PX4AutoPilotPlugin.cc
View file @
d2cc809e
...
...
@@ -22,11 +22,6 @@
======================================================================*/
#include "PX4AutoPilotPlugin.h"
#include "AirframeComponent.h"
#include "RadioComponent.h"
#include "SensorsComponent.h"
#include "FlightModesComponent.h"
#include "SafetyComponent.h"
#include "AutoPilotPluginManager.h"
#include "UASManager.h"
#include "QGCUASParamManagerInterface.h"
...
...
@@ -36,7 +31,6 @@
/// @brief This is the AutoPilotPlugin implementatin for the MAV_AUTOPILOT_PX4 type.
/// @author Don Gagne <don@thegagnes.com>
enum
PX4_CUSTOM_MAIN_MODE
{
PX4_CUSTOM_MAIN_MODE_MANUAL
=
1
,
PX4_CUSTOM_MAIN_MODE_ALTCTL
,
...
...
@@ -69,7 +63,12 @@ union px4_custom_mode {
PX4AutoPilotPlugin
::
PX4AutoPilotPlugin
(
UASInterface
*
uas
,
QObject
*
parent
)
:
AutoPilotPlugin
(
parent
),
_uas
(
uas
),
_parameterFacts
(
NULL
)
_parameterFacts
(
NULL
),
_airframeComponent
(
NULL
),
_radioComponent
(
NULL
),
_flightModesComponent
(
NULL
),
_sensorsComponent
(
NULL
),
_safetyComponent
(
NULL
)
{
Q_ASSERT
(
uas
);
...
...
@@ -193,29 +192,27 @@ bool PX4AutoPilotPlugin::pluginIsReady(void) const
const
QVariantList
&
PX4AutoPilotPlugin
::
components
(
void
)
{
if
(
_components
.
count
()
==
0
)
{
VehicleComponent
*
component
;
Q_ASSERT
(
_uas
);
c
omponent
=
new
AirframeComponent
(
_uas
,
this
);
Q_CHECK_PTR
(
c
omponent
);
_components
.
append
(
QVariant
::
fromValue
(
c
omponent
));
_airframeC
omponent
=
new
AirframeComponent
(
_uas
,
this
);
Q_CHECK_PTR
(
_airframeC
omponent
);
_components
.
append
(
QVariant
::
fromValue
(
(
VehicleComponent
*
)
_airframeC
omponent
));
c
omponent
=
new
RadioComponent
(
_uas
,
this
);
Q_CHECK_PTR
(
c
omponent
);
_components
.
append
(
QVariant
::
fromValue
(
c
omponent
));
_radioC
omponent
=
new
RadioComponent
(
_uas
,
this
);
Q_CHECK_PTR
(
_radioC
omponent
);
_components
.
append
(
QVariant
::
fromValue
(
(
VehicleComponent
*
)
_radioC
omponent
));
c
omponent
=
new
FlightModesComponent
(
_uas
,
this
);
Q_CHECK_PTR
(
c
omponent
);
_components
.
append
(
QVariant
::
fromValue
(
c
omponent
));
_flightModesC
omponent
=
new
FlightModesComponent
(
_uas
,
this
);
Q_CHECK_PTR
(
_flightModesC
omponent
);
_components
.
append
(
QVariant
::
fromValue
(
(
VehicleComponent
*
)
_flightModesC
omponent
));
c
omponent
=
new
SensorsComponent
(
_uas
,
this
);
Q_CHECK_PTR
(
c
omponent
);
_components
.
append
(
QVariant
::
fromValue
(
c
omponent
));
_sensorsC
omponent
=
new
SensorsComponent
(
_uas
,
this
);
Q_CHECK_PTR
(
_sensorsC
omponent
);
_components
.
append
(
QVariant
::
fromValue
(
(
VehicleComponent
*
)
_sensorsC
omponent
));
c
omponent
=
new
SafetyComponent
(
_uas
,
this
);
Q_CHECK_PTR
(
c
omponent
);
_components
.
append
(
QVariant
::
fromValue
(
c
omponent
));
_safetyC
omponent
=
new
SafetyComponent
(
_uas
,
this
);
Q_CHECK_PTR
(
_safetyC
omponent
);
_components
.
append
(
QVariant
::
fromValue
(
(
VehicleComponent
*
)
_safetyC
omponent
));
}
return
_components
;
...
...
src/AutoPilotPlugins/PX4/PX4AutoPilotPlugin.h
View file @
d2cc809e
...
...
@@ -28,6 +28,11 @@
#include "AutoPilotPluginManager.h"
#include "UASInterface.h"
#include "PX4ParameterFacts.h"
#include "AirframeComponent.h"
#include "RadioComponent.h"
#include "FlightModesComponent.h"
#include "SensorsComponent.h"
#include "SafetyComponent.h"
#include <QImage>
...
...
@@ -53,10 +58,22 @@ public:
static
QString
getShortModeText
(
uint8_t
baseMode
,
uint32_t
customMode
);
static
void
clearStaticData
(
void
);
// These methods should only be used by objects within the plugin
AirframeComponent
*
airframeComponent
(
void
)
{
return
_airframeComponent
;
}
RadioComponent
*
radioComponent
(
void
)
{
return
_radioComponent
;
}
FlightModesComponent
*
flightModesComponent
(
void
)
{
return
_flightModesComponent
;
}
SensorsComponent
*
sensorsComponent
(
void
)
{
return
_sensorsComponent
;
}
SafetyComponent
*
safetyComponent
(
void
)
{
return
_safetyComponent
;
}
private:
UASInterface
*
_uas
;
PX4ParameterFacts
*
_parameterFacts
;
QVariantList
_components
;
UASInterface
*
_uas
;
PX4ParameterFacts
*
_parameterFacts
;
QVariantList
_components
;
AirframeComponent
*
_airframeComponent
;
RadioComponent
*
_radioComponent
;
FlightModesComponent
*
_flightModesComponent
;
SensorsComponent
*
_sensorsComponent
;
SafetyComponent
*
_safetyComponent
;
};
#endif
src/AutoPilotPlugins/PX4/PX4Component.cc
View file @
d2cc809e
...
...
@@ -44,7 +44,7 @@ void PX4Component::_parameterUpdated(int compId, QString paramName, QVariant val
while
(
*
prgTriggers
!=
NULL
)
{
if
(
paramName
==
*
prgTriggers
)
{
emit
setupCompleteChanged
();
emit
setupCompleteChanged
(
setupComplete
()
);
return
;
}
prgTriggers
++
;
...
...
src/AutoPilotPlugins/PX4/RadioComponent.cc
View file @
d2cc809e
...
...
@@ -27,6 +27,7 @@
#include "RadioComponent.h"
#include "PX4RCCalibration.h"
#include "VehicleComponentSummaryItem.h"
#include "PX4AutoPilotPlugin.h"
/// @brief Parameters which signal a change in setupComplete state
static
const
char
*
triggerParams
[]
=
{
"RC_MAP_MODE_SW"
,
NULL
};
...
...
@@ -105,3 +106,15 @@ QUrl RadioComponent::summaryQmlSource(void) const
{
return
QUrl
::
fromUserInput
(
"qrc:/qml/RadioComponentSummary.qml"
);
}
QString
RadioComponent
::
prerequisiteSetup
(
void
)
const
{
PX4AutoPilotPlugin
*
plugin
=
dynamic_cast
<
PX4AutoPilotPlugin
*>
(
_autopilot
);
Q_ASSERT
(
plugin
);
if
(
!
plugin
->
airframeComponent
()
->
setupComplete
())
{
return
plugin
->
airframeComponent
()
->
name
();
}
return
QString
();
}
src/AutoPilotPlugins/PX4/RadioComponent.h
View file @
d2cc809e
...
...
@@ -51,6 +51,7 @@ public:
virtual
QWidget
*
setupWidget
(
void
)
const
;
virtual
QStringList
paramFilterList
(
void
)
const
;
virtual
QUrl
summaryQmlSource
(
void
)
const
;
virtual
QString
prerequisiteSetup
(
void
)
const
;
private:
const
QString
_name
;
...
...
src/AutoPilotPlugins/PX4/SafetyComponent.cc
View file @
d2cc809e
...
...
@@ -28,6 +28,7 @@
#include "PX4RCCalibration.h"
#include "VehicleComponentSummaryItem.h"
#include "QGCQmlWidgetHolder.h"
#include "PX4AutoPilotPlugin.h"
/// @brief Parameters which signal a change in setupComplete state
static
const
char
*
triggerParams
[]
=
{
NULL
};
...
...
@@ -104,3 +105,15 @@ QUrl SafetyComponent::summaryQmlSource(void) const
{
return
QUrl
::
fromUserInput
(
"qrc:/qml/SafetyComponentSummary.qml"
);
}
QString
SafetyComponent
::
prerequisiteSetup
(
void
)
const
{
PX4AutoPilotPlugin
*
plugin
=
dynamic_cast
<
PX4AutoPilotPlugin
*>
(
_autopilot
);
Q_ASSERT
(
plugin
);
if
(
!
plugin
->
airframeComponent
()
->
setupComplete
())
{
return
plugin
->
airframeComponent
()
->
name
();
}
return
QString
();
}
src/AutoPilotPlugins/PX4/SafetyComponent.h
View file @
d2cc809e
...
...
@@ -51,6 +51,7 @@ public:
virtual
QWidget
*
setupWidget
(
void
)
const
;
virtual
QStringList
paramFilterList
(
void
)
const
;
virtual
QUrl
summaryQmlSource
(
void
)
const
;
virtual
QString
prerequisiteSetup
(
void
)
const
;
private:
const
QString
_name
;
...
...
src/AutoPilotPlugins/PX4/SensorsComponent.cc
View file @
d2cc809e
...
...
@@ -27,6 +27,7 @@
#include "SensorsComponent.h"
#include "QGCPX4SensorCalibration.h"
#include "VehicleComponentSummaryItem.h"
#include "PX4AutoPilotPlugin.h"
// These two list must be kept in sync
...
...
@@ -118,3 +119,15 @@ QUrl SensorsComponent::summaryQmlSource(void) const
{
return
QUrl
::
fromUserInput
(
"qrc:/qml/SensorsComponentSummary.qml"
);
}
QString
SensorsComponent
::
prerequisiteSetup
(
void
)
const
{
PX4AutoPilotPlugin
*
plugin
=
dynamic_cast
<
PX4AutoPilotPlugin
*>
(
_autopilot
);
Q_ASSERT
(
plugin
);
if
(
!
plugin
->
airframeComponent
()
->
setupComplete
())
{
return
plugin
->
airframeComponent
()
->
name
();
}
return
QString
();
}
src/AutoPilotPlugins/PX4/SensorsComponent.h
View file @
d2cc809e
...
...
@@ -50,6 +50,7 @@ public:
virtual
QWidget
*
setupWidget
(
void
)
const
;
virtual
QStringList
paramFilterList
(
void
)
const
;
virtual
QUrl
summaryQmlSource
(
void
)
const
;
virtual
QString
prerequisiteSetup
(
void
)
const
;
private:
const
QString
_name
;
...
...
src/VehicleSetup/SetupView.cc
View file @
d2cc809e
...
...
@@ -33,6 +33,7 @@
#include "ParameterEditor.h"
#include "SetupWidgetHolder.h"
#include "MainWindow.h"
#include "QGCMessageBox.h"
#include <QQmlError>
#include <QQmlContext>
...
...
@@ -117,6 +118,11 @@ void SetupView::_setConnectedView(void)
void
SetupView
::
_firmwareButtonClicked
(
void
)
{
if
(
_uasCurrent
->
isArmed
())
{
QGCMessageBox
::
warning
(
"Setup"
,
"Firmware Update cannot be performed while vehicle is armed."
);
return
;
}
SetupWidgetHolder
*
dialog
=
new
SetupWidgetHolder
(
MainWindow
::
instance
());
dialog
->
setModal
(
true
);
dialog
->
setWindowTitle
(
"Firmware Upgrade"
);
...
...
@@ -139,9 +145,20 @@ void SetupView::_parametersButtonClicked(void)
void
SetupView
::
_setupButtonClicked
(
const
QVariant
&
component
)
{
if
(
_uasCurrent
->
isArmed
())
{
QGCMessageBox
::
warning
(
"Setup"
,
"Setup cannot be performed while vehicle is armed."
);
return
;
}
VehicleComponent
*
vehicle
=
qobject_cast
<
VehicleComponent
*>
(
component
.
value
<
QObject
*>
());
Q_ASSERT
(
vehicle
);
QString
setupPrereq
=
vehicle
->
prerequisiteSetup
();
if
(
!
setupPrereq
.
isEmpty
())
{
QGCMessageBox
::
warning
(
"Setup"
,
QString
(
"%1 setup must be completed prior to %2 setup."
).
arg
(
setupPrereq
).
arg
(
vehicle
->
name
()));
return
;
}
SetupWidgetHolder
dialog
(
MainWindow
::
instance
());
dialog
.
setModal
(
true
);
dialog
.
setWindowTitle
(
vehicle
->
name
());
...
...
src/VehicleSetup/VehicleComponent.h
View file @
d2cc809e
...
...
@@ -50,6 +50,7 @@ class VehicleComponent : public QObject
Q_PROPERTY
(
QString
icon
READ
icon
CONSTANT
)
Q_PROPERTY
(
QWidget
*
setupWidget
READ
setupWidget
STORED
false
)
Q_PROPERTY
(
QUrl
summaryQmlSource
READ
summaryQmlSource
CONSTANT
);
Q_PROPERTY
(
QString
prerequisiteSetup
READ
prerequisiteSetup
)
public:
VehicleComponent
(
UASInterface
*
uas
,
AutoPilotPlugin
*
autopilot
,
QObject
*
parent
=
NULL
);
...
...
@@ -64,11 +65,12 @@ public:
virtual
QWidget
*
setupWidget
(
void
)
const
=
0
;
virtual
QStringList
paramFilterList
(
void
)
const
=
0
;
virtual
QUrl
summaryQmlSource
(
void
)
const
=
0
;
virtual
QString
prerequisiteSetup
(
void
)
const
=
0
;
virtual
void
addSummaryQmlComponent
(
QQmlContext
*
context
,
QQuickItem
*
parent
);
signals:
void
setupCompleteChanged
(
void
);
void
setupCompleteChanged
(
bool
setupComplete
);
protected:
UASInterface
*
_uas
;
...
...
src/uas/UASParameterDataModel.cc
View file @
d2cc809e
...
...
@@ -184,9 +184,8 @@ void UASParameterDataModel::handleParamUpdate(int compId, const QString ¶mNa
}
}
emit
parameterUpdated
(
compId
,
paramName
,
value
);
setOnboardParam
(
compId
,
paramName
,
value
);
emit
parameterUpdated
(
compId
,
paramName
,
value
);
}
bool
UASParameterDataModel
::
getOnboardParamValue
(
int
componentId
,
const
QString
&
key
,
QVariant
&
value
)
const
...
...
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