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
af2a3970
Commit
af2a3970
authored
May 02, 2019
by
Gus Grubba
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implement MAVLink Inspector (WIP)
parent
f1aa7947
Changes
11
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
600 additions
and
124 deletions
+600
-124
qgroundcontrol.qrc
qgroundcontrol.qrc
+1
-0
AnalyzePage.qml
src/AnalyzeView/AnalyzePage.qml
+1
-1
AnalyzeView.qml
src/AnalyzeView/AnalyzeView.qml
+6
-3
LogDownloadController.h
src/AnalyzeView/LogDownloadController.h
+1
-1
MAVLinkInspectorController.cc
src/AnalyzeView/MAVLinkInspectorController.cc
+322
-104
MAVLinkInspectorController.h
src/AnalyzeView/MAVLinkInspectorController.h
+101
-9
MAVLinkInspectorPage.qml
src/AnalyzeView/MAVLinkInspectorPage.qml
+162
-0
QGCApplication.cc
src/QGCApplication.cc
+2
-0
QGCFlickable.qml
src/QmlControls/QGCFlickable.qml
+0
-2
QmlObjectListModel.cc
src/QmlControls/QmlObjectListModel.cc
+2
-2
QmlObjectListModel.h
src/QmlControls/QmlObjectListModel.h
+2
-2
No files found.
qgroundcontrol.qrc
View file @
af2a3970
...
...
@@ -42,6 +42,7 @@
<file alias="LogReplaySettings.qml">src/ui/preferences/LogReplaySettings.qml</file>
<file alias="MainRootWindow.qml">src/ui/MainRootWindow.qml</file>
<file alias="MavlinkConsolePage.qml">src/AnalyzeView/MavlinkConsolePage.qml</file>
<file alias="MAVLinkInspectorPage.qml">src/AnalyzeView/MAVLinkInspectorPage.qml</file>
<file alias="MavlinkSettings.qml">src/ui/preferences/MavlinkSettings.qml</file>
<file alias="MicrohardSettings.qml">src/Microhard/MicrohardSettings.qml</file>
<file alias="MissionSettingsEditor.qml">src/PlanView/MissionSettingsEditor.qml</file>
...
...
src/AnalyzeView/AnalyzePage.qml
View file @
af2a3970
...
...
@@ -23,7 +23,7 @@ Item {
property
alias
pageComponent
:
pageLoader
.
sourceComponent
property
alias
pageName
:
pageNameLabel
.
text
property
alias
pageDescription
:
pageDescriptionLabel
.
text
property
real
availableWidth
:
width
-
pageLoader
.
x
property
real
availableWidth
:
width
-
pageLoader
.
x
property
real
availableHeight
:
height
-
pageLoader
.
y
property
real
_margins
:
ScreenTools
.
defaultFontPixelHeight
*
0.5
...
...
src/AnalyzeView/AnalyzeView.qml
View file @
af2a3970
...
...
@@ -26,8 +26,6 @@ Rectangle {
color
:
qgcPal
.
window
z
:
QGroundControl
.
zOrderTopMost
QGCPalette
{
id
:
qgcPal
;
colorGroupEnabled
:
true
}
ExclusiveGroup
{
id
:
setupButtonGroup
}
readonly
property
real
_defaultTextHeight
:
ScreenTools
.
defaultFontPixelHeight
...
...
@@ -106,9 +104,14 @@ Rectangle {
}
ListElement
{
buttonImage
:
"
/qmlimages/MavlinkConsoleIcon
"
buttonText
:
qsTr
(
"
M
avl
ink Console
"
)
buttonText
:
qsTr
(
"
M
AVL
ink Console
"
)
pageSource
:
"
MavlinkConsolePage.qml
"
}
ListElement
{
buttonImage
:
"
/qmlimages/MavlinkConsoleIcon
"
buttonText
:
qsTr
(
"
MAVLink Inspector
"
)
pageSource
:
"
MAVLinkInspectorPage.qml
"
}
}
Component.onCompleted
:
itemAt
(
0
).
checked
=
true
...
...
src/AnalyzeView/LogDownloadController.h
View file @
af2a3970
...
...
@@ -40,7 +40,7 @@ public:
ObjectRole
=
Qt
::
UserRole
+
1
};
QGCLogModel
(
QObject
*
parent
=
0
);
QGCLogModel
(
QObject
*
parent
=
nullptr
);
Q_PROPERTY
(
int
count
READ
count
NOTIFY
countChanged
)
Q_INVOKABLE
QGCLogEntry
*
get
(
int
index
);
...
...
src/AnalyzeView/MAVLinkInspectorController.cc
View file @
af2a3970
This diff is collapsed.
Click to expand it.
src/AnalyzeView/MAVLinkInspectorController.h
View file @
af2a3970
...
...
@@ -15,7 +15,90 @@
#include <QObject>
#include <QString>
#include <QDebug>
#include <QAbstractListModel>
Q_DECLARE_LOGGING_CATEGORY
(
MAVLinkInspectorLog
)
//-----------------------------------------------------------------------------
class
QGCMAVLinkMessageField
:
public
QObject
{
Q_OBJECT
Q_PROPERTY
(
QString
name
READ
name
CONSTANT
)
Q_PROPERTY
(
QString
type
READ
type
CONSTANT
)
Q_PROPERTY
(
QString
value
READ
value
NOTIFY
valueChanged
)
public:
QGCMAVLinkMessageField
(
QObject
*
parent
,
QString
name
,
QString
type
);
QString
name
()
{
return
_name
;
}
QString
type
()
{
return
_type
;
}
QString
value
()
{
return
_value
;
}
void
updateValue
(
QString
newValue
)
{
_value
=
newValue
;
emit
valueChanged
();
}
signals:
void
valueChanged
();
private:
QString
_type
;
QString
_name
;
QString
_value
;
};
//-----------------------------------------------------------------------------
class
QGCMAVLinkMessage
:
public
QObject
{
Q_OBJECT
Q_PROPERTY
(
quint32
id
READ
id
CONSTANT
)
Q_PROPERTY
(
QString
name
READ
name
CONSTANT
)
Q_PROPERTY
(
quint64
messageHz
READ
messageHz
NOTIFY
messageChanged
)
Q_PROPERTY
(
quint64
count
READ
count
NOTIFY
messageChanged
)
Q_PROPERTY
(
QmlObjectListModel
*
fields
READ
fields
CONSTANT
)
public:
QGCMAVLinkMessage
(
QObject
*
parent
,
mavlink_message_t
*
message
);
quint32
id
()
{
return
_message
.
msgid
;
}
QString
name
()
{
return
_name
;
}
quint64
messageHz
()
{
return
_messageHz
;
}
quint64
count
()
{
return
_count
;
}
QmlObjectListModel
*
fields
()
{
return
&
_fields
;
}
void
update
(
mavlink_message_t
*
message
);
signals:
void
messageChanged
();
private:
QmlObjectListModel
_fields
;
QString
_name
;
uint64_t
_messageHz
=
0
;
uint64_t
_count
=
0
;
mavlink_message_t
_message
;
//-- List of QGCMAVLinkMessageField
};
//-----------------------------------------------------------------------------
class
QGCMAVLinkVehicle
:
public
QObject
{
Q_OBJECT
Q_PROPERTY
(
quint8
id
READ
id
CONSTANT
)
Q_PROPERTY
(
QmlObjectListModel
*
messages
READ
messages
NOTIFY
messagesChanged
)
public:
QGCMAVLinkVehicle
(
QObject
*
parent
,
quint8
id
);
quint8
id
()
{
return
_id
;
}
QmlObjectListModel
*
messages
()
{
return
&
_messages
;
}
QGCMAVLinkMessage
*
findMessage
(
uint32_t
id
);
void
append
(
QGCMAVLinkMessage
*
message
);
signals:
void
messagesChanged
();
private:
quint8
_id
;
QmlObjectListModel
_messages
;
//-- List of QGCMAVLinkMessage
};
//-----------------------------------------------------------------------------
class
MAVLinkInspectorController
:
public
QObject
{
Q_OBJECT
...
...
@@ -23,20 +106,29 @@ public:
MAVLinkInspectorController
();
~
MAVLinkInspectorController
();
Q_PROPERTY
(
QStringList
vehicleNames
READ
vehicleNames
NOTIFY
vehiclesChanged
)
Q_PROPERTY
(
QmlObjectListModel
*
vehicles
READ
vehicles
NOTIFY
vehiclesChanged
)
QmlObjectListModel
*
vehicles
()
{
return
&
_vehicles
;
}
QStringList
vehicleNames
()
{
return
_vehicleNames
;
}
signals:
void
vehiclesChanged
();
private
slots
:
void
_receiveMessage
(
LinkInterface
*
link
,
mavlink_message_t
message
);
void
_vehicleAdded
(
Vehicle
*
vehicle
);
void
_vehicleRemoved
(
Vehicle
*
vehicle
);
void
_receiveMessage
(
LinkInterface
*
link
,
mavlink_message_t
message
);
void
_vehicleAdded
(
Vehicle
*
vehicle
);
void
_vehicleRemoved
(
Vehicle
*
vehicle
);
private:
void
_reset
();
void
_reset
();
QGCMAVLinkVehicle
*
_findVehicle
(
uint8_t
id
);
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
QStringList
_vehicleNames
;
QmlObjectListModel
_vehicles
;
//-- List of QGCMAVLinkVehicle
};
src/AnalyzeView/MAVLinkInspectorPage.qml
0 → 100644
View file @
af2a3970
/****************************************************************************
*
* (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.
*
****************************************************************************/
import
QtQuick
2.11
import
QtQuick
.
Controls
2.4
import
QtQuick
.
Layouts
1.11
import
QtQuick
.
Dialogs
1.3
import
QGroundControl
1.0
import
QGroundControl
.
Palette
1.0
import
QGroundControl
.
Controls
1.0
import
QGroundControl
.
Controllers
1.0
import
QGroundControl
.
ScreenTools
1.0
Item
{
anchors.fill
:
parent
anchors.margins
:
ScreenTools
.
defaultFontPixelWidth
readonly
property
real
_butttonWidth
:
ScreenTools
.
defaultFontPixelWidth
*
30
property
int
curVehicleIndex
:
0
property
var
curVehicle
:
controller
.
vehicles
.
count
>
0
?
controller
.
vehicles
.
get
(
curVehicleIndex
)
:
null
property
int
curMessageIndex
:
0
property
var
curMessage
:
curVehicle
&&
curVehicle
.
messages
.
count
?
curVehicle
.
messages
.
get
(
curMessageIndex
)
:
null
MAVLinkInspectorController
{
id
:
controller
}
DeadMouseArea
{
anchors.fill
:
parent
}
//-- Header
ColumnLayout
{
id
:
header
width
:
parent
.
width
spacing
:
ScreenTools
.
defaultFontPixelHeight
QGCLabel
{
text
:
qsTr
(
"
Analyze real time MAVLink messages.
"
)
}
RowLayout
{
Layout.fillWidth
:
true
spacing
:
ScreenTools
.
defaultFontPixelWidth
QGCLabel
{
text
:
qsTr
(
"
Vehicle:
"
)
}
QGCComboBox
{
id
:
vehicleSelector
model
:
controller
.
vehicleNames
enabled
:
controller
.
vehicles
.
count
>
0
onActivated
:
curVehicleIndex
=
index
Layout.minimumWidth
:
ScreenTools
.
defaultFontPixelWidth
*
16
}
}
Item
{
height
:
ScreenTools
.
defaultFontPixelHeight
width
:
1
}
}
//-- Messages
QGCFlickable
{
id
:
buttonGrid
anchors.top
:
header
.
bottom
anchors.bottom
:
parent
.
bottom
anchors.left
:
parent
.
left
width
:
ScreenTools
.
defaultFontPixelWidth
*
32
contentWidth
:
buttonCol
.
width
contentHeight
:
buttonCol
.
height
ColumnLayout
{
id
:
buttonCol
spacing
:
ScreenTools
.
defaultFontPixelHeight
*
0.25
Repeater
{
model
:
curVehicle
?
curVehicle
.
messages
:
[]
delegate
:
QGCButton
{
text
:
object
.
name
onClicked
:
curMessageIndex
=
index
Layout.minimumWidth
:
_butttonWidth
}
}
}
}
//-- Message Data
QGCFlickable
{
id
:
messageGrid
anchors.top
:
header
.
bottom
anchors.bottom
:
parent
.
bottom
anchors.left
:
buttonGrid
.
right
anchors.leftMargin
:
ScreenTools
.
defaultFontPixelWidth
*
2
anchors.right
:
parent
.
right
contentWidth
:
messageCol
.
width
contentHeight
:
messageCol
.
height
Column
{
id
:
messageCol
spacing
:
ScreenTools
.
defaultFontPixelHeight
GridLayout
{
columns
:
2
columnSpacing
:
ScreenTools
.
defaultFontPixelWidth
rowSpacing
:
ScreenTools
.
defaultFontPixelHeight
*
0.25
QGCLabel
{
text
:
qsTr
(
"
Message:
"
)
Layout.minimumWidth
:
ScreenTools
.
defaultFontPixelWidth
*
20
}
QGCLabel
{
color
:
qgcPal
.
buttonHighlight
text
:
curMessage
?
curMessage
.
name
:
""
}
QGCLabel
{
text
:
qsTr
(
"
Count:
"
)
}
QGCLabel
{
text
:
curMessage
?
curMessage
.
count
:
""
}
QGCLabel
{
text
:
qsTr
(
"
Frequency:
"
)
}
QGCLabel
{
text
:
curMessage
?
curMessage
.
messageHz
+
'
Hz
'
:
""
}
}
GridLayout
{
columns
:
3
columnSpacing
:
ScreenTools
.
defaultFontPixelWidth
rowSpacing
:
ScreenTools
.
defaultFontPixelHeight
*
0.25
Repeater
{
model
:
curMessage
?
curMessage
.
fields
:
[]
delegate
:
QGCLabel
{
Layout.row
:
index
Layout.column
:
0
Layout.minimumWidth
:
ScreenTools
.
defaultFontPixelWidth
*
20
text
:
object
.
name
}
}
Repeater
{
model
:
curMessage
?
curMessage
.
fields
:
[]
delegate
:
QGCLabel
{
Layout.row
:
index
Layout.column
:
1
Layout.minimumWidth
:
ScreenTools
.
defaultFontPixelWidth
*
30
Layout.maximumWidth
:
ScreenTools
.
defaultFontPixelWidth
*
30
wrapMode
:
Text
.
WordWrap
text
:
object
.
value
}
}
Repeater
{
model
:
curMessage
?
curMessage
.
fields
:
[]
delegate
:
QGCLabel
{
Layout.row
:
index
Layout.column
:
2
text
:
object
.
type
}
}
}
}
}
}
src/QGCApplication.cc
View file @
af2a3970
...
...
@@ -77,6 +77,7 @@
#include "VideoSurface.h"
#include "VideoReceiver.h"
#include "LogDownloadController.h"
#include "MAVLinkInspectorController.h"
#include "ValuesWidgetController.h"
#include "AppMessages.h"
#include "SimulatedPosition.h"
...
...
@@ -452,6 +453,7 @@ void QGCApplication::_initCommon()
qmlRegisterType
<
RCChannelMonitorController
>
(
kQGCControllers
,
1
,
0
,
"RCChannelMonitorController"
);
qmlRegisterType
<
JoystickConfigController
>
(
kQGCControllers
,
1
,
0
,
"JoystickConfigController"
);
qmlRegisterType
<
LogDownloadController
>
(
kQGCControllers
,
1
,
0
,
"LogDownloadController"
);
qmlRegisterType
<
MAVLinkInspectorController
>
(
kQGCControllers
,
1
,
0
,
"MAVLinkInspectorController"
);
qmlRegisterType
<
SyslinkComponentController
>
(
kQGCControllers
,
1
,
0
,
"SyslinkComponentController"
);
qmlRegisterType
<
EditPositionDialogController
>
(
kQGCControllers
,
1
,
0
,
"EditPositionDialogController"
);
...
...
src/QmlControls/QGCFlickable.qml
View file @
af2a3970
...
...
@@ -10,8 +10,6 @@ Flickable {
property
color
indicatorColor
:
qgcPal
.
text
QGCPalette
{
id
:
qgcPal
;
colorGroupEnabled
:
enabled
}
Component.onCompleted
:
{
var
indicatorComponent
=
Qt
.
createComponent
(
"
QGCFlickableVerticalIndicator.qml
"
)
indicatorComponent
.
createObject
(
root
)
...
...
src/QmlControls/QmlObjectListModel.cc
View file @
af2a3970
...
...
@@ -119,7 +119,7 @@ bool QmlObjectListModel::removeRows(int position, int rows, const QModelIndex& p
QObject
*
QmlObjectListModel
::
operator
[](
int
index
)
{
if
(
index
<
0
||
index
>=
_objectList
.
count
())
{
return
NULL
;
return
nullptr
;
}
return
_objectList
[
index
];
}
...
...
@@ -127,7 +127,7 @@ QObject* QmlObjectListModel::operator[](int index)
const
QObject
*
QmlObjectListModel
::
operator
[](
int
index
)
const
{
if
(
index
<
0
||
index
>=
_objectList
.
count
())
{
return
NULL
;
return
nullptr
;
}
return
_objectList
[
index
];
}
...
...
src/QmlControls/QmlObjectListModel.h
View file @
af2a3970
...
...
@@ -18,8 +18,8 @@ class QmlObjectListModel : public QAbstractListModel
Q_OBJECT
public:
QmlObjectListModel
(
QObject
*
parent
=
NULL
);
~
QmlObjectListModel
();
QmlObjectListModel
(
QObject
*
parent
=
nullptr
);
~
QmlObjectListModel
()
override
;
Q_PROPERTY
(
int
count
READ
count
NOTIFY
countChanged
)
...
...
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