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
a148e3e9
Commit
a148e3e9
authored
May 11, 2017
by
Jacob Walser
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use QList<FactGroup*> to expose firmwareplugin factgroups
parent
eba10f0c
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
53 additions
and
46 deletions
+53
-46
ArduSubFirmwarePlugin.cc
src/FirmwarePlugin/APM/ArduSubFirmwarePlugin.cc
+8
-7
ArduSubFirmwarePlugin.h
src/FirmwarePlugin/APM/ArduSubFirmwarePlugin.h
+35
-34
FirmwarePlugin.cc
src/FirmwarePlugin/FirmwarePlugin.cc
+4
-0
FirmwarePlugin.h
src/FirmwarePlugin/FirmwarePlugin.h
+3
-3
Vehicle.cc
src/Vehicle/Vehicle.cc
+3
-2
No files found.
src/FirmwarePlugin/APM/ArduSubFirmwarePlugin.cc
View file @
a148e3e9
...
...
@@ -40,7 +40,8 @@ APMSubMode::APMSubMode(uint32_t mode, bool settable) :
setEnumToStringMapping
(
enumToString
);
}
ArduSubFirmwarePlugin
::
ArduSubFirmwarePlugin
(
void
)
ArduSubFirmwarePlugin
::
ArduSubFirmwarePlugin
(
void
)
:
_infoFactGroup
(
this
)
{
QList
<
APMCustomMode
>
supportedFlightModes
;
supportedFlightModes
<<
APMSubMode
(
APMSubMode
::
MANUAL
,
true
);
...
...
@@ -100,7 +101,7 @@ ArduSubFirmwarePlugin::ArduSubFirmwarePlugin(void)
_remapParamNameIntialized
=
true
;
}
fwFactGroup
=
new
APMSubmarineFactGroup
(
this
);
_factGroups
.
append
(
&
_infoFactGroup
);
}
int
ArduSubFirmwarePlugin
::
remapParamNameHigestMinorVersionNumber
(
int
majorVersionNumber
)
const
...
...
@@ -166,15 +167,15 @@ void ArduSubFirmwarePlugin::_handleNamedValueFloat(mavlink_message_t* message)
QString
name
=
QString
(
value
.
name
);
if
(
name
==
"CamTilt"
)
{
fwFactGroup
->
getFact
(
"camera tilt"
)
->
setRawValue
(
value
.
value
*
100
);
_infoFactGroup
.
getFact
(
"camera tilt"
)
->
setRawValue
(
value
.
value
*
100
);
}
else
if
(
name
==
"TetherTrn"
)
{
fwFactGroup
->
getFact
(
"tether turns"
)
->
setRawValue
(
value
.
value
);
_infoFactGroup
.
getFact
(
"tether turns"
)
->
setRawValue
(
value
.
value
);
}
else
if
(
name
==
"Lights1"
)
{
fwFactGroup
->
getFact
(
"lights 1"
)
->
setRawValue
(
value
.
value
*
100
);
_infoFactGroup
.
getFact
(
"lights 1"
)
->
setRawValue
(
value
.
value
*
100
);
}
else
if
(
name
==
"Lights2"
)
{
fwFactGroup
->
getFact
(
"lights 2"
)
->
setRawValue
(
value
.
value
*
100
);
_infoFactGroup
.
getFact
(
"lights 2"
)
->
setRawValue
(
value
.
value
*
100
);
}
else
if
(
name
==
"PilotGain"
)
{
fwFactGroup
->
getFact
(
"pilot gain"
)
->
setRawValue
(
value
.
value
*
100
);
_infoFactGroup
.
getFact
(
"pilot gain"
)
->
setRawValue
(
value
.
value
*
100
);
}
}
...
...
src/FirmwarePlugin/APM/ArduSubFirmwarePlugin.h
View file @
a148e3e9
...
...
@@ -28,6 +28,40 @@
#define ArduSubFirmwarePlugin_H
#include "APMFirmwarePlugin.h"
class
APMSubmarineFactGroup
:
public
FactGroup
{
Q_OBJECT
public:
APMSubmarineFactGroup
(
QObject
*
parent
=
NULL
);
Q_PROPERTY
(
Fact
*
camTilt
READ
camTilt
CONSTANT
)
Q_PROPERTY
(
Fact
*
tetherTurns
READ
tetherTurns
CONSTANT
)
Q_PROPERTY
(
Fact
*
lightsLevel1
READ
lightsLevel1
CONSTANT
)
Q_PROPERTY
(
Fact
*
lightsLevel2
READ
lightsLevel2
CONSTANT
)
Q_PROPERTY
(
Fact
*
pilotGain
READ
pilotGain
CONSTANT
)
Fact
*
camTilt
(
void
)
{
return
&
_camTiltFact
;
}
Fact
*
tetherTurns
(
void
)
{
return
&
_tetherTurnsFact
;
}
Fact
*
lightsLevel1
(
void
)
{
return
&
_lightsLevel1Fact
;
}
Fact
*
lightsLevel2
(
void
)
{
return
&
_lightsLevel2Fact
;
}
Fact
*
pilotGain
(
void
)
{
return
&
_pilotGainFact
;
}
static
const
char
*
_camTiltFactName
;
static
const
char
*
_tetherTurnsFactName
;
static
const
char
*
_lightsLevel1FactName
;
static
const
char
*
_lightsLevel2FactName
;
static
const
char
*
_pilotGainFactName
;
static
const
char
*
_settingsGroup
;
private:
Fact
_camTiltFact
;
Fact
_tetherTurnsFact
;
Fact
_lightsLevel1Fact
;
Fact
_lightsLevel2Fact
;
Fact
_pilotGainFact
;
};
class
APMSubMode
:
public
APMCustomMode
{
...
...
@@ -97,40 +131,7 @@ private:
static
FirmwarePlugin
::
remapParamNameMajorVersionMap_t
_remapParamName
;
void
_handleNamedValueFloat
(
mavlink_message_t
*
message
);
void
_handleMavlinkMessage
(
mavlink_message_t
*
message
);
};
class
APMSubmarineFactGroup
:
public
FactGroup
{
Q_OBJECT
public:
APMSubmarineFactGroup
(
QObject
*
parent
=
NULL
);
Q_PROPERTY
(
Fact
*
camTilt
READ
camTilt
CONSTANT
)
Q_PROPERTY
(
Fact
*
tetherTurns
READ
tetherTurns
CONSTANT
)
Q_PROPERTY
(
Fact
*
lightsLevel1
READ
lightsLevel1
CONSTANT
)
Q_PROPERTY
(
Fact
*
lightsLevel2
READ
lightsLevel2
CONSTANT
)
Q_PROPERTY
(
Fact
*
pilotGain
READ
pilotGain
CONSTANT
)
Fact
*
camTilt
(
void
)
{
return
&
_camTiltFact
;
}
Fact
*
tetherTurns
(
void
)
{
return
&
_tetherTurnsFact
;
}
Fact
*
lightsLevel1
(
void
)
{
return
&
_lightsLevel1Fact
;
}
Fact
*
lightsLevel2
(
void
)
{
return
&
_lightsLevel2Fact
;
}
Fact
*
pilotGain
(
void
)
{
return
&
_pilotGainFact
;
}
static
const
char
*
_camTiltFactName
;
static
const
char
*
_tetherTurnsFactName
;
static
const
char
*
_lightsLevel1FactName
;
static
const
char
*
_lightsLevel2FactName
;
static
const
char
*
_pilotGainFactName
;
static
const
char
*
_settingsGroup
;
private:
Fact
_camTiltFact
;
Fact
_tetherTurnsFact
;
Fact
_lightsLevel1Fact
;
Fact
_lightsLevel2Fact
;
Fact
_pilotGainFact
;
APMSubmarineFactGroup
_infoFactGroup
;
};
#endif
src/FirmwarePlugin/FirmwarePlugin.cc
View file @
a148e3e9
...
...
@@ -419,6 +419,10 @@ const QVariantList& FirmwarePlugin::cameraList(const Vehicle* vehicle)
return
_cameraList
;
}
QList
<
FactGroup
*>
FirmwarePlugin
::
factGroups
(
void
)
{
return
_factGroups
;
}
bool
FirmwarePlugin
::
vehicleYawsToNextWaypointInMission
(
const
Vehicle
*
vehicle
)
const
{
return
vehicle
->
multiRotor
()
?
false
:
true
;
...
...
src/FirmwarePlugin/FirmwarePlugin.h
View file @
a148e3e9
...
...
@@ -273,6 +273,8 @@ public:
/// Returns a list of CameraMetaData objects for available cameras on the vehicle.
virtual
const
QVariantList
&
cameraList
(
const
Vehicle
*
vehicle
);
virtual
QList
<
FactGroup
*>
factGroups
(
void
);
/// @true: When flying a mission the vehicle is always facing towards the next waypoint
virtual
bool
vehicleYawsToNextWaypointInMission
(
const
Vehicle
*
vehicle
)
const
;
...
...
@@ -295,13 +297,11 @@ public:
// FIXME: Hack workaround for non pluginize FollowMe support
static
const
char
*
px4FollowMeFlightMode
;
/// Used to add additional firmware-specific facts to the vehicle values widget
FactGroup
*
fwFactGroup
=
NULL
;
protected:
// Arms the vehicle with validation and retries
// @return: true - vehicle armed, false - vehicle failed to arm
bool
_armVehicleAndValidate
(
Vehicle
*
vehicle
);
QList
<
FactGroup
*>
_factGroups
;
// Sets the vehicle to the specified flight mode with validation and retries
// @return: true - vehicle in specified flight mode, false - flight mode change failed
...
...
src/Vehicle/Vehicle.cc
View file @
a148e3e9
...
...
@@ -373,8 +373,9 @@ void Vehicle::_commonInit(void)
_addFactGroup
(
&
_temperatureFactGroup
,
_temperatureFactGroupName
);
// Add firmware-specific fact group, if provided
if
(
_firmwarePlugin
->
fwFactGroup
)
{
_addFactGroup
(
_firmwarePlugin
->
fwFactGroup
,
"FWPlugin"
);
QList
<
FactGroup
*>
fwFactGroups
=
_firmwarePlugin
->
factGroups
();
for
(
int
i
=
0
;
i
<
fwFactGroups
.
count
();
i
++
)
{
_addFactGroup
(
fwFactGroups
[
i
],
QString
(
"FWPlugin%1"
).
arg
(
i
));
}
_flightDistanceFact
.
setRawValue
(
0
);
...
...
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