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
a0d526bf
Commit
a0d526bf
authored
Jun 08, 2010
by
lm
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cleaned up compile environment
parent
49d61d9e
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
116 additions
and
101 deletions
+116
-101
MAVLinkXMLParser.cc
src/comm/MAVLinkXMLParser.cc
+4
-0
PxQuadMAV.cc
src/uas/PxQuadMAV.cc
+101
-70
UAS.cc
src/uas/UAS.cc
+1
-21
HSIDisplay.cc
src/ui/HSIDisplay.cc
+5
-5
HSIDisplay.h
src/ui/HSIDisplay.h
+5
-5
No files found.
src/comm/MAVLinkXMLParser.cc
View file @
a0d526bf
...
...
@@ -73,6 +73,8 @@ bool MAVLinkXMLParser::generate()
QList
<
QPair
<
QString
,
QString
>
>
cFiles
;
QString
lcmStructDefs
=
""
;
QString
pureFileName
;
// Run through root children
while
(
!
n
.
isNull
())
{
...
...
@@ -103,6 +105,7 @@ bool MAVLinkXMLParser::generate()
{
QFileInfo
rInfo
(
this
->
fileName
);
fileName
=
rInfo
.
absoluteDir
().
canonicalPath
()
+
"/"
+
fileName
;
pureFileName
=
rInfo
.
baseName
().
split
(
"."
).
first
();
}
QFile
file
(
fileName
);
...
...
@@ -365,6 +368,7 @@ bool MAVLinkXMLParser::generate()
// Mark all code as C code
mainHeader
+=
"#ifdef __cplusplus
\n
extern
\"
C
\"
{
\n
#endif
\n\n
"
;
mainHeader
+=
"
\n
#include
\"
protocol.h
\"\n
"
;
mainHeader
+=
"
\n
#define MAVLINK_ENABLED_"
+
pureFileName
.
toUpper
()
+
"
\n\n
"
;
QString
includeLine
=
"#include
\"
%1
\"\n
"
;
QString
mainHeaderName
=
"mavlink.h"
;
QString
messagesDirName
=
"generated"
;
...
...
src/uas/PxQuadMAV.cc
View file @
a0d526bf
...
...
@@ -20,93 +20,123 @@ void PxQuadMAV::receiveMessage(LinkInterface* link, mavlink_message_t message)
UAS
::
receiveMessage
(
link
,
message
);
mavlink_message_t
*
msg
=
&
message
;
//qDebug() << "PX RECEIVED" << msg->sysid << msg->compid << msg->msgid;
//qDebug() << "PX RECEIVED" << msg->sysid << msg->compid << msg->msgid;
// Only compile this portion if matching MAVLink packets have been compiled
#ifdef MAVLINK_ENABLED_PIXHAWK_MESSAGES
// Handle your special messages
switch
(
msg
->
msgid
)
if
(
message
.
sysid
==
uasId
)
{
case
MAVLINK_MSG_ID_WATCHDOG_HEARTBEAT
:
QString
uasState
;
QString
stateDescription
;
QString
patternPath
;
switch
(
message
.
msgid
)
{
mavlink_watchdog_heartbeat_t
payload
;
mavlink_msg_watchdog_heartbeat_decode
(
msg
,
&
payload
);
emit
watchdogReceived
(
this
->
uasId
,
payload
.
watchdog_id
,
payload
.
process_count
);
}
break
;
case
MAVLINK_MSG_ID_RAW_AUX
:
{
mavlink_raw_aux_t
raw
;
mavlink_msg_raw_aux_decode
(
&
message
,
&
raw
);
quint64
time
=
getUnixTime
(
0
);
emit
valueChanged
(
uasId
,
"Pressure"
,
raw
.
baro
,
time
);
emit
valueChanged
(
uasId
,
"Temperature"
,
raw
.
temp
,
time
);
}
break
;
case
MAVLINK_MSG_ID_PATTERN_DETECTED
:
{
QByteArray
b
;
b
.
resize
(
256
);
mavlink_msg_pattern_detected_get_file
(
&
message
,
(
int8_t
*
)
b
.
data
());
b
.
append
(
'\0'
);
QString
path
=
QString
(
b
);
bool
detected
(
mavlink_msg_pattern_detected_get_detected
(
&
message
)
==
1
?
true
:
false
);
emit
detectionReceived
(
uasId
,
path
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
mavlink_msg_pattern_detected_get_confidence
(
&
message
),
detected
);
}
break
;
case
MAVLINK_MSG_ID_WATCHDOG_HEARTBEAT
:
{
mavlink_watchdog_heartbeat_t
payload
;
mavlink_msg_watchdog_heartbeat_decode
(
msg
,
&
payload
);
emit
watchdogReceived
(
this
->
uasId
,
payload
.
watchdog_id
,
payload
.
process_count
);
}
break
;
case
MAVLINK_MSG_ID_WATCHDOG_PROCESS_INFO
:
{
mavlink_watchdog_process_info_t
payload
;
mavlink_msg_watchdog_process_info_decode
(
msg
,
&
payload
);
emit
processReceived
(
this
->
uasId
,
payload
.
watchdog_id
,
payload
.
process_id
,
QString
((
const
char
*
)
payload
.
name
),
QString
((
const
char
*
)
payload
.
arguments
),
payload
.
timeout
);
}
break
;
{
mavlink_watchdog_process_info_t
payload
;
mavlink_msg_watchdog_process_info_decode
(
msg
,
&
payload
);
emit
processReceived
(
this
->
uasId
,
payload
.
watchdog_id
,
payload
.
process_id
,
QString
((
const
char
*
)
payload
.
name
),
QString
((
const
char
*
)
payload
.
arguments
),
payload
.
timeout
);
}
break
;
case
MAVLINK_MSG_ID_WATCHDOG_PROCESS_STATUS
:
{
mavlink_watchdog_process_status_t
payload
;
mavlink_msg_watchdog_process_status_decode
(
msg
,
&
payload
);
emit
processChanged
(
this
->
uasId
,
payload
.
watchdog_id
,
payload
.
process_id
,
payload
.
state
,
(
payload
.
muted
==
1
)
?
true
:
false
,
payload
.
crashes
,
payload
.
pid
);
}
break
;
{
mavlink_watchdog_process_status_t
payload
;
mavlink_msg_watchdog_process_status_decode
(
msg
,
&
payload
);
emit
processChanged
(
this
->
uasId
,
payload
.
watchdog_id
,
payload
.
process_id
,
payload
.
state
,
(
payload
.
muted
==
1
)
?
true
:
false
,
payload
.
crashes
,
payload
.
pid
);
}
break
;
case
MAVLINK_MSG_ID_DEBUG_VECT
:
{
mavlink_debug_vect_t
vect
;
mavlink_msg_debug_vect_decode
(
msg
,
&
vect
);
QString
str
((
const
char
*
)
vect
.
name
);
emit
valueChanged
(
uasId
,
str
+
".x"
,
vect
.
x
,
MG
::
TIME
::
getGroundTimeNow
());
emit
valueChanged
(
uasId
,
str
+
".y"
,
vect
.
y
,
MG
::
TIME
::
getGroundTimeNow
());
emit
valueChanged
(
uasId
,
str
+
".z"
,
vect
.
z
,
MG
::
TIME
::
getGroundTimeNow
());
}
break
;
{
mavlink_debug_vect_t
vect
;
mavlink_msg_debug_vect_decode
(
msg
,
&
vect
);
QString
str
((
const
char
*
)
vect
.
name
);
emit
valueChanged
(
uasId
,
str
+
".x"
,
vect
.
x
,
MG
::
TIME
::
getGroundTimeNow
());
emit
valueChanged
(
uasId
,
str
+
".y"
,
vect
.
y
,
MG
::
TIME
::
getGroundTimeNow
());
emit
valueChanged
(
uasId
,
str
+
".z"
,
vect
.
z
,
MG
::
TIME
::
getGroundTimeNow
());
}
break
;
case
MAVLINK_MSG_ID_VISION_POSITION_ESTIMATE
:
{
mavlink_vision_position_estimate_t
pos
;
mavlink_msg_vision_position_estimate_decode
(
&
message
,
&
pos
);
quint64
time
=
getUnixTime
(
pos
.
usec
);
emit
valueChanged
(
uasId
,
"vis. time"
,
pos
.
usec
,
time
);
emit
valueChanged
(
uasId
,
"vis. roll"
,
pos
.
roll
,
time
);
emit
valueChanged
(
uasId
,
"vis. pitch"
,
pos
.
pitch
,
time
);
emit
valueChanged
(
uasId
,
"vis. yaw"
,
pos
.
yaw
,
time
);
emit
valueChanged
(
uasId
,
"vis. x"
,
pos
.
x
,
time
);
emit
valueChanged
(
uasId
,
"vis. y"
,
pos
.
y
,
time
);
emit
valueChanged
(
uasId
,
"vis. z"
,
pos
.
z
,
time
);
emit
valueChanged
(
uasId
,
"vis. vx"
,
pos
.
vx
,
time
);
emit
valueChanged
(
uasId
,
"vis. vy"
,
pos
.
vy
,
time
);
emit
valueChanged
(
uasId
,
"vis. vz"
,
pos
.
vz
,
time
);
emit
valueChanged
(
uasId
,
"vis. vyaw"
,
pos
.
vyaw
,
time
);
// Set internal state
if
(
!
positionLock
)
{
// If position was not locked before, notify positive
GAudioOutput
::
instance
()
->
notifyPositive
();
mavlink_vision_position_estimate_t
pos
;
mavlink_msg_vision_position_estimate_decode
(
&
message
,
&
pos
);
quint64
time
=
getUnixTime
(
pos
.
usec
);
emit
valueChanged
(
uasId
,
"vis. time"
,
pos
.
usec
,
time
);
emit
valueChanged
(
uasId
,
"vis. roll"
,
pos
.
roll
,
time
);
emit
valueChanged
(
uasId
,
"vis. pitch"
,
pos
.
pitch
,
time
);
emit
valueChanged
(
uasId
,
"vis. yaw"
,
pos
.
yaw
,
time
);
emit
valueChanged
(
uasId
,
"vis. x"
,
pos
.
x
,
time
);
emit
valueChanged
(
uasId
,
"vis. y"
,
pos
.
y
,
time
);
emit
valueChanged
(
uasId
,
"vis. z"
,
pos
.
z
,
time
);
emit
valueChanged
(
uasId
,
"vis. vx"
,
pos
.
vx
,
time
);
emit
valueChanged
(
uasId
,
"vis. vy"
,
pos
.
vy
,
time
);
emit
valueChanged
(
uasId
,
"vis. vz"
,
pos
.
vz
,
time
);
emit
valueChanged
(
uasId
,
"vis. vyaw"
,
pos
.
vyaw
,
time
);
// Set internal state
if
(
!
positionLock
)
{
// If position was not locked before, notify positive
GAudioOutput
::
instance
()
->
notifyPositive
();
}
positionLock
=
true
;
}
positionLock
=
true
;
}
break
;
break
;
case
MAVLINK_MSG_ID_AUX_STATUS
:
{
mavlink_aux_status_t
status
;
mavlink_msg_aux_status_decode
(
&
message
,
&
status
);
emit
loadChanged
(
this
,
status
.
load
/
10.0
f
);
emit
errCountChanged
(
uasId
,
"IMU"
,
"I2C0"
,
status
.
i2c0_err_count
);
emit
errCountChanged
(
uasId
,
"IMU"
,
"I2C1"
,
status
.
i2c1_err_count
);
emit
errCountChanged
(
uasId
,
"IMU"
,
"SPI0"
,
status
.
spi0_err_count
);
emit
errCountChanged
(
uasId
,
"IMU"
,
"SPI1"
,
status
.
spi1_err_count
);
emit
errCountChanged
(
uasId
,
"IMU"
,
"UART"
,
status
.
uart_total_err_count
);
emit
valueChanged
(
this
,
"Load"
,
((
float
)
status
.
load
)
/
1000.0
f
,
MG
::
TIME
::
getGroundTimeNow
());
}
break
;
{
mavlink_aux_status_t
status
;
mavlink_msg_aux_status_decode
(
&
message
,
&
status
);
emit
loadChanged
(
this
,
status
.
load
/
10.0
f
);
emit
errCountChanged
(
uasId
,
"IMU"
,
"I2C0"
,
status
.
i2c0_err_count
);
emit
errCountChanged
(
uasId
,
"IMU"
,
"I2C1"
,
status
.
i2c1_err_count
);
emit
errCountChanged
(
uasId
,
"IMU"
,
"SPI0"
,
status
.
spi0_err_count
);
emit
errCountChanged
(
uasId
,
"IMU"
,
"SPI1"
,
status
.
spi1_err_count
);
emit
errCountChanged
(
uasId
,
"IMU"
,
"UART"
,
status
.
uart_total_err_count
);
emit
valueChanged
(
this
,
"Load"
,
((
float
)
status
.
load
)
/
1000.0
f
,
MG
::
TIME
::
getGroundTimeNow
());
}
break
;
default:
// Do nothing
break
;
// Do nothing
break
;
}
}
#endif
}
void
PxQuadMAV
::
sendProcessCommand
(
int
watchdogId
,
int
processId
,
unsigned
int
command
)
{
#ifdef MAVLINK_ENABLED_PIXHAWK_MESSAGES
mavlink_watchdog_command_t
payload
;
payload
.
target_system_id
=
uasId
;
payload
.
watchdog_id
=
watchdogId
;
...
...
@@ -116,4 +146,5 @@ void PxQuadMAV::sendProcessCommand(int watchdogId, int processId, unsigned int c
mavlink_message_t
msg
;
mavlink_msg_watchdog_command_encode
(
mavlink
->
getSystemId
(),
mavlink
->
getComponentId
(),
&
msg
,
&
payload
);
sendMessage
(
msg
);
#endif
}
src/uas/UAS.cc
View file @
a0d526bf
...
...
@@ -266,15 +266,6 @@ void UAS::receiveMessage(LinkInterface* link, mavlink_message_t message)
emit
valueChanged
(
uasId
,
"Mag. Z"
,
raw
.
zmag
,
time
);
}
break
;
case
MAVLINK_MSG_ID_RAW_AUX
:
{
mavlink_raw_aux_t
raw
;
mavlink_msg_raw_aux_decode
(
&
message
,
&
raw
);
quint64
time
=
getUnixTime
(
0
);
emit
valueChanged
(
uasId
,
"Pressure"
,
raw
.
baro
,
time
);
emit
valueChanged
(
uasId
,
"Temperature"
,
raw
.
temp
,
time
);
}
break
;
case
MAVLINK_MSG_ID_ATTITUDE
:
//std::cerr << std::endl;
//std::cerr << "Decoded attitude message:" << " roll: " << std::dec << mavlink_msg_attitude_get_roll(message.payload) << " pitch: " << mavlink_msg_attitude_get_pitch(message.payload) << " yaw: " << mavlink_msg_attitude_get_yaw(message.payload) << std::endl;
...
...
@@ -349,7 +340,7 @@ void UAS::receiveMessage(LinkInterface* link, mavlink_message_t message)
//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_
azimuth
[
i
],
pos
.
satellite_direction
[
i
],
pos
.
satellite_snr
[
i
],
static_cast
<
bool
>
(
pos
.
satellite_used
[
i
]));
emit
gpsSatelliteStatusChanged
(
uasId
,
i
,
pos
.
satellite_
elevation
[
i
],
pos
.
satellite_azimuth
[
i
],
pos
.
satellite_snr
[
i
],
static_cast
<
bool
>
(
pos
.
satellite_used
[
i
]));
}
}
break
;
...
...
@@ -390,17 +381,6 @@ void UAS::receiveMessage(LinkInterface* link, mavlink_message_t message)
emit
textMessageReceived
(
uasId
,
severity
,
text
);
}
break
;
case
MAVLINK_MSG_ID_PATTERN_DETECTED
:
{
QByteArray
b
;
b
.
resize
(
256
);
mavlink_msg_pattern_detected_get_file
(
&
message
,
(
int8_t
*
)
b
.
data
());
b
.
append
(
'\0'
);
QString
path
=
QString
(
b
);
bool
detected
(
mavlink_msg_pattern_detected_get_detected
(
&
message
)
==
1
?
true
:
false
);
emit
detectionReceived
(
uasId
,
path
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
mavlink_msg_pattern_detected_get_confidence
(
&
message
),
detected
);
}
break
;
default:
{
if
(
!
unknownPackets
.
contains
(
message
.
msgid
))
...
...
src/ui/HSIDisplay.cc
View file @
a0d526bf
...
...
@@ -146,7 +146,7 @@ void HSIDisplay::setActiveUAS(UASInterface* uas)
//}
}
void
HSIDisplay
::
updateSatellite
(
int
uasid
,
int
satid
,
float
azimuth
,
float
direction
,
float
snr
,
bool
used
)
void
HSIDisplay
::
updateSatellite
(
int
uasid
,
int
satid
,
float
elevation
,
float
azimuth
,
float
snr
,
bool
used
)
{
Q_UNUSED
(
uasid
);
//qDebug() << "UPDATED SATELLITE";
...
...
@@ -159,12 +159,12 @@ void HSIDisplay::updateSatellite(int uasid, int satid, float azimuth, float dire
if
(
gpsSatellites
.
at
(
satid
)
==
NULL
)
{
gpsSatellites
.
insert
(
satid
,
new
GPSSatellite
(
satid
,
azimuth
,
direction
,
snr
,
used
));
gpsSatellites
.
insert
(
satid
,
new
GPSSatellite
(
satid
,
elevation
,
azimuth
,
snr
,
used
));
}
else
{
// Satellite exists, update it
gpsSatellites
.
at
(
satid
)
->
update
(
satid
,
azimuth
,
direction
,
snr
,
used
);
gpsSatellites
.
at
(
satid
)
->
update
(
satid
,
elevation
,
azimuth
,
snr
,
used
);
}
}
...
...
@@ -230,8 +230,8 @@ void HSIDisplay::drawGPS()
painter
.
setPen
(
color
);
painter
.
setBrush
(
brush
);
float
xPos
=
xCenter
+
sin
(
sat
->
direction
/
180.0
f
*
M_PI
)
*
(
sat
->
azimuth
/
180.0
f
*
M_PI
)
*
radius
;
float
yPos
=
yCenter
+
cos
(
sat
->
direction
/
180.0
f
*
M_PI
)
*
(
sat
->
azimuth
/
180.0
f
*
M_PI
)
*
radius
;
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
;
drawCircle
(
xPos
,
yPos
,
vwidth
*
0.02
f
,
1.0
f
,
color
,
&
painter
);
}
...
...
src/ui/HSIDisplay.h
View file @
a0d526bf
...
...
@@ -68,28 +68,28 @@ protected:
class
GPSSatellite
{
public:
GPSSatellite
(
int
id
,
float
azimuth
,
float
direction
,
float
snr
,
bool
used
)
:
GPSSatellite
(
int
id
,
float
elevation
,
float
azimuth
,
float
snr
,
bool
used
)
:
id
(
id
),
elevation
(
elevation
),
azimuth
(
azimuth
),
direction
(
direction
),
snr
(
snr
),
used
(
used
)
{
}
void
update
(
int
id
,
float
azimuth
,
float
direction
,
float
snr
,
bool
used
)
void
update
(
int
id
,
float
elevation
,
float
azimuth
,
float
snr
,
bool
used
)
{
this
->
id
=
id
;
this
->
elevation
=
elevation
;
this
->
azimuth
=
azimuth
;
this
->
direction
=
direction
;
this
->
snr
=
snr
;
this
->
used
=
used
;
}
int
id
;
float
elevation
;
float
azimuth
;
float
direction
;
float
snr
;
bool
used
;
...
...
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