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
6c168616
Commit
6c168616
authored
Jun 08, 2010
by
lm
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added GPS satellite timeout
parent
a0d526bf
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
51 additions
and
28 deletions
+51
-28
UAS.cc
src/uas/UAS.cc
+1
-2
HDDisplay.cc
src/ui/HDDisplay.cc
+1
-1
HSIDisplay.cc
src/ui/HSIDisplay.cc
+43
-23
HSIDisplay.h
src/ui/HSIDisplay.h
+6
-2
No files found.
src/uas/UAS.cc
View file @
6c168616
...
...
@@ -337,10 +337,9 @@ void UAS::receiveMessage(LinkInterface* link, mavlink_message_t message)
{
mavlink_gps_status_t
pos
;
mavlink_msg_gps_status_decode
(
&
message
,
&
pos
);
//qDebug() << "GOT GPS STATUS FOR "<< pos.satellites_visible << "SATELLITES";
for
(
int
i
=
0
;
i
<
(
int
)
pos
.
satellites_visible
;
i
++
)
{
emit
gpsSatelliteStatusChanged
(
uasId
,
i
,
pos
.
satellite_elevation
[
i
],
pos
.
satellite_azimuth
[
i
],
pos
.
satellite_snr
[
i
],
static_cast
<
bool
>
(
pos
.
satellite_used
[
i
]));
emit
gpsSatelliteStatusChanged
(
uasId
,
(
unsigned
char
)
pos
.
satellite_prn
[
i
],
(
unsigned
char
)
pos
.
satellite_elevation
[
i
],
(
unsigned
char
)
pos
.
satellite_azimuth
[
i
],
(
unsigned
char
)
pos
.
satellite_snr
[
i
],
static_cast
<
bool
>
(
pos
.
satellite_used
[
i
]));
}
}
break
;
...
...
src/ui/HDDisplay.cc
View file @
6c168616
...
...
@@ -119,7 +119,7 @@ void HDDisplay::paintEvent(QPaintEvent * event)
Q_UNUSED
(
event
);
//paintGL();
static
quint64
interval
=
0
;
qDebug
()
<<
"INTERVAL:"
<<
MG
::
TIME
::
getGroundTimeNow
()
-
interval
<<
__FILE__
<<
__LINE__
;
//
qDebug() << "INTERVAL:" << MG::TIME::getGroundTimeNow() - interval << __FILE__ << __LINE__;
interval
=
MG
::
TIME
::
getGroundTimeNow
();
paintDisplay
();
}
...
...
src/ui/HSIDisplay.cc
View file @
6c168616
...
...
@@ -94,6 +94,9 @@ void HSIDisplay::paintDisplay()
drawGPS
();
// Draw center indicator
drawCircle
(
vwidth
/
2.0
f
,
vheight
/
2.0
f
,
1.0
f
,
0.1
f
,
ringColor
,
&
painter
);
//drawSystemIndicator(10.0f-gaugeWidth/2.0f, 20.0f, 10.0f, 40.0f, 15.0f, &painter);
//drawGauge(15.0f, 15.0f, gaugeWidth/2.0f, 0, 1.0f, "thrust", values.value("thrust", 0.0f), gaugeColor, &painter, qMakePair(0.45f, 0.8f), qMakePair(0.8f, 1.0f), true);
...
...
@@ -151,37 +154,34 @@ void HSIDisplay::updateSatellite(int uasid, int satid, float elevation, float az
Q_UNUSED
(
uasid
);
//qDebug() << "UPDATED SATELLITE";
// If slot is empty, insert object
if
(
gpsSatellites
.
size
()
<=
satid
)
if
(
gpsSatellites
.
contains
(
satid
)
)
{
gpsSatellites
.
resize
(
satid
+
1
);
// gpsSatellites.insert(satid, new GPSSatellite(satid, azimuth, direction, snr, used));
}
if
(
gpsSatellites
.
at
(
satid
)
==
NULL
)
{
gpsSatellites
.
insert
(
satid
,
new
GPSSatellite
(
satid
,
elevation
,
azimuth
,
snr
,
used
));
gpsSatellites
.
value
(
satid
)
->
update
(
satid
,
elevation
,
azimuth
,
snr
,
used
);
}
else
{
// Satellite exists, update it
gpsSatellites
.
at
(
satid
)
->
update
(
satid
,
elevation
,
azimuth
,
snr
,
used
);
gpsSatellites
.
insert
(
satid
,
new
GPSSatellite
(
satid
,
elevation
,
azimuth
,
snr
,
used
));
}
}
QColor
HSIDisplay
::
getColorForSNR
(
float
snr
)
{
QColor
color
;
if
(
snr
<
10
)
if
(
snr
>
0
&&
snr
<
30
)
{
color
=
QColor
(
250
,
10
,
10
);
}
else
if
(
snr
>=
30
&&
snr
<
35
)
{
color
=
QColor
(
2
50
,
200
,
20
0
);
color
=
QColor
(
2
30
,
230
,
1
0
);
}
else
if
(
snr
>
2
0
)
else
if
(
snr
>
=
35
&&
snr
<
4
0
)
{
color
=
QColor
(
200
,
250
,
20
0
);
color
=
QColor
(
90
,
200
,
9
0
);
}
else
if
(
snr
>
3
0
)
else
if
(
snr
>
=
4
0
)
{
color
=
QColor
(
100
,
250
,
10
0
);
color
=
QColor
(
20
,
200
,
2
0
);
}
else
{
...
...
@@ -200,18 +200,37 @@ void HSIDisplay::drawGPS()
// Max satellite circle radius
const
float
margin
=
0.
2
f
;
// 20% margin of total width on each side
float
radius
=
(
vwidth
-
vwidth
*
2.0
f
*
margin
)
/
4
.0
f
;
radius
=
radius
;
const
float
margin
=
0.
15
f
;
// 20% margin of total width on each side
float
radius
=
(
vwidth
-
vwidth
*
2.0
f
*
margin
)
/
2
.0
f
;
quint64
currTime
=
MG
::
TIME
::
getGroundTimeNowUsecs
()
;
// Draw satellite labels
// QString label;
// label.sprintf("%05.1f", value);
// paintText(label, color, 4.5f, xRef-7.5f, yRef-2.0f, painter);
for
(
int
i
=
0
;
i
<
gpsSatellites
.
size
();
i
++
)
QMapIterator
<
int
,
GPSSatellite
*>
i
(
gpsSatellites
);
while
(
i
.
hasNext
())
{
GPSSatellite
*
sat
=
gpsSatellites
.
at
(
i
);
i
.
next
();
GPSSatellite
*
sat
=
i
.
value
();
// Check if update is not older than 5 seconds, else delete satellite
if
(
sat
->
lastUpdate
+
1000000
<
currTime
)
{
// Delete and go to next satellite
gpsSatellites
.
remove
(
i
.
key
());
if
(
i
.
hasNext
())
{
i
.
next
();
sat
=
i
.
value
();
}
else
{
continue
;
}
}
if
(
sat
)
{
// Draw satellite
...
...
@@ -230,10 +249,11 @@ void HSIDisplay::drawGPS()
painter
.
setPen
(
color
);
painter
.
setBrush
(
brush
);
float
xPos
=
xCenter
+
sin
(((
sat
->
azimuth
/
255.0
f
)
*
360.0
f
)
/
180.0
f
*
M_PI
)
*
(
sat
->
elevation
/
180.0
f
*
M_PI
)
*
radius
;
float
yPos
=
yCenter
+
cos
(((
sat
->
azimuth
/
255.0
f
)
*
360.0
f
)
/
180.0
f
*
M_PI
)
*
(
sat
->
elevation
/
180.0
f
*
M_PI
)
*
radius
;
float
xPos
=
xCenter
+
(
sin
(((
sat
->
azimuth
/
255.0
f
)
*
360.0
f
)
/
180.0
f
*
M_PI
)
*
cos
(
sat
->
elevation
/
180.0
f
*
M_PI
)
)
*
radius
;
float
yPos
=
yCenter
-
(
cos
(((
sat
->
azimuth
/
255.0
f
)
*
360.0
f
)
/
180.0
f
*
M_PI
)
*
cos
(
sat
->
elevation
/
180.0
f
*
M_PI
)
)
*
radius
;
drawCircle
(
xPos
,
yPos
,
vwidth
*
0.02
f
,
1.0
f
,
color
,
&
painter
);
paintText
(
QString
::
number
(
sat
->
id
),
QColor
(
255
,
255
,
255
),
2.9
f
,
xPos
+
1.7
f
,
yPos
+
2.0
f
,
&
painter
);
}
}
}
...
...
src/ui/HSIDisplay.h
View file @
6c168616
...
...
@@ -40,6 +40,7 @@ This file is part of the PIXHAWK project
#include <cmath>
#include "HDDisplay.h"
#include "MG.h"
class
HSIDisplay
:
public
HDDisplay
{
Q_OBJECT
...
...
@@ -73,7 +74,8 @@ protected:
elevation
(
elevation
),
azimuth
(
azimuth
),
snr
(
snr
),
used
(
used
)
used
(
used
),
lastUpdate
(
MG
::
TIME
::
getGroundTimeNowUsecs
())
{
}
...
...
@@ -85,6 +87,7 @@ protected:
this
->
azimuth
=
azimuth
;
this
->
snr
=
snr
;
this
->
used
=
used
;
this
->
lastUpdate
=
MG
::
TIME
::
getGroundTimeNowUsecs
();
}
int
id
;
...
...
@@ -92,11 +95,12 @@ protected:
float
azimuth
;
float
snr
;
bool
used
;
quint64
lastUpdate
;
friend
class
HSIDisplay
;
};
Q
Vector
<
GPSSatellite
*>
gpsSatellites
;
Q
Map
<
int
,
GPSSatellite
*>
gpsSatellites
;
unsigned
int
satellitesUsed
;
private:
...
...
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