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
006b4d36
Commit
006b4d36
authored
Nov 16, 2014
by
Don Gagne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
New AutoPilotPlugin and VehicleSetup
parent
c9a43c9c
Changes
33
Hide whitespace changes
Inline
Side-by-side
Showing
33 changed files
with
2880 additions
and
10 deletions
+2880
-10
style-dark.css
files/styles/style-dark.css
+1
-3
qgroundcontrol.pro
qgroundcontrol.pro
+44
-7
AutoPilotPlugin.cc
src/AutoPilotPlugins/AutoPilotPlugin.cc
+56
-0
AutoPilotPlugin.h
src/AutoPilotPlugins/AutoPilotPlugin.h
+69
-0
GenericAutoPilotPlugin.cc
src/AutoPilotPlugins/Generic/GenericAutoPilotPlugin.cc
+86
-0
GenericAutoPilotPlugin.h
src/AutoPilotPlugins/Generic/GenericAutoPilotPlugin.h
+46
-0
AirframeComponent.cc
src/AutoPilotPlugins/PX4/AirframeComponent.cc
+216
-0
AirframeComponent.h
src/AutoPilotPlugins/PX4/AirframeComponent.h
+58
-0
FlightModesComponent.cc
src/AutoPilotPlugins/PX4/FlightModesComponent.cc
+164
-0
FlightModesComponent.h
src/AutoPilotPlugins/PX4/FlightModesComponent.h
+58
-0
PX4AutoPilotPlugin.cc
src/AutoPilotPlugins/PX4/PX4AutoPilotPlugin.cc
+172
-0
PX4AutoPilotPlugin.h
src/AutoPilotPlugins/PX4/PX4AutoPilotPlugin.h
+45
-0
PX4Component.cc
src/AutoPilotPlugins/PX4/PX4Component.cc
+53
-0
PX4Component.h
src/AutoPilotPlugins/PX4/PX4Component.h
+51
-0
RadioComponent.cc
src/AutoPilotPlugins/PX4/RadioComponent.cc
+147
-0
RadioComponent.h
src/AutoPilotPlugins/PX4/RadioComponent.h
+59
-0
SensorsComponent.cc
src/AutoPilotPlugins/PX4/SensorsComponent.cc
+221
-0
SensorsComponent.h
src/AutoPilotPlugins/PX4/SensorsComponent.h
+58
-0
ParameterEditor.cc
src/VehicleSetup/ParameterEditor.cc
+46
-0
ParameterEditor.h
src/VehicleSetup/ParameterEditor.h
+51
-0
ParameterEditor.ui
src/VehicleSetup/ParameterEditor.ui
+185
-0
SetupView.cc
src/VehicleSetup/SetupView.cc
+271
-0
SetupView.h
src/VehicleSetup/SetupView.h
+73
-0
SetupView.ui
src/VehicleSetup/SetupView.ui
+148
-0
SummaryPage.cc
src/VehicleSetup/SummaryPage.cc
+92
-0
SummaryPage.h
src/VehicleSetup/SummaryPage.h
+53
-0
SummaryPage.ui
src/VehicleSetup/SummaryPage.ui
+26
-0
VehicleComponent.cc
src/VehicleSetup/VehicleComponent.cc
+40
-0
VehicleComponent.h
src/VehicleSetup/VehicleComponent.h
+70
-0
VehicleComponentButton.h
src/VehicleSetup/VehicleComponentButton.h
+54
-0
VehicleSetupButton.h
src/VehicleSetup/VehicleSetupButton.h
+42
-0
VehicleSetupButtonList.qml
src/VehicleSetup/VehicleSetupButtonList.qml
+79
-0
VehicleSetupSummary.qml
src/VehicleSetup/VehicleSetupSummary.qml
+46
-0
No files found.
files/styles/style-dark.css
View file @
006b4d36
...
...
@@ -414,9 +414,7 @@ QPushButton, QToolButton {
background-color
:
qlineargradient
(
x1
:
0
,
y1
:
0
,
x2
:
0
,
y2
:
1
,
stop
:
0
#777
,
stop
:
1
#333
);
}
QPushButton
#advancedMenuButton
,
QPushButton
#airframeMenuButton
,
QPushButton
#firmwareMenuButton
,
QPushButton
#tuningMenuButton
,
QPushButton
#rcMenuButton
,
QPushButton
#sensorMenuButton
,
QPushButton
#flightModeMenuButton
,
QPushButton
#safetyConfigButton
{
VehicleSetupButton
,
VehicleComponentButton
{
background-color
:
qlineargradient
(
x1
:
0
,
y1
:
0
,
x2
:
0
,
y2
:
1
,
stop
:
0
#333
,
stop
:
1
#111
);
border-radius
:
5px
;
min-height
:
64px
;
...
...
qgroundcontrol.pro
View file @
006b4d36
...
...
@@ -194,6 +194,8 @@ ReleaseBuild {
}
}
#
qextserialport
should
not
be
used
by
general
QGroundControl
code
.
Use
QSerialPort
instead
.
This
is
only
#
here
to
support
special
case
Firmware
Upgrade
code
.
include
(
libs
/
qextserialport
/
src
/
qextserialport
.
pri
)
#
...
...
@@ -249,7 +251,9 @@ INCLUDEPATH += \
src
/
ui
/
designer
\
src
/
ui
/
configuration
\
src
/
ui
/
px4_configuration
\
src
/
ui
/
main
src
/
ui
/
main
\
src
/
VehicleSetup
\
src
/
AutoPilotPlugins
FORMS
+=
\
src
/
ui
/
MainWindow
.
ui
\
...
...
@@ -312,7 +316,6 @@ FORMS += \
src
/
ui
/
mission
/
QGCMissionNavSweep
.
ui
\
src
/
ui
/
mission
/
QGCMissionDoStartSearch
.
ui
\
src
/
ui
/
mission
/
QGCMissionDoFinishSearch
.
ui
\
src
/
ui
/
QGCPX4VehicleConfig
.
ui
\
src
/
ui
/
QGCHilConfiguration
.
ui
\
src
/
ui
/
QGCHilFlightGearConfiguration
.
ui
\
src
/
ui
/
QGCHilJSBSimConfiguration
.
ui
\
...
...
@@ -325,7 +328,6 @@ FORMS += \
src
/
ui
/
uas
/
QGCMessageView
.
ui
\
src
/
ui
/
JoystickButton
.
ui
\
src
/
ui
/
JoystickAxis
.
ui
\
src
/
ui
/
QGCConfigView
.
ui
\
src
/
ui
/
configuration
/
terminalconsole
.
ui
\
src
/
ui
/
configuration
/
SerialSettingsDialog
.
ui
\
src
/
ui
/
px4_configuration
/
QGCPX4AirframeConfig
.
ui
\
...
...
@@ -452,7 +454,6 @@ HEADERS += \
src
/
ui
/
mission
/
QGCMissionNavSweep
.
h
\
src
/
ui
/
mission
/
QGCMissionDoStartSearch
.
h
\
src
/
ui
/
mission
/
QGCMissionDoFinishSearch
.
h
\
src
/
ui
/
QGCPX4VehicleConfig
.
h
\
src
/
comm
/
QGCHilLink
.
h
\
src
/
ui
/
QGCHilConfiguration
.
h
\
src
/
ui
/
QGCHilFlightGearConfiguration
.
h
\
...
...
@@ -472,7 +473,6 @@ HEADERS += \
src
/
ui
/
uas
/
QGCMessageView
.
h
\
src
/
ui
/
JoystickButton
.
h
\
src
/
ui
/
JoystickAxis
.
h
\
src
/
ui
/
QGCConfigView
.
h
\
src
/
ui
/
configuration
/
console
.
h
\
src
/
ui
/
configuration
/
SerialSettingsDialog
.
h
\
src
/
ui
/
configuration
/
terminalconsole
.
h
\
...
...
@@ -608,7 +608,6 @@ SOURCES += \
src
/
ui
/
mission
/
QGCMissionNavSweep
.
cc
\
src
/
ui
/
mission
/
QGCMissionDoStartSearch
.
cc
\
src
/
ui
/
mission
/
QGCMissionDoFinishSearch
.
cc
\
src
/
ui
/
QGCPX4VehicleConfig
.
cc
\
src
/
ui
/
QGCHilConfiguration
.
cc
\
src
/
ui
/
QGCHilFlightGearConfiguration
.
cc
\
src
/
ui
/
QGCHilJSBSimConfiguration
.
cc
\
...
...
@@ -627,7 +626,6 @@ SOURCES += \
src
/
ui
/
JoystickButton
.
cc
\
src
/
ui
/
JoystickAxis
.
cc
\
src
/
ui
/
uas
/
QGCMessageView
.
cc
\
src
/
ui
/
QGCConfigView
.
cc
\
src
/
ui
/
configuration
/
terminalconsole
.
cpp
\
src
/
ui
/
configuration
/
console
.
cpp
\
src
/
ui
/
configuration
/
SerialSettingsDialog
.
cc
\
...
...
@@ -700,3 +698,42 @@ SOURCES += \
src
/
qgcunittest
/
PX4RCCalibrationTest
.
cc
}
#
#
AutoPilot
Plugin
Support
#
FORMS
+=
\
src
/
VehicleSetup
/
SetupView
.
ui
\
src
/
VehicleSetup
/
SummaryPage
.
ui
\
src
/
VehicleSetup
/
ParameterEditor
.
ui
\
src
/
ui
/
QGCPX4VehicleConfig
.
ui
HEADERS
+=
\
src
/
VehicleSetup
/
SetupView
.
h
\
src
/
VehicleSetup
/
SummaryPage
.
h
\
src
/
VehicleSetup
/
ParameterEditor
.
h
\
src
/
VehicleSetup
/
VehicleSetupButton
.
h
\
src
/
VehicleSetup
/
VehicleComponentButton
.
h
\
src
/
VehicleSetup
/
VehicleComponent
.
h
\
src
/
AutoPilotPlugins
/
AutoPilotPlugin
.
h
\
src
/
AutoPilotPlugins
/
Generic
/
GenericAutoPilotPlugin
.
h
\
src
/
AutoPilotPlugins
/
PX4
/
PX4AutoPilotPlugin
.
h
\
src
/
AutoPilotPlugins
/
PX4
/
PX4Component
.
h
\
src
/
AutoPilotPlugins
/
PX4
/
RadioComponent
.
h
\
src
/
AutoPilotPlugins
/
PX4
/
FlightModesComponent
.
h
\
src
/
AutoPilotPlugins
/
PX4
/
AirframeComponent
.
h
\
src
/
AutoPilotPlugins
/
PX4
/
SensorsComponent
.
h
SOURCES
+=
\
src
/
VehicleSetup
/
SetupView
.
cc
\
src
/
VehicleSetup
/
SummaryPage
.
cc
\
src
/
VehicleSetup
/
ParameterEditor
.
cc
\
src
/
VehicleSetup
/
VehicleComponent
.
cc
\
src
/
AutoPilotPlugins
/
AutoPilotPlugin
.
cc
\
src
/
AutoPilotPlugins
/
Generic
/
GenericAutoPilotPlugin
.
cc
\
src
/
AutoPilotPlugins
/
PX4
/
PX4AutoPilotPlugin
.
cc
\
src
/
AutoPilotPlugins
/
PX4
/
PX4Component
.
cc
\
src
/
AutoPilotPlugins
/
PX4
/
RadioComponent
.
cc
\
src
/
AutoPilotPlugins
/
PX4
/
FlightModesComponent
.
cc
\
src
/
AutoPilotPlugins
/
PX4
/
AirframeComponent
.
cc
\
src
/
AutoPilotPlugins
/
PX4
/
SensorsComponent
.
cc
src/AutoPilotPlugins/AutoPilotPlugin.cc
0 → 100644
View file @
006b4d36
/*=====================================================================
QGroundControl Open Source Ground Control Station
(c) 2009 - 2014 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
This file is part of the QGROUNDCONTROL project
QGROUNDCONTROL is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
QGROUNDCONTROL is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with QGROUNDCONTROL. If not, see <http://www.gnu.org/licenses/>.
======================================================================*/
/// @file
/// @author Don Gagne <don@thegagnes.com>
#include "AutoPilotPlugin.h"
#include "PX4/PX4AutoPilotPlugin.h"
#include "Generic/GenericAutoPilotPlugin.h"
static
AutoPilotPlugin
*
PX4_AutoPilot
=
NULL
;
///< Singleton plugin for MAV_AUTOPILOT_PX4
static
AutoPilotPlugin
*
Generic_AutoPilot
=
NULL
;
///< Singleton plugin for AutoPilots which do not have a specifically implemented plugin
AutoPilotPlugin
::
AutoPilotPlugin
(
void
)
{
}
AutoPilotPlugin
*
AutoPilotPlugin
::
getInstanceForAutoPilotPlugin
(
int
autopilotType
)
{
switch
(
autopilotType
)
{
case
MAV_AUTOPILOT_PX4
:
if
(
PX4_AutoPilot
==
NULL
)
{
PX4_AutoPilot
=
new
PX4AutoPilotPlugin
;
}
Q_ASSERT
(
PX4_AutoPilot
);
return
PX4_AutoPilot
;
default:
if
(
Generic_AutoPilot
==
NULL
)
{
Generic_AutoPilot
=
new
GenericAutoPilotPlugin
;
}
Q_ASSERT
(
Generic_AutoPilot
);
return
Generic_AutoPilot
;
}
}
src/AutoPilotPlugins/AutoPilotPlugin.h
0 → 100644
View file @
006b4d36
/*=====================================================================
QGroundControl Open Source Ground Control Station
(c) 2009 - 2014 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
This file is part of the QGROUNDCONTROL project
QGROUNDCONTROL is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
QGROUNDCONTROL is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with QGROUNDCONTROL. If not, see <http://www.gnu.org/licenses/>.
======================================================================*/
#ifndef AUTOPILOTPLUGIN_H
#define AUTOPILOTPLUGIN_H
#include <QObject>
#include <QList>
#include <QString>
#include "UASInterface.h"
#include "VehicleComponent.h"
/// @file
/// @brief The AutoPilotPlugin class is an abstract base class which represent the methods and objects
/// which are specific to a certain AutoPilot. This is the only place where AutoPilot specific
/// code should reside in QGroundControl. The remainder of the QGroundControl source is
/// generic to a common mavlink implementation.
/// @author Don Gagne <don@thegagnes.com>
class
AutoPilotPlugin
:
public
QObject
{
Q_OBJECT
public:
/// @brief Returns the singleton AutoPilot instance for the specified auto pilot type.
/// @param autopilotType Specified using the MAV_AUTOPILOT_* values.
static
AutoPilotPlugin
*
getInstanceForAutoPilotPlugin
(
int
autopilotType
);
/// @brief Returns the list of VehicleComponent objects associated with the AutoPilot.
virtual
QList
<
VehicleComponent
*>
getVehicleComponents
(
UASInterface
*
uas
)
const
=
0
;
typedef
struct
{
uint8_t
baseMode
;
uint32_t
customMode
;
}
FullMode_t
;
/// @brief Returns the list of modes which are available for this AutoPilot.
virtual
QList
<
FullMode_t
>
getModes
(
void
)
const
=
0
;
/// @brief Returns a human readable short description for the specified mode.
virtual
QString
getShortModeText
(
uint8_t
baseMode
,
uint32_t
customMode
)
const
=
0
;
protected:
// All access to AutoPilotPugin objects is through getInstanceForAutoPilotPlugin
AutoPilotPlugin
(
void
);
};
#endif
src/AutoPilotPlugins/Generic/GenericAutoPilotPlugin.cc
0 → 100644
View file @
006b4d36
/*=====================================================================
QGroundControl Open Source Ground Control Station
(c) 2009 - 2014 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
This file is part of the QGROUNDCONTROL project
QGROUNDCONTROL is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
QGROUNDCONTROL is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with QGROUNDCONTROL. If not, see <http://www.gnu.org/licenses/>.
======================================================================*/
/// @file
/// @author Don Gagne <don@thegagnes.com>
#include "GenericAutoPilotPlugin.h"
GenericAutoPilotPlugin
::
GenericAutoPilotPlugin
(
void
)
{
}
QList
<
VehicleComponent
*>
GenericAutoPilotPlugin
::
getVehicleComponents
(
UASInterface
*
uas
)
const
{
Q_UNUSED
(
uas
);
// Generic autopilot has no configurable components
return
QList
<
VehicleComponent
*>
();
}
QList
<
AutoPilotPlugin
::
FullMode_t
>
GenericAutoPilotPlugin
::
getModes
(
void
)
const
{
QList
<
FullMode_t
>
modeList
;
FullMode_t
fullMode
;
fullMode
.
customMode
=
0
;
fullMode
.
baseMode
=
MAV_MODE_FLAG_MANUAL_INPUT_ENABLED
;
modeList
<<
fullMode
;
fullMode
.
baseMode
=
MAV_MODE_FLAG_MANUAL_INPUT_ENABLED
|
MAV_MODE_FLAG_STABILIZE_ENABLED
;
modeList
<<
fullMode
;
fullMode
.
baseMode
=
MAV_MODE_FLAG_MANUAL_INPUT_ENABLED
|
MAV_MODE_FLAG_STABILIZE_ENABLED
|
MAV_MODE_FLAG_GUIDED_ENABLED
;
modeList
<<
fullMode
;
fullMode
.
baseMode
=
MAV_MODE_FLAG_AUTO_ENABLED
|
MAV_MODE_FLAG_STABILIZE_ENABLED
|
MAV_MODE_FLAG_GUIDED_ENABLED
;
modeList
<<
fullMode
;
return
modeList
;
}
QString
GenericAutoPilotPlugin
::
getShortModeText
(
uint8_t
baseMode
,
uint32_t
customMode
)
const
{
Q_UNUSED
(
customMode
);
QString
mode
;
// use base_mode - not autopilot-specific
if
(
baseMode
==
0
)
{
mode
=
"|PREFLIGHT"
;
}
else
if
(
baseMode
&
MAV_MODE_FLAG_DECODE_POSITION_AUTO
)
{
mode
=
"|AUTO"
;
}
else
if
(
baseMode
&
MAV_MODE_FLAG_DECODE_POSITION_MANUAL
)
{
mode
=
"|MANUAL"
;
if
(
baseMode
&
MAV_MODE_FLAG_DECODE_POSITION_GUIDED
)
{
mode
+=
"|GUIDED"
;
}
else
if
(
baseMode
&
MAV_MODE_FLAG_DECODE_POSITION_STABILIZE
)
{
mode
+=
"|STABILIZED"
;
}
}
return
mode
;
}
src/AutoPilotPlugins/Generic/GenericAutoPilotPlugin.h
0 → 100644
View file @
006b4d36
/*=====================================================================
QGroundControl Open Source Ground Control Station
(c) 2009 - 2014 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
This file is part of the QGROUNDCONTROL project
QGROUNDCONTROL is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
QGROUNDCONTROL is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with QGROUNDCONTROL. If not, see <http://www.gnu.org/licenses/>.
======================================================================*/
#ifndef GENERICAUTOPILOT_H
#define GENERICAUTOPILOT_H
#include "AutoPilotPlugin.h"
/// @file
/// @brief This is the generic implementation of the AutoPilotPlugin class for mavs
/// we do not have a specific AutoPilotPlugin implementation.
/// @author Don Gagne <don@thegagnes.com>
class
GenericAutoPilotPlugin
:
public
AutoPilotPlugin
{
Q_OBJECT
public:
GenericAutoPilotPlugin
(
void
);
virtual
QList
<
VehicleComponent
*>
getVehicleComponents
(
UASInterface
*
uas
)
const
;
virtual
QList
<
FullMode_t
>
getModes
(
void
)
const
;
virtual
QString
getShortModeText
(
uint8_t
baseMode
,
uint32_t
customMode
)
const
;
};
#endif
src/AutoPilotPlugins/PX4/AirframeComponent.cc
0 → 100644
View file @
006b4d36
/*=====================================================================
QGroundControl Open Source Ground Control Station
(c) 2009 - 2014 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
This file is part of the QGROUNDCONTROL project
QGROUNDCONTROL is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
QGROUNDCONTROL is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with QGROUNDCONTROL. If not, see <http://www.gnu.org/licenses/>.
======================================================================*/
/// @file
/// @author Don Gagne <don@thegagnes.com>
#include "AirframeComponent.h"
#include "QGCPX4AirframeConfig.h"
/// @brief Parameters which signal a change in setupComplete state
static
const
char
*
triggerParams
[]
=
{
"SYS_AUTOSTART"
,
NULL
};
struct
mavType
{
int
type
;
const
char
*
description
;
};
/// @brief Used to translate from MAV_TYPE_* id to user string
static
const
struct
mavType
mavTypeInfo
[]
=
{
{
MAV_TYPE_GENERIC
,
"Generic"
},
{
MAV_TYPE_FIXED_WING
,
"Fixed Wing"
},
{
MAV_TYPE_QUADROTOR
,
"Quadrotor"
},
{
MAV_TYPE_COAXIAL
,
"Coaxial"
},
{
MAV_TYPE_HELICOPTER
,
"Helicopter"
},
{
MAV_TYPE_ANTENNA_TRACKER
,
"Antenna Tracker"
},
{
MAV_TYPE_GCS
,
"Ground Control Station"
},
{
MAV_TYPE_AIRSHIP
,
"Airship"
},
{
MAV_TYPE_FREE_BALLOON
,
"Free Balloon"
},
{
MAV_TYPE_ROCKET
,
"Rocket"
},
{
MAV_TYPE_GROUND_ROVER
,
"Ground Rover"
},
{
MAV_TYPE_SURFACE_BOAT
,
"Boat"
},
{
MAV_TYPE_SUBMARINE
,
"Submarine"
},
{
MAV_TYPE_HEXAROTOR
,
"Hexarotor"
},
{
MAV_TYPE_OCTOROTOR
,
"Octorotor"
},
{
MAV_TYPE_TRICOPTER
,
"Tricopter"
},
{
MAV_TYPE_FLAPPING_WING
,
"Flapping Wing"
},
{
MAV_TYPE_KITE
,
"Kite"
},
{
MAV_TYPE_ONBOARD_CONTROLLER
,
"Onbard companion controller"
},
{
MAV_TYPE_VTOL_DUOROTOR
,
"Two-rotor VTOL"
},
{
MAV_TYPE_VTOL_QUADROTOR
,
"Quad-rotor VTOL"
},
};
static
size_t
cMavTypes
=
sizeof
(
mavTypeInfo
)
/
sizeof
(
mavTypeInfo
[
0
]);
AirframeComponent
::
AirframeComponent
(
UASInterface
*
uas
,
QObject
*
parent
)
:
PX4Component
(
uas
,
parent
),
_name
(
tr
(
"Airframe"
))
{
// Validate that our mavTypeInfo array hasn't gotten out of sync
Q_ASSERT
(
cMavTypes
==
MAV_TYPE_ENUM_END
);
static
const
int
mavTypes
[]
=
{
MAV_TYPE_GENERIC
,
MAV_TYPE_FIXED_WING
,
MAV_TYPE_QUADROTOR
,
MAV_TYPE_COAXIAL
,
MAV_TYPE_HELICOPTER
,
MAV_TYPE_ANTENNA_TRACKER
,
MAV_TYPE_GCS
,
MAV_TYPE_AIRSHIP
,
MAV_TYPE_FREE_BALLOON
,
MAV_TYPE_ROCKET
,
MAV_TYPE_GROUND_ROVER
,
MAV_TYPE_SURFACE_BOAT
,
MAV_TYPE_SUBMARINE
,
MAV_TYPE_HEXAROTOR
,
MAV_TYPE_OCTOROTOR
,
MAV_TYPE_TRICOPTER
,
MAV_TYPE_FLAPPING_WING
,
MAV_TYPE_KITE
,
MAV_TYPE_ONBOARD_CONTROLLER
,
MAV_TYPE_VTOL_DUOROTOR
,
MAV_TYPE_VTOL_QUADROTOR
};
for
(
size_t
i
=
0
;
i
<
sizeof
(
mavTypes
)
/
sizeof
(
mavTypes
[
0
]);
i
++
)
{
Q_ASSERT
(
mavTypeInfo
[
i
].
type
==
mavTypes
[
i
]);
}
}
QString
AirframeComponent
::
name
(
void
)
const
{
return
_name
;
}
QString
AirframeComponent
::
description
(
void
)
const
{
return
tr
(
"The Airframe Component is used to select the airframe which matches your vehicle. "
"This will in turn set up the various tuning values for flight paramters."
);
}
QString
AirframeComponent
::
icon
(
void
)
const
{
return
":/files/images/px4/menu/plane.png"
;
}
bool
AirframeComponent
::
requiresSetup
(
void
)
const
{
return
true
;
}
bool
AirframeComponent
::
setupComplete
(
void
)
const
{
QVariant
value
;
if
(
_paramMgr
->
getParameterValue
(
_paramMgr
->
getDefaultComponentId
(),
triggerParams
[
0
],
value
))
{
return
value
.
toInt
()
!=
0
;
}
else
{
Q_ASSERT
(
false
);
return
false
;
}
}
QString
AirframeComponent
::
setupStateDescription
(
void
)
const
{
const
char
*
stateDescription
;
if
(
requiresSetup
())
{
stateDescription
=
"Requires calibration"
;
}
else
{
stateDescription
=
"Calibrated"
;
}
return
QString
(
stateDescription
);
}
const
char
**
AirframeComponent
::
setupCompleteChangedTriggerList
(
void
)
const
{
return
triggerParams
;
}
QStringList
AirframeComponent
::
paramFilterList
(
void
)
const
{
QStringList
list
;
list
<<
"SYS_AUTOSTART"
;
return
list
;
}
QWidget
*
AirframeComponent
::
setupWidget
(
void
)
const
{
return
new
QGCPX4AirframeConfig
;
}
QList
<
QStringList
>
AirframeComponent
::
summaryItems
(
void
)
const
{
QVariant
value
;
QStringList
row
;
QList
<
QStringList
>
items
;
row
<<
"System ID:"
;
if
(
_paramMgr
->
getParameterValue
(
_paramMgr
->
getDefaultComponentId
(),
"MAV_SYS_ID"
,
value
))
{
if
(
value
.
toInt
()
==
0
)
{
row
<<
"Setup required"
;
}
else
{
row
<<
value
.
toString
();
}
}
else
{
// Why is the parameter missing?
Q_ASSERT
(
false
);
}
items
<<
row
;
row
.
clear
();
row
<<
"Airframe:"
;
if
(
_paramMgr
->
getParameterValue
(
_paramMgr
->
getDefaultComponentId
(),
"SYS_AUTOSTART"
,
value
))
{
if
(
value
.
toInt
()
==
0
)
{
row
<<
"Setup required"
;
}
else
{
row
<<
value
.
toString
();
}
}
else
{
// Why is the parameter missing?
Q_ASSERT
(
false
);
}
items
<<
row
;
row
.
clear
();
row
<<
"Type:"
;
if
(
_paramMgr
->
getParameterValue
(
_paramMgr
->
getDefaultComponentId
(),
"MAV_TYPE"
,
value
))
{
int
index
=
value
.
toInt
();
if
(
index
<
0
||
index
>=
(
int
)
cMavTypes
)
{
row
<<
"Unknown"
;
}
else
{
row
<<
mavTypeInfo
[
index
].
description
;
}
}
else
{
// Why is the parameter missing?
Q_ASSERT
(
false
);
row
<<
"Unknown"
;
}
items
<<
row
;
return
items
;
}
src/AutoPilotPlugins/PX4/AirframeComponent.h
0 → 100644
View file @
006b4d36
/*=====================================================================
QGroundControl Open Source Ground Control Station
(c) 2009 - 2014 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
This file is part of the QGROUNDCONTROL project
QGROUNDCONTROL is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
QGROUNDCONTROL is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with QGROUNDCONTROL. If not, see <http://www.gnu.org/licenses/>.
======================================================================*/
#ifndef AIRFRAMECOMPONENT_H
#define AIRFRAMECOMPONENT_H
#include "PX4Component.h"
/// @file
/// @brief The Airframe VehicleComponent is used to set the SYS_AUTOSTART airframe id.
/// @author Don Gagne <don@thegagnes.com>
class
AirframeComponent
:
public
PX4Component
{
Q_OBJECT
public:
AirframeComponent
(
UASInterface
*
uas
,
QObject
*
parent
=
NULL
);
// Virtuals from PX4Component
virtual
const
char
**
setupCompleteChangedTriggerList
(
void
)
const
;
// Virtuals from VehicleComponent
virtual
QString
name
(
void
)
const
;
virtual
QString
description
(
void
)
const
;
virtual
QString
icon
(
void
)
const
;
virtual
bool
requiresSetup
(
void
)
const
;
virtual
bool
setupComplete
(
void
)
const
;
virtual
QString
setupStateDescription
(
void
)
const
;
virtual
QWidget
*
setupWidget
(
void
)
const
;
virtual
QStringList
paramFilterList
(
void
)
const
;
virtual
QList
<
QStringList
>
summaryItems
(
void
)
const
;
private:
const
QString
_name
;
};
#endif
src/AutoPilotPlugins/PX4/FlightModesComponent.cc
0 → 100644
View file @
006b4d36
/*=====================================================================
QGroundControl Open Source Ground Control Station
(c) 2009 - 2014 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
This file is part of the QGROUNDCONTROL project
QGROUNDCONTROL is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
QGROUNDCONTROL is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with QGROUNDCONTROL. If not, see <http://www.gnu.org/licenses/>.
======================================================================*/
/// @file
/// @author Don Gagne <don@thegagnes.com>
#include "FlightModesComponent.h"
#include <QVBoxLayout>
#include <QLabel>
/// @brief Parameters which signal a change in setupComplete state
static
const
char
*
triggerParams
[]
=
{
"RC_MAP_MODE_SW"
,
NULL
};
struct
SwitchListItem
{
const
char
*
param
;
const
char
*
name
;
};
/// @brief Used to translate from RC_MAP_* parameters name to user string
static
const
SwitchListItem
switchList
[]
=
{
{
"RC_MAP_MODE_SW"
,
"Mode Switch:"
},
// First entry must be mode switch
{
"RC_MAP_POSCTL_SW"
,
"Position Control Switch:"
},
{
"RC_MAP_LOITER_SW"
,
"Loiter Switch:"
},
{
"RC_MAP_RETURN_SW"
,
"Return Switch:"
}
};
static
const
size_t
cSwitchList
=
sizeof
(
switchList
)
/
sizeof
(
switchList
[
0
]);
FlightModesComponent
::
FlightModesComponent
(
UASInterface
*
uas
,
QObject
*
parent
)
:
PX4Component
(
uas
,
parent
),
_name
(
tr
(
"Flight Modes"
))
{
}
QString
FlightModesComponent
::
name
(
void
)
const