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
7285dfb5
Commit
7285dfb5
authored
Mar 02, 2016
by
Don Gagne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Talking battery and flight modes
parent
33edc725
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
267 additions
and
78 deletions
+267
-78
BatteryFact.json
src/Vehicle/BatteryFact.json
+10
-0
Vehicle.cc
src/Vehicle/Vehicle.cc
+176
-49
Vehicle.h
src/Vehicle/Vehicle.h
+53
-29
GeneralSettings.qml
src/ui/preferences/GeneralSettings.qml
+28
-0
No files found.
src/Vehicle/BatteryFact.json
View file @
7285dfb5
...
...
@@ -16,6 +16,16 @@
"decimalPlaces"
:
0
,
"units"
:
"%"
},
{
"name"
:
"percentRemainingAnnounce"
,
"shortDescription"
:
"Percent"
,
"type"
:
"int32"
,
"decimalPlaces"
:
0
,
"units"
:
"%"
,
"defaultValue"
:
30
,
"min"
:
0
,
"max"
:
100
},
{
"name"
:
"mahConsumed"
,
"shortDescription"
:
"Consumed"
,
...
...
src/Vehicle/Vehicle.cc
View file @
7285dfb5
This diff is collapsed.
Click to expand it.
src/Vehicle/Vehicle.h
View file @
7285dfb5
...
...
@@ -29,6 +29,7 @@
#include <QObject>
#include <QGeoCoordinate>
#include <QElapsedTimer>
#include "FactGroup.h"
#include "LinkInterface.h"
...
...
@@ -36,6 +37,7 @@
#include "QmlObjectListModel.h"
#include "MAVLinkProtocol.h"
#include "UASMessageHandler.h"
#include "SettingsFact.h"
class
UAS
;
class
UASInterface
;
...
...
@@ -66,12 +68,12 @@ public:
Q_PROPERTY
(
Fact
*
clipCount2
READ
clipCount2
CONSTANT
)
Q_PROPERTY
(
Fact
*
clipCount3
READ
clipCount3
CONSTANT
)
Fact
*
xAxis
(
void
)
{
return
&
_xAxisFact
;
}
Fact
*
yAxis
(
void
)
{
return
&
_yAxisFact
;
}
Fact
*
zAxis
(
void
)
{
return
&
_zAxisFact
;
}
Fact
*
clipCount1
(
void
)
{
return
&
_clipCount1Fact
;
}
Fact
*
clipCount2
(
void
)
{
return
&
_clipCount2Fact
;
}
Fact
*
clipCount3
(
void
)
{
return
&
_clipCount3Fact
;
}
Fact
*
xAxis
(
void
)
{
return
&
_xAxisFact
;
}
Fact
*
yAxis
(
void
)
{
return
&
_yAxisFact
;
}
Fact
*
zAxis
(
void
)
{
return
&
_zAxisFact
;
}
Fact
*
clipCount1
(
void
)
{
return
&
_clipCount1Fact
;
}
Fact
*
clipCount2
(
void
)
{
return
&
_clipCount2Fact
;
}
Fact
*
clipCount3
(
void
)
{
return
&
_clipCount3Fact
;
}
void
setVehicle
(
Vehicle
*
vehicle
);
...
...
@@ -103,9 +105,9 @@ public:
Q_PROPERTY
(
Fact
*
speed
READ
speed
CONSTANT
)
Q_PROPERTY
(
Fact
*
verticalSpeed
READ
verticalSpeed
CONSTANT
)
Fact
*
direction
(
void
)
{
return
&
_directionFact
;
}
Fact
*
speed
(
void
)
{
return
&
_speedFact
;
}
Fact
*
verticalSpeed
(
void
)
{
return
&
_verticalSpeedFact
;
}
Fact
*
direction
(
void
)
{
return
&
_directionFact
;
}
Fact
*
speed
(
void
)
{
return
&
_speedFact
;
}
Fact
*
verticalSpeed
(
void
)
{
return
&
_verticalSpeedFact
;
}
void
setVehicle
(
Vehicle
*
vehicle
);
...
...
@@ -133,11 +135,11 @@ public:
Q_PROPERTY
(
Fact
*
count
READ
count
CONSTANT
)
Q_PROPERTY
(
Fact
*
lock
READ
lock
CONSTANT
)
Fact
*
hdop
(
void
)
{
return
&
_hdopFact
;
}
Fact
*
vdop
(
void
)
{
return
&
_vdopFact
;
}
Fact
*
courseOverGround
(
void
)
{
return
&
_courseOverGroundFact
;
}
Fact
*
count
(
void
)
{
return
&
_countFact
;
}
Fact
*
lock
(
void
)
{
return
&
_lockFact
;
}
Fact
*
hdop
(
void
)
{
return
&
_hdopFact
;
}
Fact
*
vdop
(
void
)
{
return
&
_vdopFact
;
}
Fact
*
courseOverGround
(
void
)
{
return
&
_courseOverGroundFact
;
}
Fact
*
count
(
void
)
{
return
&
_countFact
;
}
Fact
*
lock
(
void
)
{
return
&
_lockFact
;
}
void
setVehicle
(
Vehicle
*
vehicle
);
...
...
@@ -175,24 +177,33 @@ public:
Q_PROPERTY
(
Fact
*
mahConsumed
READ
mahConsumed
CONSTANT
)
Q_PROPERTY
(
Fact
*
current
READ
current
CONSTANT
)
Q_PROPERTY
(
Fact
*
temperature
READ
temperature
CONSTANT
)
Q_PROPERTY
(
Fact
*
cellCount
READ
cellCount
CONSTANT
)
Q_PROPERTY
(
Fact
*
cellCount
READ
cellCount
CONSTANT
)
/// If percentRemaining falls below this value, warning will be output through speech
Q_PROPERTY
(
Fact
*
percentRemainingAnnounce
READ
percentRemainingAnnounce
CONSTANT
)
Fact
*
voltage
(
void
)
{
return
&
_voltageFact
;
}
Fact
*
percentRemaining
(
void
)
{
return
&
_percentRemainingFact
;
}
Fact
*
percentRemainingAnnounce
(
void
)
{
return
&
_percentRemainingAnnounceFact
;
}
Fact
*
mahConsumed
(
void
)
{
return
&
_mahConsumedFact
;
}
Fact
*
current
(
void
)
{
return
&
_currentFact
;
}
Fact
*
temperature
(
void
)
{
return
&
_temperatureFact
;
}
Fact
*
cellCount
(
void
)
{
return
&
_cellCountFact
;
}
Fact
*
voltage
(
void
)
{
return
&
_voltageFact
;
}
Fact
*
percentRemaining
(
void
)
{
return
&
_percentRemainingFact
;
}
Fact
*
mahConsumed
(
void
)
{
return
&
_mahConsumedFact
;
}
Fact
*
current
(
void
)
{
return
&
_currentFact
;
}
Fact
*
temperature
(
void
)
{
return
&
_temperatureFact
;
}
Fact
*
cellCount
(
void
)
{
return
&
_cellCountFact
;
}
void
setVehicle
(
Vehicle
*
vehicle
);
static
const
char
*
_voltageFactName
;
static
const
char
*
_percentRemainingFactName
;
static
const
char
*
_percentRemainingAnnounceFactName
;
static
const
char
*
_mahConsumedFactName
;
static
const
char
*
_currentFactName
;
static
const
char
*
_temperatureFactName
;
static
const
char
*
_cellCountFactName
;
static
const
char
*
_settingsGroup
;
static
const
int
_percentRemainingAnnounceDefault
;
static
const
double
_voltageUnavailable
;
static
const
int
_percentRemainingUnavailable
;
static
const
int
_mahConsumedUnavailable
;
...
...
@@ -201,13 +212,15 @@ public:
static
const
int
_cellCountUnavailable
;
private:
Vehicle
*
_vehicle
;
Fact
_voltageFact
;
Fact
_percentRemainingFact
;
Fact
_mahConsumedFact
;
Fact
_currentFact
;
Fact
_temperatureFact
;
Fact
_cellCountFact
;
Vehicle
*
_vehicle
;
Fact
_voltageFact
;
Fact
_percentRemainingFact
;
Fact
_mahConsumedFact
;
Fact
_currentFact
;
Fact
_temperatureFact
;
Fact
_cellCountFact
;
static
SettingsFact
_percentRemainingAnnounceFact
;
};
class
Vehicle
:
public
FactGroup
...
...
@@ -222,6 +235,11 @@ public:
FirmwarePluginManager
*
firmwarePluginManager
,
AutoPilotPluginManager
*
autopilotPluginManager
,
JoystickManager
*
joystickManager
);
// The following is used to create a disconnected Vehicle. A disconnected vehicle is primarily used to access FactGroup information
// without needing a real connection.
Vehicle
(
QObject
*
parent
=
NULL
);
~
Vehicle
();
Q_PROPERTY
(
int
id
READ
id
CONSTANT
)
...
...
@@ -505,6 +523,7 @@ private slots:
void
_addNewMapTrajectoryPoint
(
void
);
void
_parametersReady
(
bool
parametersReady
);
void
_remoteControlRSSIChanged
(
uint8_t
rssi
);
void
_announceflightModeChanged
(
const
QString
&
flightMode
);
void
_handleTextMessage
(
int
newCount
);
void
_handletextMessageReceived
(
UASMessage
*
message
);
...
...
@@ -540,11 +559,13 @@ private:
void
_mapTrajectoryStart
(
void
);
void
_mapTrajectoryStop
(
void
);
void
_connectionActive
(
void
);
void
_say
(
const
QString
&
text
,
int
severity
);
void
_say
(
const
QString
&
text
);
QString
_vehicleIdSpeech
(
void
);
private:
int
_id
;
///< Mavlink system id
bool
_active
;
bool
_disconnectedVehicle
;
///< This Vehicle is a "disconnected" vehicle for ui use when no active vehicle is available
MAV_AUTOPILOT
_firmwareType
;
MAV_TYPE
_vehicleType
;
...
...
@@ -635,6 +656,9 @@ private:
uint8_t
_compID
;
bool
_heardFrom
;
static
const
int
_lowBatteryAnnounceRepeatMSecs
;
// Amount of time in between each low battery announcement
QElapsedTimer
_lowBatteryAnnounceTimer
;
// FactGroup facts
Fact
_rollFact
;
...
...
src/ui/preferences/GeneralSettings.qml
View file @
7285dfb5
...
...
@@ -40,6 +40,8 @@ Rectangle {
anchors.fill
:
parent
anchors.margins
:
ScreenTools
.
defaultFontPixelWidth
property
Fact
_percentRemainingAnnounce
:
QGroundControl
.
multiVehicleManager
.
disconnectedVehicle
.
battery
.
percentRemainingAnnounce
QGCPalette
{
id
:
qgcPal
colorGroupEnabled
:
enabled
...
...
@@ -127,6 +129,32 @@ Rectangle {
}
}
}
//-----------------------------------------------------------------
//-- Battery talker
Row
{
spacing
:
ScreenTools
.
defaultFontPixelWidth
QGCCheckBox
{
id
:
announcePercentCheckbox
anchors.baseline
:
announcePercent
.
baseline
text
:
"
Announce battery percent lower than:
"
checked
:
_percentRemainingAnnounce
.
value
!=
0
onClicked
:
{
if
(
checked
)
{
_percentRemainingAnnounce
.
value
=
_percentRemainingAnnounce
.
defaultValueString
}
else
{
_percentRemainingAnnounce
.
value
=
0
}
}
}
FactTextField
{
id
:
announcePercent
fact
:
_percentRemainingAnnounce
enabled
:
announcePercentCheckbox
.
checked
}
}
Item
{
height
:
ScreenTools
.
defaultFontPixelHeight
/
2
...
...
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