Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Valentin Platzgummer
qgroundcontrol
Commits
9b19be0e
Commit
9b19be0e
authored
Aug 27, 2012
by
Lorenz Meier
Browse files
Fixed yaw-related HUD clamping
parent
b8a41f1f
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/QGC.cc
View file @
9b19be0e
...
...
@@ -73,7 +73,7 @@ float limitAngleToPMPIf(float angle)
else
{
// Approximate
angle
=
fmodf
(
angle
,
(
float
)
M_PI
);
angle
=
fmodf
(
angle
,
(
float
)
M_PI
);
}
return
angle
;
...
...
src/ui/HUD.cc
View file @
9b19be0e
...
...
@@ -464,7 +464,7 @@ void HUD::paintCenterBackground(float roll, float pitch, float yaw)
glTranslatef
(
referenceWidth
/
2.0
f
,
referenceHeight
/
2.0
f
,
0
);
// Move based on the yaw difference
glTranslatef
(
yaw
,
0.0
f
,
0.0
f
);
//
glTranslatef(yaw, 0.0f, 0.0f);
// Rotate based on the bank
glRotatef
((
roll
/
M_PI
)
*
180.0
f
,
0.0
f
,
0.0
f
,
1.0
f
);
...
...
@@ -788,8 +788,11 @@ void HUD::paintHUD()
// const float yawDeg = ((values.value("yaw", 0.0f)/M_PI)*180.0f)+180.f;
// YAW is in compass-human readable format, so 0 - 360deg. This is normal in aviation, not -180 - +180.
const
float
yawDeg
=
((
yawLP
/
M_PI
)
*
180.0
f
)
+
180.0
f
+
180.0
f
;
// YAW is in compass-human readable format, so 0 .. 360 deg.
float
yawDeg
=
((
yawLP
/
M_PI
)
*
180.0
f
)
+
180.0
f
;
if
(
yawDeg
<
0
)
yawDeg
+=
360
;
if
(
yawDeg
>
360
)
yawDeg
-=
360
;
/* final safeguard for really stupid systems */
int
yawCompass
=
static_cast
<
int
>
(
yawDeg
)
%
360
;
yawAngle
.
sprintf
(
"%03d"
,
yawCompass
);
paintText
(
yawAngle
,
defaultColor
,
3.5
f
,
-
4.3
f
,
compassY
+
0.97
f
,
&
painter
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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