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
46cfbbe9
Commit
46cfbbe9
authored
Oct 10, 2015
by
Don Gagne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add support for MAV_TYPE specific FirmwarePlugin
parent
e5a94ef2
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
194 additions
and
18 deletions
+194
-18
QGCApplication.pro
QGCApplication.pro
+2
-0
APMFirmwarePlugin.cc
src/FirmwarePlugin/APM/APMFirmwarePlugin.cc
+0
-1
APMFirmwarePlugin.h
src/FirmwarePlugin/APM/APMFirmwarePlugin.h
+7
-5
ArduCopterFirmwarePlugin.cc
src/FirmwarePlugin/APM/ArduCopterFirmwarePlugin.cc
+81
-0
ArduCopterFirmwarePlugin.h
src/FirmwarePlugin/APM/ArduCopterFirmwarePlugin.h
+53
-0
FirmwarePluginManager.cc
src/FirmwarePlugin/FirmwarePluginManager.cc
+38
-3
FirmwarePluginManager.h
src/FirmwarePlugin/FirmwarePluginManager.h
+2
-1
QGCApplication.cc
src/QGCApplication.cc
+3
-3
MultiVehicleManager.cc
src/Vehicle/MultiVehicleManager.cc
+1
-1
Vehicle.cc
src/Vehicle/Vehicle.cc
+3
-2
Vehicle.h
src/Vehicle/Vehicle.h
+3
-1
UAS.cc
src/uas/UAS.cc
+1
-1
No files found.
QGCApplication.pro
View file @
46cfbbe9
...
...
@@ -577,6 +577,7 @@ HEADERS+= \
src
/
FirmwarePlugin
/
FirmwarePluginManager
.
h
\
src
/
FirmwarePlugin
/
FirmwarePlugin
.
h
\
src
/
FirmwarePlugin
/
APM
/
APMFirmwarePlugin
.
h
\
src
/
FirmwarePlugin
/
APM
/
ArduCopterFirmwarePlugin
.
h
\
src
/
FirmwarePlugin
/
Generic
/
GenericFirmwarePlugin
.
h
\
src
/
FirmwarePlugin
/
PX4
/
PX4FirmwarePlugin
.
h
\
src
/
Vehicle
/
MultiVehicleManager
.
h
\
...
...
@@ -614,6 +615,7 @@ SOURCES += \
src
/
AutoPilotPlugins
/
PX4
/
SensorsComponent
.
cc
\
src
/
AutoPilotPlugins
/
PX4
/
SensorsComponentController
.
cc
\
src
/
FirmwarePlugin
/
APM
/
APMFirmwarePlugin
.
cc
\
src
/
FirmwarePlugin
/
APM
/
ArduCopterFirmwarePlugin
.
cc
\
src
/
FirmwarePlugin
/
FirmwarePluginManager
.
cc
\
src
/
FirmwarePlugin
/
Generic
/
GenericFirmwarePlugin
.
cc
\
src
/
FirmwarePlugin
/
PX4
/
PX4FirmwarePlugin
.
cc
\
...
...
src/FirmwarePlugin/APM/APMFirmwarePlugin.cc
View file @
46cfbbe9
...
...
@@ -30,7 +30,6 @@
#include <QDebug>
IMPLEMENT_QGC_SINGLETON
(
APMFirmwarePlugin
,
FirmwarePlugin
)
QGC_LOGGING_CATEGORY
(
APMFirmwarePluginLog
,
"APMFirmwarePluginLog"
)
static
const
QRegExp
APM_COPTER_REXP
(
"^(ArduCopter|APM:Copter)"
);
...
...
src/FirmwarePlugin/APM/APMFirmwarePlugin.h
View file @
46cfbbe9
...
...
@@ -28,8 +28,9 @@
#define APMFirmwarePlugin_H
#include "FirmwarePlugin.h"
#include "QGCLoggingCategory.h"
Q_DECLARE_LOGGING_CATEGORY
(
APMFirmwarePluginLog
sLog
)
Q_DECLARE_LOGGING_CATEGORY
(
APMFirmwarePluginLog
)
class
APMFirmwareVersion
{
...
...
@@ -54,11 +55,10 @@ private:
int
_patch
;
};
/// This is the base class for all stack specific APM firmware plugins
class
APMFirmwarePlugin
:
public
FirmwarePlugin
{
Q_OBJECT
DECLARE_QGC_SINGLETON
(
APMFirmwarePlugin
,
FirmwarePlugin
)
public:
// Overrides from FirmwarePlugin
...
...
@@ -71,9 +71,11 @@ public:
virtual
void
adjustMavlinkMessage
(
mavlink_message_t
*
message
);
virtual
void
initializeVehicle
(
Vehicle
*
vehicle
);
pr
ivate
:
/// All access to singleton is through
AutoPilotPluginManager::instance
pr
otected
:
/// All access to singleton is through
stack specific implementation
APMFirmwarePlugin
(
QObject
*
parent
=
NULL
);
private:
void
_adjustSeverity
(
mavlink_message_t
*
message
)
const
;
static
bool
_isTextSeverityAdjustmentNeeded
(
const
APMFirmwareVersion
&
firmwareVersion
);
...
...
src/FirmwarePlugin/APM/ArduCopterFirmwarePlugin.cc
0 → 100644
View file @
46cfbbe9
/*=====================================================================
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 Don Gagne <don@thegagnes.com>
#include "ArduCopterFirmwarePlugin.h"
#include "Generic/GenericFirmwarePlugin.h"
#include "QGCMAVLink.h"
#include <QDebug>
IMPLEMENT_QGC_SINGLETON
(
ArduCopterFirmwarePlugin
,
ArduCopterFirmwarePlugin
)
ArduCopterFirmwarePlugin
::
ArduCopterFirmwarePlugin
(
QObject
*
parent
)
:
APMFirmwarePlugin
(
parent
)
{
}
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
)
{
Q_UNUSED
(
flightMode
);
Q_UNUSED
(
base_mode
);
Q_UNUSED
(
custom_mode
);
qWarning
()
<<
"ArduCopterFirmwarePlugin::setFlightMode called on base class, not supported"
;
return
false
;
}
src/FirmwarePlugin/APM/ArduCopterFirmwarePlugin.h
0 → 100644
View file @
46cfbbe9
/*=====================================================================
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>
#ifndef ArduCopterFirmwarePlugin_H
#define ArduCopterFirmwarePlugin_H
#include "APMFirmwarePlugin.h"
class
ArduCopterFirmwarePlugin
:
public
APMFirmwarePlugin
{
Q_OBJECT
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
);
private:
};
#endif
src/FirmwarePlugin/FirmwarePluginManager.cc
View file @
46cfbbe9
...
...
@@ -26,7 +26,7 @@
#include "FirmwarePluginManager.h"
#include "Generic/GenericFirmwarePlugin.h"
#include "APM/A
PM
FirmwarePlugin.h"
#include "APM/A
rduCopter
FirmwarePlugin.h"
#include "PX4/PX4FirmwarePlugin.h"
IMPLEMENT_QGC_SINGLETON
(
FirmwarePluginManager
,
FirmwarePluginManager
)
...
...
@@ -42,11 +42,46 @@ FirmwarePluginManager::~FirmwarePluginManager()
}
FirmwarePlugin
*
FirmwarePluginManager
::
firmwarePluginForAutopilot
(
MAV_AUTOPILOT
autopilotType
)
FirmwarePlugin
*
FirmwarePluginManager
::
firmwarePluginForAutopilot
(
MAV_AUTOPILOT
autopilotType
,
MAV_TYPE
vehicleType
)
{
switch
(
autopilotType
)
{
case
MAV_AUTOPILOT_ARDUPILOTMEGA
:
return
APMFirmwarePlugin
::
instance
();
switch
(
vehicleType
)
{
case
MAV_TYPE_QUADROTOR
:
case
MAV_TYPE_HEXAROTOR
:
case
MAV_TYPE_OCTOROTOR
:
case
MAV_TYPE_TRICOPTER
:
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
:
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
:
case
MAV_TYPE_VTOL_DUOROTOR
:
case
MAV_TYPE_VTOL_QUADROTOR
:
case
MAV_TYPE_VTOL_TILTROTOR
:
case
MAV_TYPE_VTOL_RESERVED2
:
case
MAV_TYPE_VTOL_RESERVED3
:
case
MAV_TYPE_VTOL_RESERVED4
:
case
MAV_TYPE_VTOL_RESERVED5
:
case
MAV_TYPE_GIMBAL
:
default:
return
GenericFirmwarePlugin
::
instance
();
break
;
}
case
MAV_AUTOPILOT_PX4
:
return
PX4FirmwarePlugin
::
instance
();
default:
...
...
src/FirmwarePlugin/FirmwarePluginManager.h
View file @
46cfbbe9
...
...
@@ -44,8 +44,9 @@ class FirmwarePluginManager : public QGCSingleton
public:
/// Returns appropriate plugin for autopilot type.
/// @param autopilotType Type of autopilot to return plugin for.
/// @param vehicleType Vehicle type of autopilot to return plugin for.
/// @return Singleton FirmwarePlugin instance for the specified MAV_AUTOPILOT.
FirmwarePlugin
*
firmwarePluginForAutopilot
(
MAV_AUTOPILOT
autopilotType
);
FirmwarePlugin
*
firmwarePluginForAutopilot
(
MAV_AUTOPILOT
autopilotType
,
MAV_TYPE
vehicleType
);
private:
/// All access to singleton is through FirmwarePluginManager::instance
...
...
src/QGCApplication.cc
View file @
46cfbbe9
...
...
@@ -74,7 +74,7 @@
#include "FirmwarePluginManager.h"
#include "MultiVehicleManager.h"
#include "Generic/GenericFirmwarePlugin.h"
#include "APM/A
PM
FirmwarePlugin.h"
#include "APM/A
rduCopter
FirmwarePlugin.h"
#include "PX4/PX4FirmwarePlugin.h"
#include "Vehicle.h"
#include "MavlinkQmlSingleton.h"
...
...
@@ -597,7 +597,7 @@ void QGCApplication::_createSingletons(void)
// No dependencies
firmwarePlugin
=
PX4FirmwarePlugin
::
_createSingleton
();
firmwarePlugin
=
A
PM
FirmwarePlugin
::
_createSingleton
();
firmwarePlugin
=
A
rduCopter
FirmwarePlugin
::
_createSingleton
();
// No dependencies
FirmwarePluginManager
*
firmwarePluginManager
=
FirmwarePluginManager
::
_createSingleton
();
...
...
@@ -673,7 +673,7 @@ void QGCApplication::_destroySingletons(void)
FirmwarePluginManager
::
_deleteSingleton
();
GenericFirmwarePlugin
::
_deleteSingleton
();
PX4FirmwarePlugin
::
_deleteSingleton
();
A
PM
FirmwarePlugin
::
_deleteSingleton
();
A
rduCopter
FirmwarePlugin
::
_deleteSingleton
();
HomePositionManager
::
_deleteSingleton
();
FlightMapSettings
::
_deleteSingleton
();
}
...
...
src/Vehicle/MultiVehicleManager.cc
View file @
46cfbbe9
...
...
@@ -64,7 +64,7 @@ bool MultiVehicleManager::notifyHeartbeatInfo(LinkInterface* link, int vehicleId
return
false
;
}
Vehicle
*
vehicle
=
new
Vehicle
(
link
,
vehicleId
,
(
MAV_AUTOPILOT
)
heartbeat
.
autopilot
);
Vehicle
*
vehicle
=
new
Vehicle
(
link
,
vehicleId
,
(
MAV_AUTOPILOT
)
heartbeat
.
autopilot
,
(
MAV_TYPE
)
heartbeat
.
type
);
if
(
!
vehicle
)
{
qWarning
()
<<
"New Vehicle allocation failed"
;
...
...
src/Vehicle/Vehicle.cc
View file @
46cfbbe9
...
...
@@ -42,10 +42,11 @@ const char* Vehicle::_settingsGroup = "Vehicle%1"; // %1 re
const
char
*
Vehicle
::
_joystickModeSettingsKey
=
"JoystickMode"
;
const
char
*
Vehicle
::
_joystickEnabledSettingsKey
=
"JoystickEnabled"
;
Vehicle
::
Vehicle
(
LinkInterface
*
link
,
int
vehicleId
,
MAV_AUTOPILOT
firmwareType
)
Vehicle
::
Vehicle
(
LinkInterface
*
link
,
int
vehicleId
,
MAV_AUTOPILOT
firmwareType
,
MAV_TYPE
vehicleType
)
:
_id
(
vehicleId
)
,
_active
(
false
)
,
_firmwareType
(
firmwareType
)
,
_vehicleType
(
vehicleType
)
,
_firmwarePlugin
(
NULL
)
,
_autopilotPlugin
(
NULL
)
,
_joystickMode
(
JoystickModeRC
)
...
...
@@ -106,7 +107,7 @@ Vehicle::Vehicle(LinkInterface* link, int vehicleId, MAV_AUTOPILOT firmwareType)
connect
(
_uas
,
&
UAS
::
latitudeChanged
,
this
,
&
Vehicle
::
setLatitude
);
connect
(
_uas
,
&
UAS
::
longitudeChanged
,
this
,
&
Vehicle
::
setLongitude
);
_firmwarePlugin
=
FirmwarePluginManager
::
instance
()
->
firmwarePluginForAutopilot
(
firmwareType
);
_firmwarePlugin
=
FirmwarePluginManager
::
instance
()
->
firmwarePluginForAutopilot
(
_firmwareType
,
_vehicleType
);
_autopilotPlugin
=
AutoPilotPluginManager
::
instance
()
->
newAutopilotPluginForVehicle
(
this
);
connect
(
_autopilotPlugin
,
&
AutoPilotPlugin
::
missingParametersChanged
,
this
,
&
Vehicle
::
missingParametersChanged
);
...
...
src/Vehicle/Vehicle.h
View file @
46cfbbe9
...
...
@@ -51,7 +51,7 @@ class Vehicle : public QObject
Q_OBJECT
public:
Vehicle
(
LinkInterface
*
link
,
int
vehicleId
,
MAV_AUTOPILOT
firmwareType
);
Vehicle
(
LinkInterface
*
link
,
int
vehicleId
,
MAV_AUTOPILOT
firmwareType
,
MAV_TYPE
vehicleType
);
~
Vehicle
();
Q_PROPERTY
(
int
id
READ
id
CONSTANT
)
...
...
@@ -147,6 +147,7 @@ public:
// Property accesors
int
id
(
void
)
{
return
_id
;
}
MAV_AUTOPILOT
firmwareType
(
void
)
{
return
_firmwareType
;
}
MAV_TYPE
vehicleType
(
void
)
{
return
_vehicleType
;
}
/// Sends this specified message to all links accociated with this vehicle
void
sendMessage
(
mavlink_message_t
message
);
...
...
@@ -344,6 +345,7 @@ private:
bool
_active
;
MAV_AUTOPILOT
_firmwareType
;
MAV_TYPE
_vehicleType
;
FirmwarePlugin
*
_firmwarePlugin
;
AutoPilotPlugin
*
_autopilotPlugin
;
MAVLinkProtocol
*
_mavlink
;
...
...
src/uas/UAS.cc
View file @
46cfbbe9
...
...
@@ -388,7 +388,7 @@ void UAS::receiveMessage(mavlink_message_t message)
bool
statechanged
=
false
;
bool
modechanged
=
false
;
QString
audiomodeText
=
FirmwarePluginManager
::
instance
()
->
firmwarePluginForAutopilot
((
MAV_AUTOPILOT
)
autopilot
)
->
flightMode
(
state
.
base_mode
,
state
.
custom_mode
);
QString
audiomodeText
=
FirmwarePluginManager
::
instance
()
->
firmwarePluginForAutopilot
((
MAV_AUTOPILOT
)
state
.
autopilot
,
(
MAV_TYPE
)
state
.
type
)
->
flightMode
(
state
.
base_mode
,
state
.
custom_mode
);
if
((
state
.
system_status
!=
this
->
status
)
&&
state
.
system_status
!=
MAV_STATE_UNINIT
)
{
...
...
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