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
e0baebfc
Commit
e0baebfc
authored
Oct 15, 2015
by
Don Gagne
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1987 from pritamghanghas/apm_mode_support
flight mode support for ArduPilot
parents
e2d46469
232baa6a
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
461 additions
and
82 deletions
+461
-82
QGCApplication.pro
QGCApplication.pro
+4
-0
APMFirmwarePlugin.cc
src/FirmwarePlugin/APM/APMFirmwarePlugin.cc
+68
-22
APMFirmwarePlugin.h
src/FirmwarePlugin/APM/APMFirmwarePlugin.h
+21
-2
ArduCopterFirmwarePlugin.cc
src/FirmwarePlugin/APM/ArduCopterFirmwarePlugin.cc
+41
-44
ArduCopterFirmwarePlugin.h
src/FirmwarePlugin/APM/ArduCopterFirmwarePlugin.h
+30
-7
ArduPlaneFirmwarePlugin.cc
src/FirmwarePlugin/APM/ArduPlaneFirmwarePlugin.cc
+72
-0
ArduPlaneFirmwarePlugin.h
src/FirmwarePlugin/APM/ArduPlaneFirmwarePlugin.h
+74
-0
ArduRoverFirmwarePlugin.cc
src/FirmwarePlugin/APM/ArduRoverFirmwarePlugin.cc
+60
-0
ArduRoverFirmwarePlugin.h
src/FirmwarePlugin/APM/ArduRoverFirmwarePlugin.h
+74
-0
FirmwarePluginManager.cc
src/FirmwarePlugin/FirmwarePluginManager.cc
+11
-7
QGCApplication.cc
src/QGCApplication.cc
+6
-0
No files found.
QGCApplication.pro
View file @
e0baebfc
...
...
@@ -520,6 +520,8 @@ HEADERS+= \
src
/
FirmwarePlugin
/
FirmwarePlugin
.
h
\
src
/
FirmwarePlugin
/
APM
/
APMFirmwarePlugin
.
h
\
src
/
FirmwarePlugin
/
APM
/
ArduCopterFirmwarePlugin
.
h
\
src
/
FirmwarePlugin
/
APM
/
ArduPlaneFirmwarePlugin
.
h
\
src
/
FirmwarePlugin
/
APM
/
ArduRoverFirmwarePlugin
.
h
\
src
/
FirmwarePlugin
/
Generic
/
GenericFirmwarePlugin
.
h
\
src
/
FirmwarePlugin
/
PX4
/
PX4FirmwarePlugin
.
h
\
src
/
Vehicle
/
MultiVehicleManager
.
h
\
...
...
@@ -557,6 +559,8 @@ SOURCES += \
src
/
AutoPilotPlugins
/
PX4
/
SensorsComponentController
.
cc
\
src
/
FirmwarePlugin
/
APM
/
APMFirmwarePlugin
.
cc
\
src
/
FirmwarePlugin
/
APM
/
ArduCopterFirmwarePlugin
.
cc
\
src
/
FirmwarePlugin
/
APM
/
ArduPlaneFirmwarePlugin
.
cc
\
src
/
FirmwarePlugin
/
APM
/
ArduRoverFirmwarePlugin
.
cc
\
src
/
FirmwarePlugin
/
FirmwarePluginManager
.
cc
\
src
/
FirmwarePlugin
/
Generic
/
GenericFirmwarePlugin
.
cc
\
src
/
FirmwarePlugin
/
PX4
/
PX4FirmwarePlugin
.
cc
\
...
...
src/FirmwarePlugin/APM/APMFirmwarePlugin.cc
View file @
e0baebfc
...
...
@@ -28,8 +28,6 @@
#include "Generic/GenericFirmwarePlugin.h"
#include "QGCMAVLink.h"
#include <QDebug>
QGC_LOGGING_CATEGORY
(
APMFirmwarePluginLog
,
"APMFirmwarePluginLog"
)
static
const
QRegExp
APM_COPTER_REXP
(
"^(ArduCopter|APM:Copter)"
);
...
...
@@ -115,6 +113,31 @@ void APMFirmwareVersion::_parseVersion(const QString &versionText)
_patch
=
capturedTexts
[
4
].
toInt
();
}
/*
* @brief APMCustomMode encapsulates the custom modes for APM
*/
APMCustomMode
::
APMCustomMode
(
uint32_t
mode
,
bool
settable
)
:
_mode
(
mode
),
_settable
(
settable
)
{
}
void
APMCustomMode
::
setEnumToStringMapping
(
const
QMap
<
uint32_t
,
QString
>&
enumToString
)
{
_enumToString
=
enumToString
;
}
QString
APMCustomMode
::
modeString
()
const
{
QString
mode
=
_enumToString
.
value
(
modeAsInt
());
if
(
mode
.
isEmpty
())
{
mode
=
"mode"
+
QString
::
number
(
modeAsInt
());
}
return
mode
;
}
APMFirmwarePlugin
::
APMFirmwarePlugin
(
QObject
*
parent
)
:
FirmwarePlugin
(
parent
)
{
...
...
@@ -123,11 +146,7 @@ APMFirmwarePlugin::APMFirmwarePlugin(QObject* parent) :
bool
APMFirmwarePlugin
::
isCapable
(
FirmwareCapabilities
capabilities
)
{
Q_UNUSED
(
capabilities
);
// FIXME: No capabilitis yet supported
return
false
;
return
(
capabilities
&
(
MavCmdPreflightStorageCapability
|
SetFlightModeCapability
))
==
capabilities
;
}
QList
<
VehicleComponent
*>
APMFirmwarePlugin
::
componentsForVehicle
(
AutoPilotPlugin
*
vehicle
)
...
...
@@ -138,29 +157,51 @@ QList<VehicleComponent*> APMFirmwarePlugin::componentsForVehicle(AutoPilotPlugin
}
QStringList
APMFirmwarePlugin
::
flightModes
(
void
)
{
// FIXME: NYI
qWarning
()
<<
"APMFirmwarePlugin::flightModes not supported"
;
return
QStringList
();
{
QStringList
flightModesList
;
foreach
(
const
APMCustomMode
&
customMode
,
_supportedModes
)
{
if
(
customMode
.
canBeSet
())
{
flightModesList
<<
customMode
.
modeString
();
}
}
return
flightModesList
;
}
QString
APMFirmwarePlugin
::
flightMode
(
uint8_t
base_mode
,
uint32_t
custom_mode
)
{
// FIXME: Nothing more than generic support yet
return
GenericFirmwarePlugin
::
instance
()
->
flightMode
(
base_mode
,
custom_mode
);
QString
flightMode
=
"Unknown"
;
if
(
base_mode
&
MAV_MODE_FLAG_CUSTOM_MODE_ENABLED
)
{
foreach
(
const
APMCustomMode
&
customMode
,
_supportedModes
)
{
if
(
customMode
.
modeAsInt
()
==
custom_mode
)
{
flightMode
=
customMode
.
modeString
();
}
}
}
return
flightMode
;
}
bool
APMFirmwarePlugin
::
setFlightMode
(
const
QString
&
flightMode
,
uint8_t
*
base_mode
,
uint32_t
*
custom_mode
)
{
Q_UNUSED
(
flightMode
);
Q_UNUSED
(
base_mode
);
Q_UNUSED
(
custom_mode
);
qWarning
()
<<
"APMFirmwarePlugin::setFlightMode called on base class, not supported"
;
return
false
;
*
base_mode
=
0
;
*
custom_mode
=
0
;
bool
found
=
false
;
foreach
(
const
APMCustomMode
&
mode
,
_supportedModes
)
{
if
(
flightMode
.
compare
(
mode
.
modeString
(),
Qt
::
CaseInsensitive
)
==
0
)
{
*
base_mode
=
MAV_MODE_FLAG_CUSTOM_MODE_ENABLED
;
*
custom_mode
=
mode
.
modeAsInt
();
found
=
true
;
break
;
}
}
if
(
!
found
)
{
qCWarning
(
APMFirmwarePluginLog
)
<<
"Unknown flight Mode"
<<
flightMode
;
}
return
found
;
}
int
APMFirmwarePlugin
::
manualControlReservedButtonCount
(
void
)
...
...
@@ -332,3 +373,8 @@ void APMFirmwarePlugin::initializeVehicle(Vehicle* vehicle)
vehicle
->
requestDataStream
(
MAV_DATA_STREAM_EXTRA2
,
10
);
vehicle
->
requestDataStream
(
MAV_DATA_STREAM_EXTRA3
,
3
);
}
void
APMFirmwarePlugin
::
setSupportedModes
(
QList
<
APMCustomMode
>
supportedModes
)
{
_supportedModes
=
supportedModes
;
}
src/FirmwarePlugin/APM/APMFirmwarePlugin.h
View file @
e0baebfc
...
...
@@ -55,6 +55,23 @@ private:
int
_patch
;
};
class
APMCustomMode
{
public:
APMCustomMode
(
uint32_t
mode
,
bool
settable
);
uint32_t
modeAsInt
()
const
{
return
_mode
;
}
bool
canBeSet
()
const
{
return
_settable
;
}
QString
modeString
()
const
;
protected:
void
setEnumToStringMapping
(
const
QMap
<
uint32_t
,
QString
>&
enumToString
);
private:
uint32_t
_mode
;
bool
_settable
;
QMap
<
uint32_t
,
QString
>
_enumToString
;
};
/// This is the base class for all stack specific APM firmware plugins
class
APMFirmwarePlugin
:
public
FirmwarePlugin
{
...
...
@@ -74,13 +91,15 @@ public:
protected:
/// All access to singleton is through stack specific implementation
APMFirmwarePlugin
(
QObject
*
parent
=
NULL
);
void
setSupportedModes
(
QList
<
APMCustomMode
>
supportedModes
);
private:
void
_adjustSeverity
(
mavlink_message_t
*
message
)
const
;
static
bool
_isTextSeverityAdjustmentNeeded
(
const
APMFirmwareVersion
&
firmwareVersion
);
APMFirmwareVersion
_firmwareVersion
;
bool
_textSeverityAdjustmentNeeded
;
APMFirmwareVersion
_firmwareVersion
;
bool
_textSeverityAdjustmentNeeded
;
QList
<
APMCustomMode
>
_supportedModes
;
};
...
...
src/FirmwarePlugin/APM/ArduCopterFirmwarePlugin.cc
View file @
e0baebfc
...
...
@@ -26,56 +26,53 @@
#include "ArduCopterFirmwarePlugin.h"
#include "Generic/GenericFirmwarePlugin.h"
#include "QGCMAVLink.h"
#include <QDebug>
IMPLEMENT_QGC_SINGLETON
(
ArduCopterFirmwarePlugin
,
ArduCopterFirmwarePlugin
)
ArduCopterFirmwarePlugin
::
ArduCopterFirmwarePlugin
(
QObject
*
parent
)
:
APMFirmwarePlugin
(
parent
)
APMCopterMode
::
APMCopterMode
(
uint32_t
mode
,
bool
settable
)
:
APMCustomMode
(
mode
,
settable
)
{
QMap
<
uint32_t
,
QString
>
enumToString
;
enumToString
.
insert
(
STABILIZE
,
"Stabilize"
);
enumToString
.
insert
(
ACRO
,
"Acro"
);
enumToString
.
insert
(
ALT_HOLD
,
"Alt Hold"
);
enumToString
.
insert
(
AUTO
,
"Auto"
);
enumToString
.
insert
(
GUIDED
,
"Guided"
);
enumToString
.
insert
(
LOITER
,
"Loiter"
);
enumToString
.
insert
(
RTL
,
"RTL"
);
enumToString
.
insert
(
CIRCLE
,
"Circle"
);
enumToString
.
insert
(
POSITION
,
"Position"
);
enumToString
.
insert
(
LAND
,
"Land"
);
enumToString
.
insert
(
OF_LOITER
,
"OF Loiter"
);
enumToString
.
insert
(
DRIFT
,
"Drift"
);
enumToString
.
insert
(
SPORT
,
"Sport"
);
enumToString
.
insert
(
FLIP
,
"Flip"
);
enumToString
.
insert
(
AUTOTUNE
,
"Autotune"
);
enumToString
.
insert
(
POS_HOLD
,
"Pos Hold"
);
enumToString
.
insert
(
BRAKE
,
"Brake"
);
setEnumToStringMapping
(
enumToString
);
}
bool
ArduCopterFirmwarePlugin
::
isCapable
(
FirmwareCapabilities
capabilities
)
{
Q_UNUSED
(
capabilities
);
// FIXME: No capabilitis yet supported
return
false
;
}
QList
<
VehicleComponent
*>
ArduCopterFirmwarePlugin
::
componentsForVehicle
(
AutoPilotPlugin
*
vehicle
)
{
Q_UNUSED
(
vehicle
);
return
QList
<
VehicleComponent
*>
();
}
QStringList
ArduCopterFirmwarePlugin
::
flightModes
(
void
)
{
// FIXME: NYI
qWarning
()
<<
"ArduCopterFirmwarePlugin::flightModes not supported"
;
return
QStringList
();
}
QString
ArduCopterFirmwarePlugin
::
flightMode
(
uint8_t
base_mode
,
uint32_t
custom_mode
)
{
// FIXME: Nothing more than generic support yet
return
GenericFirmwarePlugin
::
instance
()
->
flightMode
(
base_mode
,
custom_mode
);
}
bool
ArduCopterFirmwarePlugin
::
setFlightMode
(
const
QString
&
flightMode
,
uint8_t
*
base_mode
,
uint32_t
*
custom_mode
)
ArduCopterFirmwarePlugin
::
ArduCopterFirmwarePlugin
(
QObject
*
parent
)
:
APMFirmwarePlugin
(
parent
)
{
Q_UNUSED
(
flightMode
);
Q_UNUSED
(
base_mode
);
Q_UNUSED
(
custom_mode
);
qWarning
()
<<
"ArduCopterFirmwarePlugin::setFlightMode called on base class, not supported"
;
return
false
;
QList
<
APMCustomMode
>
supportedFlightModes
;
supportedFlightModes
<<
APMCopterMode
(
APMCopterMode
::
STABILIZE
,
true
);
supportedFlightModes
<<
APMCopterMode
(
APMCopterMode
::
ACRO
,
true
);
supportedFlightModes
<<
APMCopterMode
(
APMCopterMode
::
ALT_HOLD
,
true
);
supportedFlightModes
<<
APMCopterMode
(
APMCopterMode
::
AUTO
,
true
);
supportedFlightModes
<<
APMCopterMode
(
APMCopterMode
::
GUIDED
,
true
);
supportedFlightModes
<<
APMCopterMode
(
APMCopterMode
::
LOITER
,
true
);
supportedFlightModes
<<
APMCopterMode
(
APMCopterMode
::
RTL
,
true
);
supportedFlightModes
<<
APMCopterMode
(
APMCopterMode
::
CIRCLE
,
true
);
supportedFlightModes
<<
APMCopterMode
(
APMCopterMode
::
POSITION
,
true
);
supportedFlightModes
<<
APMCopterMode
(
APMCopterMode
::
LAND
,
true
);
supportedFlightModes
<<
APMCopterMode
(
APMCopterMode
::
OF_LOITER
,
true
);
supportedFlightModes
<<
APMCopterMode
(
APMCopterMode
::
DRIFT
,
true
);
supportedFlightModes
<<
APMCopterMode
(
APMCopterMode
::
SPORT
,
true
);
supportedFlightModes
<<
APMCopterMode
(
APMCopterMode
::
FLIP
,
true
);
supportedFlightModes
<<
APMCopterMode
(
APMCopterMode
::
AUTOTUNE
,
true
);
supportedFlightModes
<<
APMCopterMode
(
APMCopterMode
::
POS_HOLD
,
true
);
supportedFlightModes
<<
APMCopterMode
(
APMCopterMode
::
BRAKE
,
true
);
setSupportedModes
(
supportedFlightModes
);
}
src/FirmwarePlugin/APM/ArduCopterFirmwarePlugin.h
View file @
e0baebfc
...
...
@@ -29,6 +29,35 @@
#include "APMFirmwarePlugin.h"
class
APMCopterMode
:
public
APMCustomMode
{
public:
enum
Mode
{
STABILIZE
=
0
,
// hold level position
ACRO
=
1
,
// rate control
ALT_HOLD
=
2
,
// AUTO control
AUTO
=
3
,
// AUTO control
GUIDED
=
4
,
// AUTO control
LOITER
=
5
,
// Hold a single location
RTL
=
6
,
// AUTO control
CIRCLE
=
7
,
// AUTO control
POSITION
=
8
,
// AUTO control
LAND
=
9
,
// AUTO control
OF_LOITER
=
10
,
// Hold a single location using optical flow
// sensor
DRIFT
=
11
,
// Drift 'Car Like' mode
RESERVED_12
=
12
,
// RESERVED FOR FUTURE USE
SPORT
=
13
,
// [TODO] Verify this is correct.
FLIP
=
14
,
AUTOTUNE
=
15
,
POS_HOLD
=
16
,
// HYBRID LOITER.
BRAKE
=
17
};
static
const
int
modeCount
=
18
;
APMCopterMode
(
uint32_t
mode
,
bool
settable
);
};
class
ArduCopterFirmwarePlugin
:
public
APMFirmwarePlugin
{
Q_OBJECT
...
...
@@ -36,13 +65,7 @@ class ArduCopterFirmwarePlugin : public APMFirmwarePlugin
DECLARE_QGC_SINGLETON
(
ArduCopterFirmwarePlugin
,
ArduCopterFirmwarePlugin
)
public:
// Overrides from FirmwarePlugin
virtual
bool
isCapable
(
FirmwareCapabilities
capabilities
);
virtual
QList
<
VehicleComponent
*>
componentsForVehicle
(
AutoPilotPlugin
*
vehicle
);
virtual
QStringList
flightModes
(
void
);
virtual
QString
flightMode
(
uint8_t
base_mode
,
uint32_t
custom_mode
);
virtual
bool
setFlightMode
(
const
QString
&
flightMode
,
uint8_t
*
base_mode
,
uint32_t
*
custom_mode
);
protected:
/// All access to singleton is through instance()
ArduCopterFirmwarePlugin
(
QObject
*
parent
=
NULL
);
...
...
src/FirmwarePlugin/APM/ArduPlaneFirmwarePlugin.cc
0 → 100644
View file @
e0baebfc
/*=====================================================================
QGroundControl Open Source Ground Control Station
(c) 2009 - 2015 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 Pritam Ghanghas <pritam.ghanghas@gmail.com>
#include "ArduPlaneFirmwarePlugin.h"
#include "Generic/GenericFirmwarePlugin.h"
IMPLEMENT_QGC_SINGLETON
(
ArduPlaneFirmwarePlugin
,
ArduPlaneFirmwarePlugin
)
APMPlaneMode
::
APMPlaneMode
(
uint32_t
mode
,
bool
settable
)
:
APMCustomMode
(
mode
,
settable
)
{
QMap
<
uint32_t
,
QString
>
enumToString
;
enumToString
.
insert
(
MANUAL
,
"Manual"
);
enumToString
.
insert
(
CIRCLE
,
"Circle"
);
enumToString
.
insert
(
STABILIZE
,
"Stabilize"
);
enumToString
.
insert
(
TRAINING
,
"Training"
);
enumToString
.
insert
(
ACRO
,
"Acro"
);
enumToString
.
insert
(
FLY_BY_WIRE_A
,
"FWB A"
);
enumToString
.
insert
(
FLY_BY_WIRE_B
,
"FWB B"
);
enumToString
.
insert
(
CRUISE
,
"Cruise"
);
enumToString
.
insert
(
AUTOTUNE
,
"Autotune"
);
enumToString
.
insert
(
AUTO
,
"Auto"
);
enumToString
.
insert
(
RTL
,
"RTL"
);
enumToString
.
insert
(
LOITER
,
"Loiter"
);
enumToString
.
insert
(
GUIDED
,
"Guided"
);
enumToString
.
insert
(
INITIALIZING
,
"Initializing"
);
setEnumToStringMapping
(
enumToString
);
}
ArduPlaneFirmwarePlugin
::
ArduPlaneFirmwarePlugin
(
QObject
*
parent
)
:
APMFirmwarePlugin
(
parent
)
{
QList
<
APMCustomMode
>
supportedFlightModes
;
supportedFlightModes
<<
APMPlaneMode
(
APMPlaneMode
::
MANUAL
,
true
);
supportedFlightModes
<<
APMPlaneMode
(
APMPlaneMode
::
CIRCLE
,
true
);
supportedFlightModes
<<
APMPlaneMode
(
APMPlaneMode
::
STABILIZE
,
true
);
supportedFlightModes
<<
APMPlaneMode
(
APMPlaneMode
::
TRAINING
,
true
);
supportedFlightModes
<<
APMPlaneMode
(
APMPlaneMode
::
ACRO
,
true
);
supportedFlightModes
<<
APMPlaneMode
(
APMPlaneMode
::
FLY_BY_WIRE_A
,
true
);
supportedFlightModes
<<
APMPlaneMode
(
APMPlaneMode
::
FLY_BY_WIRE_B
,
true
);
supportedFlightModes
<<
APMPlaneMode
(
APMPlaneMode
::
CRUISE
,
true
);
supportedFlightModes
<<
APMPlaneMode
(
APMPlaneMode
::
AUTOTUNE
,
true
);
supportedFlightModes
<<
APMPlaneMode
(
APMPlaneMode
::
AUTO
,
true
);
supportedFlightModes
<<
APMPlaneMode
(
APMPlaneMode
::
RTL
,
true
);
supportedFlightModes
<<
APMPlaneMode
(
APMPlaneMode
::
LOITER
,
true
);
supportedFlightModes
<<
APMPlaneMode
(
APMPlaneMode
::
GUIDED
,
true
);
supportedFlightModes
<<
APMPlaneMode
(
APMPlaneMode
::
INITIALIZING
,
false
);
setSupportedModes
(
supportedFlightModes
);
}
src/FirmwarePlugin/APM/ArduPlaneFirmwarePlugin.h
0 → 100644
View file @
e0baebfc
/*=====================================================================
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 Pritam Ghanghas <pritam.ghanghas@gmail.com>
#ifndef ArduPlaneFirmwarePlugin_H
#define ArduPlaneFirmwarePlugin_H
#include "APMFirmwarePlugin.h"
class
APMPlaneMode
:
public
APMCustomMode
{
public:
enum
Mode
{
MANUAL
=
0
,
CIRCLE
=
1
,
STABILIZE
=
2
,
TRAINING
=
3
,
ACRO
=
4
,
FLY_BY_WIRE_A
=
5
,
FLY_BY_WIRE_B
=
6
,
CRUISE
=
7
,
AUTOTUNE
=
8
,
RESERVED_9
=
9
,
// RESERVED FOR FUTURE USE
AUTO
=
10
,
RTL
=
11
,
LOITER
=
12
,
RESERVED_13
=
13
,
// RESERVED FOR FUTURE USE
RESERVED_14
=
14
,
// RESERVED FOR FUTURE USE
GUIDED
=
15
,
INITIALIZING
=
16
};
static
const
int
modeCount
=
17
;
APMPlaneMode
(
uint32_t
mode
,
bool
settable
);
};
class
ArduPlaneFirmwarePlugin
:
public
APMFirmwarePlugin
{
Q_OBJECT
DECLARE_QGC_SINGLETON
(
ArduPlaneFirmwarePlugin
,
ArduPlaneFirmwarePlugin
)
public:
protected:
/// All access to singleton is through instance()
ArduPlaneFirmwarePlugin
(
QObject
*
parent
=
NULL
);
private:
};
#endif
src/FirmwarePlugin/APM/ArduRoverFirmwarePlugin.cc
0 → 100644
View file @
e0baebfc
/*=====================================================================
QGroundControl Open Source Ground Control Station
(c) 2009 - 2015 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 Pritam Ghanghas <pritam.ghanghas@gmail.com>
#include "ArduRoverFirmwarePlugin.h"
#include "Generic/GenericFirmwarePlugin.h"
IMPLEMENT_QGC_SINGLETON
(
ArduRoverFirmwarePlugin
,
ArduRoverFirmwarePlugin
)
APMRoverMode
::
APMRoverMode
(
uint32_t
mode
,
bool
settable
)
:
APMCustomMode
(
mode
,
settable
)
{
QMap
<
uint32_t
,
QString
>
enumToString
;
enumToString
.
insert
(
MANUAL
,
"Manual"
);
enumToString
.
insert
(
LEARNING
,
"Learning"
);
enumToString
.
insert
(
STEERING
,
"Steering"
);
enumToString
.
insert
(
HOLD
,
"Hold"
);
enumToString
.
insert
(
AUTO
,
"Auto"
);
enumToString
.
insert
(
RTL
,
"RTL"
);
enumToString
.
insert
(
GUIDED
,
"Guided"
);
enumToString
.
insert
(
INITIALIZING
,
"Initializing"
);
setEnumToStringMapping
(
enumToString
);
}
ArduRoverFirmwarePlugin
::
ArduRoverFirmwarePlugin
(
QObject
*
parent
)
:
APMFirmwarePlugin
(
parent
)
{
QList
<
APMCustomMode
>
supportedFlightModes
;
supportedFlightModes
<<
APMRoverMode
(
APMRoverMode
::
MANUAL
,
true
);
supportedFlightModes
<<
APMRoverMode
(
APMRoverMode
::
LEARNING
,
true
);
supportedFlightModes
<<
APMRoverMode
(
APMRoverMode
::
STEERING
,
true
);
supportedFlightModes
<<
APMRoverMode
(
APMRoverMode
::
HOLD
,
true
);
supportedFlightModes
<<
APMRoverMode
(
APMRoverMode
::
AUTO
,
true
);
supportedFlightModes
<<
APMRoverMode
(
APMRoverMode
::
RTL
,
true
);
supportedFlightModes
<<
APMRoverMode
(
APMRoverMode
::
GUIDED
,
true
);
supportedFlightModes
<<
APMRoverMode
(
APMRoverMode
::
INITIALIZING
,
false
);
setSupportedModes
(
supportedFlightModes
);
}
src/FirmwarePlugin/APM/ArduRoverFirmwarePlugin.h
0 → 100644
View file @
e0baebfc
/*=====================================================================
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 Pritam Ghanghas <pritam.ghanghas@gmail.com>
#ifndef ArduRoverFirmwarePlugin_H
#define ArduRoverFirmwarePlugin_H
#include "APMFirmwarePlugin.h"
class
APMRoverMode
:
public
APMCustomMode
{
public:
enum
Mode
{
MANUAL
=
0
,
RESERVED_1
=
1
,
// RESERVED FOR FUTURE USE
LEARNING
=
2
,
STEERING
=
3
,
HOLD
=
4
,
RESERVED_5
=
5
,
// RESERVED FOR FUTURE USE
RESERVED_6
=
6
,
// RESERVED FOR FUTURE USE
RESERVED_7
=
7
,
// RESERVED FOR FUTURE USE
RESERVED_8
=
8
,
// RESERVED FOR FUTURE USE
RESERVED_9
=
9
,
// RESERVED FOR FUTURE USE
AUTO
=
10
,
RTL
=
11
,
RESERVED_12
=
12
,
// RESERVED FOR FUTURE USE
RESERVED_13
=
13
,
// RESERVED FOR FUTURE USE
RESERVED_14
=
14
,
// RESERVED FOR FUTURE USE
GUIDED
=
15
,
INITIALIZING
=
16
,
};
static
const
int
modeCount
=
17
;
APMRoverMode
(
uint32_t
mode
,
bool
settable
);
};
class
ArduRoverFirmwarePlugin
:
public
APMFirmwarePlugin
{
Q_OBJECT
DECLARE_QGC_SINGLETON
(
ArduRoverFirmwarePlugin
,
ArduRoverFirmwarePlugin
)
public:
protected:
/// All access to singleton is through instance()
ArduRoverFirmwarePlugin
(
QObject
*
parent
=
NULL
);
private:
};
#endif
src/FirmwarePlugin/FirmwarePluginManager.cc
View file @
e0baebfc
...
...
@@ -27,6 +27,8 @@
#include "FirmwarePluginManager.h"
#include "Generic/GenericFirmwarePlugin.h"
#include "APM/ArduCopterFirmwarePlugin.h"
#include "APM/ArduPlaneFirmwarePlugin.h"
#include "APM/ArduRoverFirmwarePlugin.h"
#include "PX4/PX4FirmwarePlugin.h"
IMPLEMENT_QGC_SINGLETON
(
FirmwarePluginManager
,
FirmwarePluginManager
)
...
...
@@ -51,22 +53,24 @@ FirmwarePlugin* FirmwarePluginManager::firmwarePluginForAutopilot(MAV_AUTOPILOT
case
MAV_TYPE_HEXAROTOR
:
case
MAV_TYPE_OCTOROTOR
:
case
MAV_TYPE_TRICOPTER
:
case
MAV_TYPE_COAXIAL
:
case
MAV_TYPE_HELICOPTER
:
return
ArduCopterFirmwarePlugin
::
instance
();
break
;
// FIXME: The remainder of these need to be correctly assigned and new plugin classes created as needed.
// Once done, the unused cases can be removed and just the fall back default: left
case
MAV_TYPE_FIXED_WING
:
return
ArduPlaneFirmwarePlugin
::
instance
();
break
;
case
MAV_TYPE_GROUND_ROVER
:
case
MAV_TYPE_SURFACE_BOAT
:
case
MAV_TYPE_SUBMARINE
:
return
ArduRoverFirmwarePlugin
::
instance
();
break
;
case
MAV_TYPE_GENERIC
:
case
MAV_TYPE_COAXIAL
:
case
MAV_TYPE_HELICOPTER
:
case
MAV_TYPE_ANTENNA_TRACKER
:
case
MAV_TYPE_GCS
:
case
MAV_TYPE_AIRSHIP
:
case
MAV_TYPE_FREE_BALLOON
:
case
MAV_TYPE_ROCKET
:
case
MAV_TYPE_GROUND_ROVER
:
case
MAV_TYPE_SURFACE_BOAT
:
case
MAV_TYPE_SUBMARINE
:
case
MAV_TYPE_FLAPPING_WING
:
case
MAV_TYPE_KITE
:
case
MAV_TYPE_ONBOARD_CONTROLLER
:
...
...
src/QGCApplication.cc
View file @
e0baebfc
...
...
@@ -74,6 +74,8 @@
#include "MultiVehicleManager.h"
#include "Generic/GenericFirmwarePlugin.h"
#include "APM/ArduCopterFirmwarePlugin.h"
#include "APM/ArduPlaneFirmwarePlugin.h"
#include "APM/ArduRoverFirmwarePlugin.h"
#include "PX4/PX4FirmwarePlugin.h"
#include "Vehicle.h"
#include "MavlinkQmlSingleton.h"
...
...
@@ -596,6 +598,8 @@ void QGCApplication::_createSingletons(void)
// No dependencies
firmwarePlugin
=
PX4FirmwarePlugin
::
_createSingleton
();
firmwarePlugin
=
ArduCopterFirmwarePlugin
::
_createSingleton
();
firmwarePlugin
=
ArduPlaneFirmwarePlugin
::
_createSingleton
();
firmwarePlugin
=
ArduRoverFirmwarePlugin
::
_createSingleton
();
// No dependencies
FirmwarePluginManager
*
firmwarePluginManager
=
FirmwarePluginManager
::
_createSingleton
();
...
...
@@ -673,6 +677,8 @@ void QGCApplication::_destroySingletons(void)
GenericFirmwarePlugin
::
_deleteSingleton
();
PX4FirmwarePlugin
::
_deleteSingleton
();
ArduCopterFirmwarePlugin
::
_deleteSingleton
();
ArduPlaneFirmwarePlugin
::
_deleteSingleton
();
ArduRoverFirmwarePlugin
::
_deleteSingleton
();
HomePositionManager
::
_deleteSingleton
();
FlightMapSettings
::
_deleteSingleton
();
}
...
...
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