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
f929b6cb
Commit
f929b6cb
authored
Jun 10, 2010
by
lm
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed compile warnings, moved MAVLink ids
parent
e771303d
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
200 additions
and
63 deletions
+200
-63
fixedimageoverlay.cpp
lib/QMapControl/src/fixedimageoverlay.cpp
+2
-0
googlesatmapadapter.cpp
lib/QMapControl/src/googlesatmapadapter.cpp
+6
-4
qgroundcontrol.pro
qgroundcontrol.pro
+3
-3
HSIDisplay.cc
src/ui/HSIDisplay.cc
+153
-55
HSIDisplay.h
src/ui/HSIDisplay.h
+36
-1
No files found.
lib/QMapControl/src/fixedimageoverlay.cpp
View file @
f929b6cb
...
@@ -46,6 +46,8 @@ namespace qmapcontrol
...
@@ -46,6 +46,8 @@ namespace qmapcontrol
void
FixedImageOverlay
::
draw
(
QPainter
*
painter
,
const
MapAdapter
*
mapadapter
,
const
QRect
&
viewport
,
const
QPoint
offset
)
void
FixedImageOverlay
::
draw
(
QPainter
*
painter
,
const
MapAdapter
*
mapadapter
,
const
QRect
&
viewport
,
const
QPoint
offset
)
{
{
Q_UNUSED
(
viewport
)
Q_UNUSED
(
offset
)
if
(
!
visible
)
if
(
!
visible
)
return
;
return
;
...
...
lib/QMapControl/src/googlesatmapadapter.cpp
View file @
f929b6cb
...
@@ -64,10 +64,12 @@ namespace qmapcontrol
...
@@ -64,10 +64,12 @@ namespace qmapcontrol
//double lon = ((point.x()/tilesize*numberOfTiles)*360)-180;
//double lon = ((point.x()/tilesize*numberOfTiles)*360)-180;
//double lat = (((point.y()/tilesize*numberOfTiles)*180)-90)*-1;
//double lat = (((point.y()/tilesize*numberOfTiles)*180)-90)*-1;
qreal
lon
=
(
point
.
x
()
*
(
360.
/
(
numberOfTiles
*
mytilesize
)))
-
180.
;
qreal
lon
=
(
point
.
x
()
*
(
360.0
/
(
numberOfTiles
*
mytilesize
)))
-
180.0
;
//double lat = -(point.y()*(180./(numberOfTiles*tilesize)))+90;
// qreal lat = -(point.y()*(180.0/(numberOfTiles*mytilesize)))+90.0;
//qreal lat = getMercatorLatitude(point.y()*-1*(2*M_PI/(numberOfTiles*tilesize)) + M_PI);
// FIXME Looks buggy
qreal
lat
=
lat
*
180.
/
M_PI
;
qreal
lat
=
getMercatorLatitude
(
point
.
y
()
*-
1
*
(
2
*
M_PI
/
(
numberOfTiles
*
mytilesize
))
+
M_PI
);
//qreal lat = lat *180./M_PI;
return
QPointF
(
lon
,
lat
);
return
QPointF
(
lon
,
lat
);
}
}
...
...
qgroundcontrol.pro
View file @
f929b6cb
...
@@ -3,10 +3,10 @@
...
@@ -3,10 +3,10 @@
#
from
http
://
github
.
com
/
pixhawk
/
qmapcontrol
/
#
from
http
://
github
.
com
/
pixhawk
/
qmapcontrol
/
#
over
bundled
version
in
lib
directory
#
over
bundled
version
in
lib
directory
#
Version
from
GIT
repository
is
preferred
#
Version
from
GIT
repository
is
preferred
#
include
(
"../qmapcontrol/QMapControl/QMapControl.pri"
)
#
{
include
(
"../qmapcontrol/QMapControl/QMapControl.pri"
)
#
{
#
Include
bundled
version
if
necessary
#
Include
bundled
version
if
necessary
include
(
lib
/
QMapControl
/
QMapControl
.
pri
)
#
include
(
lib
/
QMapControl
/
QMapControl
.
pri
)
message
(
"Including bundled QMapControl version as FALLBACK. This is fine on Linux and MacOS, but not the best choice in Windows"
)
#
message
(
"Including bundled QMapControl version as FALLBACK. This is fine on Linux and MacOS, but not the best choice in Windows"
)
QT
+=
network
opengl
svg
xml
phonon
QT
+=
network
opengl
svg
xml
phonon
...
...
src/ui/HSIDisplay.cc
View file @
f929b6cb
...
@@ -41,7 +41,28 @@ This file is part of the PIXHAWK project
...
@@ -41,7 +41,28 @@ This file is part of the PIXHAWK project
HSIDisplay
::
HSIDisplay
(
QWidget
*
parent
)
:
HSIDisplay
::
HSIDisplay
(
QWidget
*
parent
)
:
HDDisplay
(
NULL
,
parent
),
HDDisplay
(
NULL
,
parent
),
gpsSatellites
(),
gpsSatellites
(),
satellitesUsed
(
0
)
satellitesUsed
(
0
),
attXSet
(
0
),
attYSet
(
0
),
attYawSet
(
0
),
altitudeSet
(
1.0
),
posXSet
(
0
),
posYSet
(
0
),
posZSet
(
0
),
attXSaturation
(
0.33
),
attYSaturation
(
0.33
),
attYawSaturation
(
0.33
),
posXSaturation
(
1.0
),
posYSaturation
(
1.0
),
altitudeSaturation
(
1.0
),
lat
(
0
),
lon
(
0
),
alt
(
0
),
globalAvailable
(
0
),
x
(
0
),
y
(
0
),
z
(
0
),
localAvailable
(
0
)
{
{
connect
(
UASManager
::
instance
(),
SIGNAL
(
activeUASSet
(
UASInterface
*
)),
this
,
SLOT
(
setActiveUAS
(
UASInterface
*
)));
connect
(
UASManager
::
instance
(),
SIGNAL
(
activeUASSet
(
UASInterface
*
)),
this
,
SLOT
(
setActiveUAS
(
UASInterface
*
)));
}
}
...
@@ -51,13 +72,22 @@ void HSIDisplay::paintEvent(QPaintEvent * event)
...
@@ -51,13 +72,22 @@ void HSIDisplay::paintEvent(QPaintEvent * event)
Q_UNUSED
(
event
);
Q_UNUSED
(
event
);
//paintGL();
//paintGL();
static
quint64
interval
=
0
;
static
quint64
interval
=
0
;
qDebug
()
<<
"INTERVAL:"
<<
MG
::
TIME
::
getGroundTimeNow
()
-
interval
<<
__FILE__
<<
__LINE__
;
//
qDebug() << "INTERVAL:" << MG::TIME::getGroundTimeNow() - interval << __FILE__ << __LINE__;
interval
=
MG
::
TIME
::
getGroundTimeNow
();
interval
=
MG
::
TIME
::
getGroundTimeNow
();
paintDisplay
();
paintDisplay
();
}
}
void
HSIDisplay
::
paintDisplay
()
void
HSIDisplay
::
paintDisplay
()
{
{
// Center location of the HSI gauge items
float
xCenterPos
=
vwidth
/
2.0
f
;
float
yCenterPos
=
vheight
/
2.0
f
;
// Size of the ring instrument
const
float
margin
=
0.1
f
;
// 10% margin of total width on each side
float
baseRadius
=
(
vwidth
-
vwidth
*
2.0
f
*
margin
)
/
2.0
f
;
quint64
refreshInterval
=
100
;
quint64
refreshInterval
=
100
;
quint64
currTime
=
MG
::
TIME
::
getGroundTimeNow
();
quint64
currTime
=
MG
::
TIME
::
getGroundTimeNow
();
if
(
currTime
-
lastPaintTime
<
refreshInterval
)
if
(
currTime
-
lastPaintTime
<
refreshInterval
)
...
@@ -78,14 +108,11 @@ void HSIDisplay::paintDisplay()
...
@@ -78,14 +108,11 @@ void HSIDisplay::paintDisplay()
painter
.
setRenderHint
(
QPainter
::
Antialiasing
,
true
);
painter
.
setRenderHint
(
QPainter
::
Antialiasing
,
true
);
painter
.
setRenderHint
(
QPainter
::
HighQualityAntialiasing
,
true
);
painter
.
setRenderHint
(
QPainter
::
HighQualityAntialiasing
,
true
);
painter
.
fillRect
(
QRect
(
0
,
0
,
width
(),
height
()),
backgroundColor
);
painter
.
fillRect
(
QRect
(
0
,
0
,
width
(),
height
()),
backgroundColor
);
const
int
columns
=
3
;
const
float
spacing
=
0.4
f
;
// 40% of width
const
float
gaugeWidth
=
vwidth
/
(((
float
)
columns
)
+
(((
float
)
columns
+
1
)
*
spacing
+
spacing
*
0.1
f
));
const
QColor
ringColor
=
QColor
(
200
,
250
,
200
);
const
QColor
ringColor
=
QColor
(
200
,
250
,
200
);
// Draw base instrument
// ----------------------
const
int
ringCount
=
2
;
const
int
ringCount
=
2
;
const
float
margin
=
0.1
f
;
// 10% margin of total width on each side
for
(
int
i
=
0
;
i
<
ringCount
;
i
++
)
for
(
int
i
=
0
;
i
<
ringCount
;
i
++
)
{
{
float
radius
=
(
vwidth
-
vwidth
*
2.0
f
*
margin
)
/
(
2.0
f
*
i
+
1
)
/
2.0
f
;
float
radius
=
(
vwidth
-
vwidth
*
2.0
f
*
margin
)
/
(
2.0
f
*
i
+
1
)
/
2.0
f
;
...
@@ -95,37 +122,60 @@ void HSIDisplay::paintDisplay()
...
@@ -95,37 +122,60 @@ void HSIDisplay::paintDisplay()
// Draw center indicator
// Draw center indicator
drawCircle
(
vwidth
/
2.0
f
,
vheight
/
2.0
f
,
1.0
f
,
0.1
f
,
ringColor
,
&
painter
);
drawCircle
(
vwidth
/
2.0
f
,
vheight
/
2.0
f
,
1.0
f
,
0.1
f
,
ringColor
,
&
painter
);
drawGPS
();
// Draw orientation labels
paintText
(
tr
(
"N"
),
ringColor
,
3.5
f
,
xCenterPos
-
1.0
f
,
yCenterPos
-
baseRadius
-
5.5
f
,
&
painter
);
paintText
(
tr
(
"S"
),
ringColor
,
3.5
f
,
xCenterPos
-
1.0
f
,
yCenterPos
+
baseRadius
+
1.5
f
,
&
painter
);
paintText
(
tr
(
"E"
),
ringColor
,
3.5
f
,
xCenterPos
+
baseRadius
+
2.0
f
,
yCenterPos
-
1.75
f
,
&
painter
);
paintText
(
tr
(
"W"
),
ringColor
,
3.5
f
,
xCenterPos
-
baseRadius
-
5.5
f
,
yCenterPos
-
1.75
f
,
&
painter
);
// ----------------------
// Draw state indicator
// Draw state indicator
// Draw position
// Draw position
QColor
positionColor
(
20
,
20
,
200
);
drawPositionSetpoint
(
xCenterPos
,
yCenterPos
,
baseRadius
,
positionColor
,
&
painter
);
// Draw attitude
QColor
attitudeColor
(
200
,
20
,
20
);
drawPositionSetpoint
(
xCenterPos
,
yCenterPos
,
baseRadius
,
attitudeColor
,
&
painter
);
// Draw satellites
drawGPS
();
if
(
localAvailable
>
0
)
{
QString
str
;
str
.
sprintf
(
"%05.2f %05.2f %05.2f m"
,
x
,
y
,
z
);
paintText
(
str
,
ringColor
,
4.5
f
,
xCenterPos
+
baseRadius
-
5.5
f
,
yCenterPos
+
baseRadius
-
20.75
f
,
&
painter
);
}
//drawSystemIndicator(10.0f-gaugeWidth/2.0f, 20.0f, 10.0f, 40.0f, 15.0f, &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);
//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);
//drawGauge(15.0f+gaugeWidth*1.7f, 15.0f, gaugeWidth/2.0f, 0, 10.0f, "altitude", values.value("altitude", 0.0f), gaugeColor, &painter, qMakePair(1.0f, 2.5f), qMakePair(0.0f, 0.5f), true);
//drawGauge(15.0f+gaugeWidth*1.7f, 15.0f, gaugeWidth/2.0f, 0, 10.0f, "altitude", values.value("altitude", 0.0f), gaugeColor, &painter, qMakePair(1.0f, 2.5f), qMakePair(0.0f, 0.5f), true);
// Left spacing from border / other gauges, measured from left edge to center
// Left spacing from border / other gauges, measured from left edge to center
// float leftSpacing = gaugeWidth * spacing;
// float leftSpacing = gaugeWidth * spacing;
// float xCoord = leftSpacing + gaugeWidth/2.0f;
// float xCoord = leftSpacing + gaugeWidth/2.0f;
//
//
// float topSpacing = leftSpacing;
// float topSpacing = leftSpacing;
// float yCoord = topSpacing + gaugeWidth/2.0f;
// float yCoord = topSpacing + gaugeWidth/2.0f;
//
//
// for (int i = 0; i < acceptList->size(); ++i)
// for (int i = 0; i < acceptList->size(); ++i)
// {
// {
// QString value = acceptList->at(i);
// QString value = acceptList->at(i);
// drawGauge(xCoord, yCoord, gaugeWidth/2.0f, minValues.value(value, -1.0f), maxValues.value(value, 1.0f), value, values.value(value, minValues.value(value, 0.0f)), gaugeColor, &painter, goodRanges.value(value, qMakePair(0.0f, 0.5f)), critRanges.value(value, qMakePair(0.7f, 1.0f)), true);
// drawGauge(xCoord, yCoord, gaugeWidth/2.0f, minValues.value(value, -1.0f), maxValues.value(value, 1.0f), value, values.value(value, minValues.value(value, 0.0f)), gaugeColor, &painter, goodRanges.value(value, qMakePair(0.0f, 0.5f)), critRanges.value(value, qMakePair(0.7f, 1.0f)), true);
// xCoord += gaugeWidth + leftSpacing;
// xCoord += gaugeWidth + leftSpacing;
// // Move one row down if necessary
// // Move one row down if necessary
// if (xCoord + gaugeWidth > vwidth)
// if (xCoord + gaugeWidth > vwidth)
// {
// {
// yCoord += topSpacing + gaugeWidth;
// yCoord += topSpacing + gaugeWidth;
// xCoord = leftSpacing + gaugeWidth/2.0f;
// xCoord = leftSpacing + gaugeWidth/2.0f;
// }
// }
// }
// }
}
}
/**
/**
...
@@ -134,7 +184,7 @@ void HSIDisplay::paintDisplay()
...
@@ -134,7 +184,7 @@ void HSIDisplay::paintDisplay()
*/
*/
void
HSIDisplay
::
setActiveUAS
(
UASInterface
*
uas
)
void
HSIDisplay
::
setActiveUAS
(
UASInterface
*
uas
)
{
{
HDDisplay
::
setActiveUAS
(
uas
);
HDDisplay
::
setActiveUAS
(
uas
);
//qDebug() << "ATTEMPTING TO SET UAS";
//qDebug() << "ATTEMPTING TO SET UAS";
if
(
this
->
uas
!=
NULL
&&
this
->
uas
!=
uas
)
if
(
this
->
uas
!=
NULL
&&
this
->
uas
!=
uas
)
{
{
...
@@ -143,7 +193,9 @@ void HSIDisplay::setActiveUAS(UASInterface* uas)
...
@@ -143,7 +193,9 @@ void HSIDisplay::setActiveUAS(UASInterface* uas)
}
}
connect
(
uas
,
SIGNAL
(
gpsSatelliteStatusChanged
(
int
,
int
,
float
,
float
,
float
,
bool
)),
this
,
SLOT
(
updateSatellite
(
int
,
int
,
float
,
float
,
float
,
bool
)));
connect
(
uas
,
SIGNAL
(
gpsSatelliteStatusChanged
(
int
,
int
,
float
,
float
,
float
,
bool
)),
this
,
SLOT
(
updateSatellite
(
int
,
int
,
float
,
float
,
float
,
bool
)));
connect
(
uas
,
SIGNAL
(
localPositionChanged
(
UASInterface
*
,
double
,
double
,
double
,
quint64
)),
this
,
SLOT
())
connect
(
uas
,
SIGNAL
(
localPositionChanged
(
UASInterface
*
,
double
,
double
,
double
,
quint64
)),
this
,
SLOT
(
updateLocalPosition
(
UASInterface
*
,
double
,
double
,
double
,
quint64
)));
connect
(
uas
,
SIGNAL
(
globalPositionChanged
(
UASInterface
*
,
double
,
double
,
double
,
quint64
)),
this
,
SLOT
(
updateGlobalPosition
(
UASInterface
*
,
double
,
double
,
double
,
quint64
)));
connect
(
uas
,
SIGNAL
(
attitudeThrustSetPointChanged
(
UASInterface
*
,
double
,
double
,
double
,
double
,
quint64
)),
this
,
SLOT
(
updateAttitudeSetpoints
(
UASInterface
*
,
double
,
double
,
double
,
double
,
quint64
)));
// Now connect the new UAS
// Now connect the new UAS
...
@@ -155,24 +207,39 @@ void HSIDisplay::setActiveUAS(UASInterface* uas)
...
@@ -155,24 +207,39 @@ void HSIDisplay::setActiveUAS(UASInterface* uas)
//}
//}
}
}
void
HSIDisplay
::
updateAttitudeSetpoints
(
UASInterface
*
,
double
rollDesired
,
double
pitchDesired
,
double
yawDesired
,
double
thrustDesired
,
quint64
usec
)
void
HSIDisplay
::
updateAttitudeSetpoints
(
UASInterface
*
uas
,
double
rollDesired
,
double
pitchDesired
,
double
yawDesired
,
double
thrustDesired
,
quint64
usec
)
{
{
Q_UNUSED
(
uas
);
Q_UNUSED
(
usec
);
attXSet
=
pitchDesired
;
attYSet
=
rollDesired
;
attYawSet
=
yawDesired
;
altitudeSet
=
thrustDesired
;
}
}
void
HSIDisplay
::
updatePositionSetpoints
(
UASInterface
*
,
double
rollDesired
,
double
pitchDesired
,
double
yawDesired
,
double
thrust
Desired
,
quint64
usec
)
void
HSIDisplay
::
updatePositionSetpoints
(
int
uasid
,
double
xDesired
,
double
yDesired
,
double
z
Desired
,
quint64
usec
)
{
{
Q_UNUSED
(
usec
);
Q_UNUSED
(
uasid
);
posXSet
=
xDesired
;
posYSet
=
yDesired
;
posZSet
=
zDesired
;
}
}
void
HSIDisplay
::
updateLocalPosition
(
UASInterface
*
,
double
x
,
double
y
,
double
z
,
quint64
usec
)
void
HSIDisplay
::
updateLocalPosition
(
UASInterface
*
,
double
x
,
double
y
,
double
z
,
quint64
usec
)
{
{
this
->
x
=
x
;
this
->
y
=
y
;
this
->
z
=
z
;
localAvailable
=
usec
;
}
}
void
HSIDisplay
::
updateGlobalPosition
(
UASInterface
*
,
double
lat
,
double
lon
,
double
alt
,
quint64
usec
)
void
HSIDisplay
::
updateGlobalPosition
(
UASInterface
*
,
double
lat
,
double
lon
,
double
alt
,
quint64
usec
)
{
{
this
->
lat
=
lat
;
this
->
lon
=
lon
;
this
->
alt
=
alt
;
globalAvailable
=
usec
;
}
}
void
HSIDisplay
::
updateSatellite
(
int
uasid
,
int
satid
,
float
elevation
,
float
azimuth
,
float
snr
,
bool
used
)
void
HSIDisplay
::
updateSatellite
(
int
uasid
,
int
satid
,
float
elevation
,
float
azimuth
,
float
snr
,
bool
used
)
...
@@ -286,33 +353,45 @@ void HSIDisplay::drawGPS()
...
@@ -286,33 +353,45 @@ void HSIDisplay::drawGPS()
void
HSIDisplay
::
drawObjects
()
void
HSIDisplay
::
drawObjects
()
{
{
}
}
void
HSIDisplay
::
draw
BaseLines
(
float
xRef
,
float
yRef
,
float
radius
,
float
yaw
,
const
QColor
&
color
,
QPainter
*
painter
,
bool
solid
)
void
HSIDisplay
::
draw
PositionSetpoint
(
float
xRef
,
float
yRef
,
float
radius
,
const
QColor
&
color
,
QPainter
*
painter
)
{
{
// Draw the circle
// Draw the needle
QPen
circlePen
(
Qt
::
SolidLine
);
const
float
maxWidth
=
radius
/
10.0
f
;
if
(
!
solid
)
circlePen
.
setStyle
(
Qt
::
DotLine
);
const
float
minWidth
=
maxWidth
*
0.3
f
;
circlePen
.
setWidth
(
refLineWidthToPen
(
0.5
f
));
circlePen
.
setColor
(
defaultColor
);
painter
->
setBrush
(
Qt
::
NoBrush
);
painter
->
setPen
(
circlePen
);
drawCircle
(
xRef
,
yRef
,
radius
,
200.0
f
,
color
,
painter
);
//drawCircle(xRef, yRef, radius, 200.0f, 170.0f, 1.0f, color, painter);
// // Draw the value
float
angle
=
asin
(
posXSet
)
+
acos
(
posYSet
);
// QString label;
// label.sprintf("%05.1f", value);
QPolygonF
p
(
6
);
// paintText(label, color, 4.5f, xRef-7.5f, yRef-2.0f, painter);
p
.
replace
(
0
,
QPointF
(
xRef
-
maxWidth
/
2.0
f
,
yRef
-
radius
*
0.5
f
));
p
.
replace
(
1
,
QPointF
(
xRef
-
minWidth
/
2.0
f
,
yRef
-
radius
*
0.9
f
));
p
.
replace
(
2
,
QPointF
(
xRef
+
minWidth
/
2.0
f
,
yRef
-
radius
*
0.9
f
));
p
.
replace
(
3
,
QPointF
(
xRef
+
maxWidth
/
2.0
f
,
yRef
-
radius
*
0.5
f
));
p
.
replace
(
4
,
QPointF
(
xRef
,
yRef
-
radius
*
0.46
f
));
p
.
replace
(
5
,
QPointF
(
xRef
-
maxWidth
/
2.0
f
,
yRef
-
radius
*
0.5
f
));
rotatePolygonClockWiseRad
(
p
,
angle
,
QPointF
(
xRef
,
yRef
));
QBrush
indexBrush
;
indexBrush
.
setColor
(
color
);
indexBrush
.
setStyle
(
Qt
::
SolidPattern
);
painter
->
setPen
(
Qt
::
SolidLine
);
painter
->
setPen
(
color
);
painter
->
setBrush
(
indexBrush
);
drawPolygon
(
p
,
painter
);
}
void
HSIDisplay
::
drawAttitudeSetpoint
(
float
xRef
,
float
yRef
,
float
radius
,
const
QColor
&
color
,
QPainter
*
painter
)
{
// Draw the needle
// Draw the needle
// Scale the rotation so that the gauge does one revolution
// per max. change
const
float
rangeScale
=
(
2.0
f
*
M_PI
);
const
float
maxWidth
=
radius
/
10.0
f
;
const
float
maxWidth
=
radius
/
10.0
f
;
const
float
minWidth
=
maxWidth
*
0.3
f
;
const
float
minWidth
=
maxWidth
*
0.3
f
;
float
angle
=
asin
(
attXSet
)
+
acos
(
attYSet
);
QPolygonF
p
(
6
);
QPolygonF
p
(
6
);
p
.
replace
(
0
,
QPointF
(
xRef
-
maxWidth
/
2.0
f
,
yRef
-
radius
*
0.5
f
));
p
.
replace
(
0
,
QPointF
(
xRef
-
maxWidth
/
2.0
f
,
yRef
-
radius
*
0.5
f
));
...
@@ -322,13 +401,32 @@ void HSIDisplay::drawBaseLines(float xRef, float yRef, float radius, float yaw,
...
@@ -322,13 +401,32 @@ void HSIDisplay::drawBaseLines(float xRef, float yRef, float radius, float yaw,
p
.
replace
(
4
,
QPointF
(
xRef
,
yRef
-
radius
*
0.46
f
));
p
.
replace
(
4
,
QPointF
(
xRef
,
yRef
-
radius
*
0.46
f
));
p
.
replace
(
5
,
QPointF
(
xRef
-
maxWidth
/
2.0
f
,
yRef
-
radius
*
0.5
f
));
p
.
replace
(
5
,
QPointF
(
xRef
-
maxWidth
/
2.0
f
,
yRef
-
radius
*
0.5
f
));
rotatePolygonClockWiseRad
(
p
,
yaw
*
rangeSca
le
,
QPointF
(
xRef
,
yRef
));
rotatePolygonClockWiseRad
(
p
,
ang
le
,
QPointF
(
xRef
,
yRef
));
QBrush
indexBrush
;
QBrush
indexBrush
;
indexBrush
.
setColor
(
defaultC
olor
);
indexBrush
.
setColor
(
c
olor
);
indexBrush
.
setStyle
(
Qt
::
SolidPattern
);
indexBrush
.
setStyle
(
Qt
::
SolidPattern
);
painter
->
setPen
(
Qt
::
SolidLine
);
painter
->
setPen
(
Qt
::
SolidLine
);
painter
->
setPen
(
defaultC
olor
);
painter
->
setPen
(
c
olor
);
painter
->
setBrush
(
indexBrush
);
painter
->
setBrush
(
indexBrush
);
drawPolygon
(
p
,
painter
);
drawPolygon
(
p
,
painter
);
// TODO Draw Yaw indicator
}
void
HSIDisplay
::
drawAltitudeSetpoint
(
float
xRef
,
float
yRef
,
float
radius
,
const
QColor
&
color
,
QPainter
*
painter
)
{
// Draw the circle
QPen
circlePen
(
Qt
::
SolidLine
);
circlePen
.
setWidth
(
refLineWidthToPen
(
0.5
f
));
circlePen
.
setColor
(
color
);
painter
->
setBrush
(
Qt
::
NoBrush
);
painter
->
setPen
(
circlePen
);
drawCircle
(
xRef
,
yRef
,
radius
,
200.0
f
,
color
,
painter
);
//drawCircle(xRef, yRef, radius, 200.0f, 170.0f, 1.0f, color, painter);
// // Draw the value
// QString label;
// label.sprintf("%05.1f", value);
// paintText(label, color, 4.5f, xRef-7.5f, yRef-2.0f, painter);
}
}
src/ui/HSIDisplay.h
View file @
f929b6cb
...
@@ -51,13 +51,19 @@ public:
...
@@ -51,13 +51,19 @@ public:
public
slots
:
public
slots
:
void
setActiveUAS
(
UASInterface
*
uas
);
void
setActiveUAS
(
UASInterface
*
uas
);
void
updateSatellite
(
int
uasid
,
int
satid
,
float
azimuth
,
float
direction
,
float
snr
,
bool
used
);
void
updateSatellite
(
int
uasid
,
int
satid
,
float
azimuth
,
float
direction
,
float
snr
,
bool
used
);
void
updateAttitudeSetpoints
(
UASInterface
*
,
double
rollDesired
,
double
pitchDesired
,
double
yawDesired
,
double
thrustDesired
,
quint64
usec
);
void
updatePositionSetpoints
(
int
uasid
,
double
xDesired
,
double
yDesired
,
double
zDesired
,
quint64
usec
);
void
updateLocalPosition
(
UASInterface
*
,
double
x
,
double
y
,
double
z
,
quint64
usec
);
void
updateGlobalPosition
(
UASInterface
*
,
double
lat
,
double
lon
,
double
alt
,
quint64
usec
);
void
paintEvent
(
QPaintEvent
*
event
);
void
paintEvent
(
QPaintEvent
*
event
);
protected
slots
:
protected
slots
:
void
paintDisplay
();
void
paintDisplay
();
void
drawGPS
();
void
drawGPS
();
void
drawObjects
();
void
drawObjects
();
void
drawBaseLines
(
float
xRef
,
float
yRef
,
float
radius
,
float
yaw
,
const
QColor
&
color
,
QPainter
*
painter
,
bool
solid
);
void
drawPositionSetpoint
(
float
xRef
,
float
yRef
,
float
radius
,
const
QColor
&
color
,
QPainter
*
painter
);
void
drawAttitudeSetpoint
(
float
xRef
,
float
yRef
,
float
radius
,
const
QColor
&
color
,
QPainter
*
painter
);
void
drawAltitudeSetpoint
(
float
xRef
,
float
yRef
,
float
radius
,
const
QColor
&
color
,
QPainter
*
painter
);
protected:
protected:
...
@@ -103,6 +109,35 @@ protected:
...
@@ -103,6 +109,35 @@ protected:
QMap
<
int
,
GPSSatellite
*>
gpsSatellites
;
QMap
<
int
,
GPSSatellite
*>
gpsSatellites
;
unsigned
int
satellitesUsed
;
unsigned
int
satellitesUsed
;
// Current controller values
float
attXSet
;
float
attYSet
;
float
attYawSet
;
float
altitudeSet
;
float
posXSet
;
float
posYSet
;
float
posZSet
;
// Controller saturation values
float
attXSaturation
;
float
attYSaturation
;
float
attYawSaturation
;
float
posXSaturation
;
float
posYSaturation
;
float
altitudeSaturation
;
// Position
float
lat
;
float
lon
;
float
alt
;
quint64
globalAvailable
;
///< Last global position update time
float
x
;
float
y
;
float
z
;
quint64
localAvailable
;
///< Last local position update time
private:
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