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
d5c30100
Commit
d5c30100
authored
Feb 24, 2012
by
pixhawk
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Supported multiple attitude estimates in HUD
parent
46cb82b9
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
42 additions
and
10 deletions
+42
-10
UAS.cc
src/uas/UAS.cc
+1
-4
HUD.cc
src/ui/HUD.cc
+36
-6
HUD.h
src/ui/HUD.h
+5
-0
No files found.
src/uas/UAS.cc
View file @
d5c30100
...
@@ -440,7 +440,7 @@ void UAS::receiveMessage(LinkInterface* link, mavlink_message_t message)
...
@@ -440,7 +440,7 @@ void UAS::receiveMessage(LinkInterface* link, mavlink_message_t message)
if
((
startVoltage
>
0.0
f
)
&&
(
tickLowpassVoltage
<
tickVoltage
)
&&
(
fabs
(
lastTickVoltageValue
-
tickLowpassVoltage
)
>
0.1
f
)
if
((
startVoltage
>
0.0
f
)
&&
(
tickLowpassVoltage
<
tickVoltage
)
&&
(
fabs
(
lastTickVoltageValue
-
tickLowpassVoltage
)
>
0.1
f
)
&&
(
lpVoltage
<
tickVoltage
))
&&
(
lpVoltage
<
tickVoltage
))
{
{
GAudioOutput
::
instance
()
->
say
(
QString
(
"voltage warning: %1 volt"
).
arg
(
lpVoltage
,
2
));
GAudioOutput
::
instance
()
->
say
(
QString
(
"voltage warning: %1 volt"
).
arg
(
lpVoltage
,
2
,
'f'
,
0
,
QChar
(
' '
)
));
lastTickVoltageValue
=
tickLowpassVoltage
;
lastTickVoltageValue
=
tickLowpassVoltage
;
}
}
...
@@ -471,9 +471,6 @@ void UAS::receiveMessage(LinkInterface* link, mavlink_message_t message)
...
@@ -471,9 +471,6 @@ void UAS::receiveMessage(LinkInterface* link, mavlink_message_t message)
stopLowBattAlarm
();
stopLowBattAlarm
();
}
}
qDebug
()
<<
"START"
<<
startVoltage
;
// control_sensors_enabled:
// control_sensors_enabled:
// relevant bits: 11: attitude stabilization, 12: yaw position, 13: z/altitude control, 14: x/y position control
// relevant bits: 11: attitude stabilization, 12: yaw position, 13: z/altitude control, 14: x/y position control
emit
attitudeControlEnabled
(
state
.
onboard_control_sensors_enabled
&
(
1
<<
11
));
emit
attitudeControlEnabled
(
state
.
onboard_control_sensors_enabled
&
(
1
<<
11
));
...
...
src/ui/HUD.cc
View file @
d5c30100
...
@@ -256,6 +256,7 @@ void HUD::setActiveUAS(UASInterface* uas)
...
@@ -256,6 +256,7 @@ void HUD::setActiveUAS(UASInterface* uas)
if
(
this
->
uas
!=
NULL
)
{
if
(
this
->
uas
!=
NULL
)
{
// Disconnect any previously connected active MAV
// Disconnect any previously connected active MAV
disconnect
(
this
->
uas
,
SIGNAL
(
attitudeChanged
(
UASInterface
*
,
double
,
double
,
double
,
quint64
)),
this
,
SLOT
(
updateAttitude
(
UASInterface
*
,
double
,
double
,
double
,
quint64
)));
disconnect
(
this
->
uas
,
SIGNAL
(
attitudeChanged
(
UASInterface
*
,
double
,
double
,
double
,
quint64
)),
this
,
SLOT
(
updateAttitude
(
UASInterface
*
,
double
,
double
,
double
,
quint64
)));
disconnect
(
this
->
uas
,
SIGNAL
(
attitudeChanged
(
UASInterface
*
,
int
,
double
,
double
,
double
,
quint64
)),
this
,
SLOT
(
updateAttitude
(
UASInterface
*
,
int
,
double
,
double
,
double
,
quint64
)));
disconnect
(
this
->
uas
,
SIGNAL
(
batteryChanged
(
UASInterface
*
,
double
,
double
,
int
)),
this
,
SLOT
(
updateBattery
(
UASInterface
*
,
double
,
double
,
int
)));
disconnect
(
this
->
uas
,
SIGNAL
(
batteryChanged
(
UASInterface
*
,
double
,
double
,
int
)),
this
,
SLOT
(
updateBattery
(
UASInterface
*
,
double
,
double
,
int
)));
disconnect
(
this
->
uas
,
SIGNAL
(
statusChanged
(
UASInterface
*
,
QString
,
QString
)),
this
,
SLOT
(
updateState
(
UASInterface
*
,
QString
)));
disconnect
(
this
->
uas
,
SIGNAL
(
statusChanged
(
UASInterface
*
,
QString
,
QString
)),
this
,
SLOT
(
updateState
(
UASInterface
*
,
QString
)));
disconnect
(
this
->
uas
,
SIGNAL
(
modeChanged
(
int
,
QString
,
QString
)),
this
,
SLOT
(
updateMode
(
int
,
QString
,
QString
)));
disconnect
(
this
->
uas
,
SIGNAL
(
modeChanged
(
int
,
QString
,
QString
)),
this
,
SLOT
(
updateMode
(
int
,
QString
,
QString
)));
...
@@ -278,6 +279,7 @@ void HUD::setActiveUAS(UASInterface* uas)
...
@@ -278,6 +279,7 @@ void HUD::setActiveUAS(UASInterface* uas)
// Now connect the new UAS
// Now connect the new UAS
// Setup communication
// Setup communication
connect
(
uas
,
SIGNAL
(
attitudeChanged
(
UASInterface
*
,
double
,
double
,
double
,
quint64
)),
this
,
SLOT
(
updateAttitude
(
UASInterface
*
,
double
,
double
,
double
,
quint64
)));
connect
(
uas
,
SIGNAL
(
attitudeChanged
(
UASInterface
*
,
double
,
double
,
double
,
quint64
)),
this
,
SLOT
(
updateAttitude
(
UASInterface
*
,
double
,
double
,
double
,
quint64
)));
connect
(
this
->
uas
,
SIGNAL
(
attitudeChanged
(
UASInterface
*
,
int
,
double
,
double
,
double
,
quint64
)),
this
,
SLOT
(
updateAttitude
(
UASInterface
*
,
int
,
double
,
double
,
double
,
quint64
)));
connect
(
uas
,
SIGNAL
(
batteryChanged
(
UASInterface
*
,
double
,
double
,
int
)),
this
,
SLOT
(
updateBattery
(
UASInterface
*
,
double
,
double
,
int
)));
connect
(
uas
,
SIGNAL
(
batteryChanged
(
UASInterface
*
,
double
,
double
,
int
)),
this
,
SLOT
(
updateBattery
(
UASInterface
*
,
double
,
double
,
int
)));
connect
(
uas
,
SIGNAL
(
statusChanged
(
UASInterface
*
,
QString
,
QString
)),
this
,
SLOT
(
updateState
(
UASInterface
*
,
QString
)));
connect
(
uas
,
SIGNAL
(
statusChanged
(
UASInterface
*
,
QString
,
QString
)),
this
,
SLOT
(
updateState
(
UASInterface
*
,
QString
)));
connect
(
uas
,
SIGNAL
(
modeChanged
(
int
,
QString
,
QString
)),
this
,
SLOT
(
updateMode
(
int
,
QString
,
QString
)));
connect
(
uas
,
SIGNAL
(
modeChanged
(
int
,
QString
,
QString
)),
this
,
SLOT
(
updateMode
(
int
,
QString
,
QString
)));
...
@@ -317,6 +319,13 @@ void HUD::updateAttitude(UASInterface* uas, double roll, double pitch, double ya
...
@@ -317,6 +319,13 @@ void HUD::updateAttitude(UASInterface* uas, double roll, double pitch, double ya
this
->
yaw
=
yaw
;
this
->
yaw
=
yaw
;
}
}
void
HUD
::
updateAttitude
(
UASInterface
*
uas
,
int
component
,
double
roll
,
double
pitch
,
double
yaw
,
quint64
timestamp
)
{
Q_UNUSED
(
uas
);
Q_UNUSED
(
timestamp
);
attitudes
.
insert
(
component
,
QVector3D
(
roll
,
pitch
,
yaw
));
}
void
HUD
::
updateBattery
(
UASInterface
*
uas
,
double
voltage
,
double
percent
,
int
seconds
)
void
HUD
::
updateBattery
(
UASInterface
*
uas
,
double
voltage
,
double
percent
,
int
seconds
)
{
{
Q_UNUSED
(
uas
);
Q_UNUSED
(
uas
);
...
@@ -816,16 +825,37 @@ void HUD::paintHUD()
...
@@ -816,16 +825,37 @@ void HUD::paintHUD()
painter
.
translate
(
refToScreenX
(
yawTrans
),
0
);
painter
.
translate
(
refToScreenX
(
yawTrans
),
0
);
// Rotate view and draw all roll-dependent indicators
// Old single-component pitch drawing
painter
.
rotate
((
rollLP
/
M_PI
)
*
-
180.0
f
);
// // Rotate view and draw all roll-dependent indicators
// painter.rotate((rollLP/M_PI)* -180.0f);
// painter.translate(0, (-pitchLP/(float)M_PI)* -180.0f * refToScreenY(1.8f));
// //qDebug() << "ROLL" << roll << "PITCH" << pitch << "YAW DIFF" << valuesDot.value("roll", 0.0f);
painter
.
translate
(
0
,
(
-
pitchLP
/
(
float
)
M_PI
)
*
-
180.0
f
*
refToScreenY
(
1.8
f
));
// // PITCH
//qDebug() << "ROLL" << roll << "PITCH" << pitch << "YAW DIFF" << valuesDot.value("roll", 0.0f
);
// paintPitchLines(pitchLP, &painter
);
// PITCH
QColor
attColor
=
painter
.
pen
().
color
();
// Draw multi-component attitude
foreach
(
QVector3D
att
,
attitudes
.
values
())
{
attColor
=
attColor
.
darker
(
200
);
painter
.
setPen
(
attColor
);
// Rotate view and draw all roll-dependent indicators
painter
.
rotate
((
att
.
x
()
/
M_PI
)
*
-
180.0
f
);
painter
.
translate
(
0
,
(
-
att
.
y
()
/
(
float
)
M_PI
)
*
-
180.0
f
*
refToScreenY
(
1.8
f
));
//qDebug() << "ROLL" << roll << "PITCH" << pitch << "YAW DIFF" << valuesDot.value("roll", 0.0f);
// PITCH
paintPitchLines
(
att
.
y
(),
&
painter
);
}
paintPitchLines
(
pitchLP
,
&
painter
);
painter
.
end
();
painter
.
end
();
}
else
{
}
else
{
QPainter
painter
;
QPainter
painter
;
...
...
src/ui/HUD.h
View file @
d5c30100
...
@@ -37,6 +37,7 @@ This file is part of the QGROUNDCONTROL project
...
@@ -37,6 +37,7 @@ This file is part of the QGROUNDCONTROL project
#include <QPainter>
#include <QPainter>
#include <QFontDatabase>
#include <QFontDatabase>
#include <QTimer>
#include <QTimer>
#include <QVector3D>
#include "UASInterface.h"
#include "UASInterface.h"
/**
/**
...
@@ -63,7 +64,10 @@ public slots:
...
@@ -63,7 +64,10 @@ public slots:
/** @brief Set the currently monitored UAS */
/** @brief Set the currently monitored UAS */
virtual
void
setActiveUAS
(
UASInterface
*
uas
);
virtual
void
setActiveUAS
(
UASInterface
*
uas
);
/** @brief Attitude from main autopilot / system state */
void
updateAttitude
(
UASInterface
*
uas
,
double
roll
,
double
pitch
,
double
yaw
,
quint64
timestamp
);
void
updateAttitude
(
UASInterface
*
uas
,
double
roll
,
double
pitch
,
double
yaw
,
quint64
timestamp
);
/** @brief Attitude from one specific component / redundant autopilot */
void
updateAttitude
(
UASInterface
*
uas
,
int
component
,
double
roll
,
double
pitch
,
double
yaw
,
quint64
timestamp
);
// void updateAttitudeThrustSetPoint(UASInterface*, double rollDesired, double pitchDesired, double yawDesired, double thrustDesired, quint64 usec);
// void updateAttitudeThrustSetPoint(UASInterface*, double rollDesired, double pitchDesired, double yawDesired, double thrustDesired, quint64 usec);
void
updateBattery
(
UASInterface
*
,
double
,
double
,
int
);
void
updateBattery
(
UASInterface
*
,
double
,
double
,
int
);
void
receiveHeartbeat
(
UASInterface
*
);
void
receiveHeartbeat
(
UASInterface
*
);
...
@@ -193,6 +197,7 @@ protected:
...
@@ -193,6 +197,7 @@ protected:
float
roll
;
float
roll
;
float
pitch
;
float
pitch
;
float
yaw
;
float
yaw
;
QMap
<
uint8_t
,
QVector3D
>
attitudes
;
float
rollLP
;
float
rollLP
;
float
pitchLP
;
float
pitchLP
;
float
yawLP
;
float
yawLP
;
...
...
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