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
942c554b
Commit
942c554b
authored
Apr 12, 2019
by
Gus Grubba
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Early work on the MAVLink Inspector Controller
parent
42288925
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
212 additions
and
6 deletions
+212
-6
qgroundcontrol.pro
qgroundcontrol.pro
+6
-4
CMakeLists.txt
src/AnalyzeView/CMakeLists.txt
+1
-0
GeoTagController.cc
src/AnalyzeView/GeoTagController.cc
+0
-2
MAVLinkInspectorController.cc
src/AnalyzeView/MAVLinkInspectorController.cc
+161
-0
MAVLinkInspectorController.h
src/AnalyzeView/MAVLinkInspectorController.h
+42
-0
QGCApplication.cc
src/QGCApplication.cc
+2
-0
No files found.
qgroundcontrol.pro
View file @
942c554b
...
...
@@ -396,10 +396,11 @@ SOURCES += \
#
Main
QGC
Headers
and
Source
files
HEADERS
+=
\
src
/
AnalyzeView
/
ExifParser
.
h
\
src
/
AnalyzeView
/
LogDownloadController
.
h
\
src
/
AnalyzeView
/
PX4LogParser
.
h
\
src
/
AnalyzeView
/
ULogParser
.
h
\
src
/
AnalyzeView
/
MAVLinkInspectorController
.
h
\
src
/
AnalyzeView
/
MavlinkConsoleController
.
h
\
src
/
Audio
/
AudioOutput
.
h
\
src
/
Camera
/
QGCCameraControl
.
h
\
src
/
Camera
/
QGCCameraIO
.
h
\
...
...
@@ -506,7 +507,6 @@ HEADERS += \
src
/
uas
/
UASInterface
.
h
\
src
/
uas
/
UASMessageHandler
.
h
\
src
/
UTM
.
h
\
src
/
AnalyzeView
/
MavlinkConsoleController
.
h
\
AndroidBuild
{
...
...
@@ -542,6 +542,7 @@ HEADERS += \
!
MobileBuild
{
HEADERS
+=
\
src
/
AnalyzeView
/
GeoTagController
.
h
\
src
/
AnalyzeView
/
ExifParser
.
h
\
src
/
GPS
/
Drivers
/
src
/
gps_helper
.
h
\
src
/
GPS
/
Drivers
/
src
/
rtcm
.
h
\
src
/
GPS
/
Drivers
/
src
/
ashtech
.
h
\
...
...
@@ -575,10 +576,11 @@ AndroidBuild {
}
SOURCES
+=
\
src
/
AnalyzeView
/
ExifParser
.
cc
\
src
/
AnalyzeView
/
LogDownloadController
.
cc
\
src
/
AnalyzeView
/
PX4LogParser
.
cc
\
src
/
AnalyzeView
/
ULogParser
.
cc
\
src
/
AnalyzeView
/
MAVLinkInspectorController
.
cc
\
src
/
AnalyzeView
/
MavlinkConsoleController
.
cc
\
src
/
Audio
/
AudioOutput
.
cc
\
src
/
Camera
/
QGCCameraControl
.
cc
\
src
/
Camera
/
QGCCameraIO
.
cc
\
...
...
@@ -680,7 +682,6 @@ SOURCES += \
src
/
uas
/
UAS
.
cc
\
src
/
uas
/
UASMessageHandler
.
cc
\
src
/
UTM
.
cpp
\
src
/
AnalyzeView
/
MavlinkConsoleController
.
cc
\
DebugBuild
{
SOURCES
+=
\
...
...
@@ -703,6 +704,7 @@ contains(DEFINES, QGC_ENABLE_BLUETOOTH) {
!
MobileBuild
{
SOURCES
+=
\
src
/
AnalyzeView
/
GeoTagController
.
cc
\
src
/
AnalyzeView
/
ExifParser
.
cc
\
src
/
GPS
/
Drivers
/
src
/
gps_helper
.
cpp
\
src
/
GPS
/
Drivers
/
src
/
rtcm
.
cpp
\
src
/
GPS
/
Drivers
/
src
/
ashtech
.
cpp
\
...
...
src/AnalyzeView/CMakeLists.txt
View file @
942c554b
...
...
@@ -9,6 +9,7 @@ endif()
add_library
(
AnalyzeView
ExifParser.cc
GeoTagController.cc
MAVLinkInspectorController.cc
LogDownloadController.cc
MavlinkConsoleController.cc
PX4LogParser.cc
...
...
src/AnalyzeView/GeoTagController.cc
View file @
942c554b
...
...
@@ -8,11 +8,9 @@
****************************************************************************/
#include "GeoTagController.h"
//#include "QGCQFileDialog.h"
#include "QGCLoggingCategory.h"
#include <math.h>
#include <QtEndian>
#include <QMessageBox>
#include <QDebug>
#include <cfloat>
#include <QDir>
...
...
src/AnalyzeView/MAVLinkInspectorController.cc
0 → 100644
View file @
942c554b
/****************************************************************************
*
* (c) 2009-2016 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
*
* QGroundControl is licensed according to the terms in the file
* COPYING.md in the root of the source code directory.
*
****************************************************************************/
#include "MAVLinkInspectorController.h"
#include "QGCApplication.h"
#include "MultiVehicleManager.h"
//-----------------------------------------------------------------------------
MAVLinkInspectorController
::
MAVLinkInspectorController
()
{
MultiVehicleManager
*
multiVehicleManager
=
qgcApp
()
->
toolbox
()
->
multiVehicleManager
();
connect
(
multiVehicleManager
,
&
MultiVehicleManager
::
vehicleAdded
,
this
,
&
MAVLinkInspectorController
::
_vehicleAdded
);
connect
(
multiVehicleManager
,
&
MultiVehicleManager
::
vehicleRemoved
,
this
,
&
MAVLinkInspectorController
::
_vehicleRemoved
);
MAVLinkProtocol
*
mavlinkProtocol
=
qgcApp
()
->
toolbox
()
->
mavlinkProtocol
();
connect
(
mavlinkProtocol
,
&
MAVLinkProtocol
::
messageReceived
,
this
,
&
MAVLinkInspectorController
::
_receiveMessage
);
}
//-----------------------------------------------------------------------------
MAVLinkInspectorController
::~
MAVLinkInspectorController
()
{
_reset
();
}
//-----------------------------------------------------------------------------
void
MAVLinkInspectorController
::
_vehicleAdded
(
Vehicle
*
vehicle
)
{
_vehicleIDs
.
append
(
vehicle
->
id
());
}
//-----------------------------------------------------------------------------
void
MAVLinkInspectorController
::
_vehicleRemoved
(
Vehicle
*
vehicle
)
{
int
idx
=
_vehicleIDs
.
indexOf
(
vehicle
->
id
());
if
(
idx
>=
0
)
{
_vehicleIDs
.
removeAt
(
idx
);
}
}
//-----------------------------------------------------------------------------
void
MAVLinkInspectorController
::
_receiveMessage
(
LinkInterface
*
link
,
mavlink_message_t
message
)
{
Q_UNUSED
(
link
);
quint64
receiveTime
;
if
(
_selectedSystemID
!=
0
&&
_selectedSystemID
!=
message
.
sysid
)
return
;
if
(
_selectedComponentID
!=
0
&&
_selectedComponentID
!=
message
.
compid
)
return
;
// Create dynamically an array to store the messages for each UAS
if
(
!
_uasMessageStorage
.
contains
(
message
.
sysid
))
{
mavlink_message_t
*
msg
=
new
mavlink_message_t
;
*
msg
=
message
;
_uasMessageStorage
.
insertMulti
(
message
.
sysid
,
msg
);
}
bool
msgFound
=
false
;
QMap
<
int
,
mavlink_message_t
*>::
const_iterator
iteMsg
=
_uasMessageStorage
.
find
(
message
.
sysid
);
mavlink_message_t
*
uasMessage
=
iteMsg
.
value
();
while
((
iteMsg
!=
_uasMessageStorage
.
end
())
&&
(
iteMsg
.
key
()
==
message
.
sysid
))
{
if
(
iteMsg
.
value
()
->
msgid
==
message
.
msgid
)
{
msgFound
=
true
;
uasMessage
=
iteMsg
.
value
();
break
;
}
++
iteMsg
;
}
if
(
!
msgFound
)
{
mavlink_message_t
*
msgIdMessage
=
new
mavlink_message_t
;
*
msgIdMessage
=
message
;
_uasMessageStorage
.
insertMulti
(
message
.
sysid
,
msgIdMessage
);
}
else
{
*
uasMessage
=
message
;
}
// Looking if this message has already been received once
msgFound
=
false
;
QMap
<
int
,
QMap
<
int
,
quint64
>*
>::
const_iterator
ite
=
_uasLastMessageUpdate
.
find
(
message
.
sysid
);
QMap
<
int
,
quint64
>*
lastMsgUpdate
=
ite
.
value
();
while
((
ite
!=
_uasLastMessageUpdate
.
end
())
&&
(
ite
.
key
()
==
message
.
sysid
))
{
if
(
ite
.
value
()
->
contains
(
message
.
msgid
))
{
msgFound
=
true
;
//-- Point to the found message
lastMsgUpdate
=
ite
.
value
();
break
;
}
++
ite
;
}
receiveTime
=
QGC
::
groundTimeMilliseconds
();
//-- If the message doesn't exist, create a map for the frequency, message count and time of reception
if
(
!
msgFound
)
{
//-- Create a map for the message frequency
QMap
<
int
,
float
>*
messageHz
=
new
QMap
<
int
,
float
>
;
messageHz
->
insert
(
message
.
msgid
,
0.0
f
);
_uasMessageHz
.
insertMulti
(
message
.
sysid
,
messageHz
);
//-- Create a map for the message count
QMap
<
int
,
unsigned
int
>*
messagesCount
=
new
QMap
<
int
,
unsigned
int
>
;
messagesCount
->
insert
(
message
.
msgid
,
0
);
_uasMessageCount
.
insertMulti
(
message
.
sysid
,
messagesCount
);
//-- Create a map for the time of reception of the message
QMap
<
int
,
quint64
>*
lastMessage
=
new
QMap
<
int
,
quint64
>
;
lastMessage
->
insert
(
message
.
msgid
,
receiveTime
);
_uasLastMessageUpdate
.
insertMulti
(
message
.
sysid
,
lastMessage
);
//-- Point to the created message
lastMsgUpdate
=
lastMessage
;
}
else
{
//-- The message has been found/created
if
((
lastMsgUpdate
->
contains
(
message
.
msgid
))
&&
(
_uasMessageCount
.
contains
(
message
.
sysid
)))
{
//-- Looking for and updating the message count
unsigned
int
count
=
0
;
QMap
<
int
,
QMap
<
int
,
unsigned
int
>*
>::
const_iterator
iter
=
_uasMessageCount
.
find
(
message
.
sysid
);
QMap
<
int
,
unsigned
int
>
*
uasMsgCount
=
iter
.
value
();
while
((
iter
!=
_uasMessageCount
.
end
())
&&
(
iter
.
key
()
==
message
.
sysid
))
{
if
(
iter
.
value
()
->
contains
(
message
.
msgid
))
{
uasMsgCount
=
iter
.
value
();
count
=
uasMsgCount
->
value
(
message
.
msgid
,
0
);
uasMsgCount
->
insert
(
message
.
msgid
,
count
+
1
);
break
;
}
++
iter
;
}
}
lastMsgUpdate
->
insert
(
message
.
msgid
,
receiveTime
);
}
}
//-----------------------------------------------------------------------------
void
MAVLinkInspectorController
::
_reset
()
{
QMap
<
int
,
mavlink_message_t
*
>::
iterator
ite
;
for
(
ite
=
_uasMessageStorage
.
begin
();
ite
!=
_uasMessageStorage
.
end
();
++
ite
)
{
delete
ite
.
value
();
ite
.
value
()
=
nullptr
;
}
_uasMessageStorage
.
clear
();
QMap
<
int
,
QMap
<
int
,
float
>*
>::
iterator
iteHz
;
for
(
iteHz
=
_uasMessageHz
.
begin
();
iteHz
!=
_uasMessageHz
.
end
();
++
iteHz
)
{
iteHz
.
value
()
->
clear
();
delete
iteHz
.
value
();
iteHz
.
value
()
=
nullptr
;
}
_uasMessageHz
.
clear
();
QMap
<
int
,
QMap
<
int
,
unsigned
int
>*>::
iterator
iteCount
;
for
(
iteCount
=
_uasMessageCount
.
begin
();
iteCount
!=
_uasMessageCount
.
end
();
++
iteCount
)
{
iteCount
.
value
()
->
clear
();
delete
iteCount
.
value
();
iteCount
.
value
()
=
nullptr
;
}
_uasMessageCount
.
clear
();
QMap
<
int
,
QMap
<
int
,
quint64
>*
>::
iterator
iteLast
;
for
(
iteLast
=
_uasLastMessageUpdate
.
begin
();
iteLast
!=
_uasLastMessageUpdate
.
end
();
++
iteLast
)
{
iteLast
.
value
()
->
clear
();
delete
iteLast
.
value
();
iteLast
.
value
()
=
nullptr
;
}
_uasLastMessageUpdate
.
clear
();
}
src/AnalyzeView/MAVLinkInspectorController.h
0 → 100644
View file @
942c554b
/****************************************************************************
*
* (c) 2009-2016 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
*
* QGroundControl is licensed according to the terms in the file
* COPYING.md in the root of the source code directory.
*
****************************************************************************/
#pragma once
#include "MAVLinkProtocol.h"
#include "Vehicle.h"
#include <QObject>
#include <QString>
#include <QDebug>
class
MAVLinkInspectorController
:
public
QObject
{
Q_OBJECT
public:
MAVLinkInspectorController
();
~
MAVLinkInspectorController
();
private
slots
:
void
_receiveMessage
(
LinkInterface
*
link
,
mavlink_message_t
message
);
void
_vehicleAdded
(
Vehicle
*
vehicle
);
void
_vehicleRemoved
(
Vehicle
*
vehicle
);
private:
void
_reset
();
private:
int
_selectedSystemID
=
0
;
///< Currently selected system
int
_selectedComponentID
=
0
;
///< Currently selected component
QList
<
int
>
_vehicleIDs
;
QMap
<
int
,
mavlink_message_t
*>
_uasMessageStorage
;
///< Stores the messages for every UAS
QMap
<
int
,
QMap
<
int
,
quint64
>*>
_uasLastMessageUpdate
;
///< Stores the time of the last message for each message of each UAS
QMap
<
int
,
QMap
<
int
,
float
>*>
_uasMessageHz
;
///< Stores the frequency of each message of each UAS
QMap
<
int
,
QMap
<
int
,
unsigned
int
>*>
_uasMessageCount
;
///< Stores the message count of each message of each UAS
};
src/QGCApplication.cc
View file @
942c554b
...
...
@@ -91,6 +91,7 @@
#include "QGCFileDownload.h"
#include "FirmwareImage.h"
#include "MavlinkConsoleController.h"
#include "MAVLinkInspectorController.h"
#ifndef __mobile__
#include "FirmwareUpgradeController.h"
#endif
...
...
@@ -455,6 +456,7 @@ void QGCApplication::_initCommon()
qmlRegisterType
<
GeoTagController
>
(
kQGCControllers
,
1
,
0
,
"GeoTagController"
);
#endif
qmlRegisterType
<
MavlinkConsoleController
>
(
kQGCControllers
,
1
,
0
,
"MavlinkConsoleController"
);
qmlRegisterType
<
MAVLinkInspectorController
>
(
kQGCControllers
,
1
,
0
,
"MAVLinkInspectorController"
);
// Register Qml Singletons
qmlRegisterSingletonType
<
QGroundControlQmlGlobal
>
(
"QGroundControl"
,
1
,
0
,
"QGroundControl"
,
qgroundcontrolQmlGlobalSingletonFactory
);
...
...
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