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
146474c9
Commit
146474c9
authored
Apr 29, 2010
by
lm
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Onboard params work on console
parent
6c0d0f01
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
73 additions
and
13 deletions
+73
-13
GAudioOutput.cc
src/GAudioOutput.cc
+12
-0
GAudioOutput.h
src/GAudioOutput.h
+2
-0
UAS.cc
src/uas/UAS.cc
+34
-1
UAS.h
src/uas/UAS.h
+6
-0
ParameterInterface.cc
src/ui/ParameterInterface.cc
+1
-6
ParamTreeModel.cc
src/ui/param/ParamTreeModel.cc
+16
-6
ParamTreeModel.h
src/ui/param/ParamTreeModel.h
+2
-0
No files found.
src/GAudioOutput.cc
View file @
146474c9
...
...
@@ -197,6 +197,18 @@ bool GAudioOutput::startEmergency()
return
true
;
}
/**
* The emergency sound will be played continously during the emergency.
* call stopEmergency() to disable it again. No speech synthesis or other
* audio output is available during the emergency.
*
* @return true if the emergency could be started, false else
*/
bool
GAudioOutput
::
startEmergency
(
QString
message
)
{
return
startEmergency
();
}
/**
* Stops the continous emergency sound. Use startEmergency() to start
* the emergency sound.
...
...
src/GAudioOutput.h
View file @
146474c9
...
...
@@ -77,6 +77,8 @@ public slots:
bool
alert
(
QString
text
);
/** @brief Start emergency sound */
bool
startEmergency
();
/** @brief Start emergency sound */
bool
startEmergency
(
QString
);
/** @brief Stop emergency sound */
bool
stopEmergency
();
/** @brief Select female voice */
...
...
src/uas/UAS.cc
View file @
146474c9
...
...
@@ -67,7 +67,8 @@ UAS::UAS(MAVLinkProtocol* protocol, int id) :
manualThrust
(
0
),
receiveDropRate
(
0
),
sendDropRate
(
0
),
unknownPackets
()
unknownPackets
(),
lowBattAlarm
(
false
)
{
setBattery
(
LIPOLY
,
3
);
mavlink
=
protocol
;
...
...
@@ -181,6 +182,17 @@ void UAS::receiveMessage(LinkInterface* link, mavlink_message_t message)
emit
batteryChanged
(
this
,
lpVoltage
,
getChargeLevel
(),
timeRemaining
);
emit
voltageChanged
(
message
.
sysid
,
state
.
vbat
/
1000.0
f
);
// LOW BATTERY ALARM
float
chargeLevel
=
getChargeLevel
();
if
(
chargeLevel
<=
10.0
f
)
{
startLowBattAlarm
();
}
else
{
stopLowBattAlarm
();
}
// COMMUNICATIONS DROP RATE
emit
dropRateChanged
(
this
->
getUASID
(),
this
->
receiveDropRate
,
this
->
sendDropRate
);
...
...
@@ -806,11 +818,32 @@ int UAS::calculateTimeRemaining()
return
remaining
;
}
/**
* @return charge level in percent - 0 - 100
*/
double
UAS
::
getChargeLevel
()
{
return
100.0
f
*
((
lpVoltage
-
emptyVoltage
)
/
(
fullVoltage
-
emptyVoltage
));
}
void
UAS
::
startLowBattAlarm
()
{
if
(
!
lowBattAlarm
)
{
GAudioOutput
::
instance
()
->
startEmergency
(
"BATTERY"
);
lowBattAlarm
=
true
;
}
}
void
UAS
::
stopLowBattAlarm
()
{
if
(
lowBattAlarm
)
{
GAudioOutput
::
instance
()
->
stopEmergency
();
lowBattAlarm
=
false
;
}
}
void
UAS
::
clearWaypointList
()
{
mavlink_message_t
message
;
...
...
src/uas/UAS.h
View file @
146474c9
...
...
@@ -121,6 +121,7 @@ protected:
double
manualThrust
;
///< Thrust set by human pilot (radians)
float
receiveDropRate
;
///< Percentage of packets that were dropped on the MAV's receiving link (from GCS and other MAVs)
float
sendDropRate
;
///< Percentage of packets that were not received from the MAV by the GCS
bool
lowBattAlarm
;
///< Switch if battery is low
/** @brief Set the current battery type */
void
setBattery
(
BatteryType
type
,
int
cells
);
...
...
@@ -136,7 +137,9 @@ protected:
public
slots
:
/** @brief Launches the system **/
void
launch
();
/** @brief Write this waypoint to the list of waypoints */
void
setWaypoint
(
Waypoint
*
wp
);
/** @brief Set currently active waypoint */
void
setWaypointActive
(
int
id
);
/** @brief Order the robot to return home / to land on the runway **/
void
home
();
...
...
@@ -151,6 +154,9 @@ public slots:
/** @brief Shut the system cleanly down. Will shut down any onboard computers **/
void
shutdown
();
void
startLowBattAlarm
();
void
stopLowBattAlarm
();
void
requestWaypoints
();
void
requestParameters
();
void
clearWaypointList
();
...
...
src/ui/ParameterInterface.cc
View file @
146474c9
...
...
@@ -14,10 +14,6 @@ ParameterInterface::ParameterInterface(QWidget *parent) :
m_ui
->
setupUi
(
this
);
connect
(
UASManager
::
instance
(),
SIGNAL
(
UASCreated
(
UASInterface
*
)),
this
,
SLOT
(
addUAS
(
UASInterface
*
)));
// FIXME Testing TODO
QString
testData
=
"IMU
\n
ROLL_K_P
\t
0.527
\n
ROLL_K_I
\t
1.255
\n
PITCH_K_P
\t
0.621
\n
PITCH_K_I
\t
2.5545
\n
"
;
tree
=
new
ParamTreeModel
();
treeView
=
new
QTreeView
();
...
...
@@ -76,11 +72,10 @@ void ParameterInterface::addComponent(UASInterface* uas, int component, QString
void
ParameterInterface
::
receiveParameter
(
int
uas
,
int
component
,
QString
parameterName
,
float
value
)
{
Q_UNUSED
(
uas
);
qDebug
()
<<
"RECEIVED PARAMETER"
<<
component
<<
parameterName
<<
value
;
// Insert parameter into map
tree
->
appendParam
(
component
,
parameterName
,
value
);
// Refresh view
treeView
->
setModel
(
tree
);
treeView
->
update
(
);
}
/**
...
...
src/ui/param/ParamTreeModel.cc
View file @
146474c9
...
...
@@ -40,7 +40,8 @@ ParamTreeModel::ParamTreeModel(QObject *parent)
QList
<
QVariant
>
rootData
;
rootData
<<
tr
(
"Parameter"
)
<<
tr
(
"Value"
);
rootItem
=
new
ParamTreeItem
(
rootData
);
//setupModelData(data.split(QString("\n")), rootItem);
QString
data
=
"IMU
\n
ROLL_K_I
\t
1.255
\n
PITCH_K_P
\t
0.621
\n
PITCH_K_I
\t
2.5545
\n
"
;
setupModelData
(
data
.
split
(
QString
(
"
\n
"
)),
rootItem
);
}
ParamTreeModel
::
ParamTreeModel
(
const
QString
&
data
,
QObject
*
parent
)
...
...
@@ -153,20 +154,29 @@ void ParamTreeModel::appendComponent(int componentId, QString name)
{
if
(
!
components
.
contains
(
componentId
))
{
ParamTreeItem
*
item
=
new
ParamTreeItem
(
name
+
QString
(
"("
)
+
QString
::
number
(
componentId
)
+
QString
(
")"
),
0
,
rootItem
);
ParamTreeItem
*
item
=
new
ParamTreeItem
(
name
+
QString
(
"(#"
)
+
QString
::
number
(
componentId
)
+
QString
(
")"
),
0
,
rootItem
);
components
.
insert
(
componentId
,
item
);
}
}
void
ParamTreeModel
::
appendComponent
(
int
componentId
)
{
if
(
!
components
.
contains
(
componentId
))
{
ParamTreeItem
*
item
=
new
ParamTreeItem
(
QString
(
"Component #"
)
+
QString
::
number
(
componentId
)
+
QString
(
""
),
0
,
rootItem
);
components
.
insert
(
componentId
,
item
);
}
}
void
ParamTreeModel
::
appendParam
(
int
componentId
,
QString
name
,
float
value
)
{
ParamTreeItem
*
comp
=
components
.
value
(
componentId
);
// If component does not exist yet
if
(
comp
==
NULL
)
if
(
!
components
.
contains
(
componentId
)
)
{
appendComponent
(
componentId
,
name
);
comp
=
components
.
value
(
componentId
);
appendComponent
(
componentId
);
}
ParamTreeItem
*
comp
=
components
.
value
(
componentId
);
// FIXME Children may be double here
comp
->
appendChild
(
new
ParamTreeItem
(
name
,
value
,
comp
));
qDebug
()
<<
__FILE__
<<
__LINE__
<<
"Added param"
<<
name
<<
value
<<
"for component"
<<
comp
->
getParamName
();
...
...
src/ui/param/ParamTreeModel.h
View file @
146474c9
...
...
@@ -61,6 +61,8 @@ public slots:
void
appendParam
(
int
componentId
,
QString
name
,
float
value
);
/** @brief Add a new component for this system */
void
appendComponent
(
int
componentId
,
QString
name
);
/** @brief Add a new component for this system */
void
appendComponent
(
int
componentId
);
protected:
ParamTreeItem
*
getNodeForComponentId
(
int
id
);
...
...
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