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
59b882bf
Commit
59b882bf
authored
Dec 06, 2018
by
Don Gagne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
parent
0640d456
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
46 deletions
+33
-46
QGCMAVLinkInspector.cc
src/ui/QGCMAVLinkInspector.cc
+29
-39
QGCMAVLinkInspector.h
src/ui/QGCMAVLinkInspector.h
+4
-7
No files found.
src/ui/QGCMAVLinkInspector.cc
View file @
59b882bf
...
...
@@ -40,8 +40,9 @@ QGCMAVLinkInspector::QGCMAVLinkInspector(const QString& title, QAction* action,
connect
(
ui
->
clearButton
,
&
QPushButton
::
clicked
,
this
,
&
QGCMAVLinkInspector
::
clearView
);
// Connect external connections
connect
(
qgcApp
()
->
toolbox
()
->
multiVehicleManager
(),
&
MultiVehicleManager
::
vehicleAdded
,
this
,
&
QGCMAVLinkInspector
::
_vehicleAdded
);
MultiVehicleManager
*
multiVehicleManager
=
qgcApp
()
->
toolbox
()
->
multiVehicleManager
();
connect
(
multiVehicleManager
,
&
MultiVehicleManager
::
vehicleAdded
,
this
,
&
QGCMAVLinkInspector
::
_vehicleAdded
);
connect
(
multiVehicleManager
,
&
MultiVehicleManager
::
vehicleRemoved
,
this
,
&
QGCMAVLinkInspector
::
_vehicleRemoved
);
connect
(
protocol
,
&
MAVLinkProtocol
::
messageReceived
,
this
,
&
QGCMAVLinkInspector
::
receiveMessage
);
// Attach the UI's refresh rate to a timer.
...
...
@@ -56,7 +57,12 @@ void QGCMAVLinkInspector::_vehicleAdded(Vehicle* vehicle)
ui
->
systemComboBox
->
addItem
(
tr
(
"Vehicle %1"
).
arg
(
vehicle
->
id
()),
vehicle
->
id
());
// Add a tree for a new UAS
addUAStoTree
(
vehicle
->
id
());
addVehicleToTree
(
vehicle
->
id
());
}
void
QGCMAVLinkInspector
::
_vehicleRemoved
(
Vehicle
*
vehicle
)
{
removeVehicleFromTree
(
vehicle
->
id
());
}
void
QGCMAVLinkInspector
::
selectDropDownMenuSystem
(
int
dropdownid
)
...
...
@@ -165,8 +171,6 @@ void QGCMAVLinkInspector::clearView()
}
uasLastMessageUpdate
.
clear
();
onboardMessageInterval
.
clear
();
ui
->
treeWidget
->
clear
();
}
...
...
@@ -230,7 +234,7 @@ void QGCMAVLinkInspector::refreshView()
QString
messageName
(
"%1 (%2 Hz, #%3)"
);
messageName
=
messageName
.
arg
(
msgInfo
->
name
).
arg
(
msgHz
,
3
,
'f'
,
1
).
arg
(
msg
->
msgid
);
add
UASt
oTree
(
msg
->
sysid
);
add
VehicleT
oTree
(
msg
->
sysid
);
// Look for the tree for the UAS sysid
QMap
<
int
,
QTreeWidgetItem
*>*
msgTreeItems
=
uasMsgTreeItems
.
value
(
msg
->
sysid
);
...
...
@@ -271,26 +275,28 @@ void QGCMAVLinkInspector::refreshView()
}
}
void
QGCMAVLinkInspector
::
add
UAStoTree
(
int
sys
Id
)
void
QGCMAVLinkInspector
::
add
VehicleToTree
(
int
vehicle
Id
)
{
if
(
!
uasTreeWidgetItems
.
contains
(
sysId
))
{
// Add the UAS to the main tree after it has been created
Vehicle
*
vehicle
=
qgcApp
()
->
toolbox
()
->
multiVehicleManager
()
->
getVehicleById
(
sysId
);
if
(
vehicle
)
{
UASInterface
*
uas
=
vehicle
->
uas
();
if
(
!
uasTreeWidgetItems
.
contains
(
vehicleId
))
{
QStringList
idstring
;
idstring
<<
QString
(
"Vehicle %1"
).
arg
(
uas
->
getUASID
()
);
idstring
<<
tr
(
"Vehicle %1"
).
arg
(
vehicleId
);
QTreeWidgetItem
*
uasWidget
=
new
QTreeWidgetItem
(
idstring
);
uasWidget
->
setFirstColumnSpanned
(
true
);
uasTreeWidgetItems
.
insert
(
sysId
,
uasWidget
);
uasTreeWidgetItems
.
insert
(
vehicleId
,
uasWidget
);
ui
->
treeWidget
->
addTopLevelItem
(
uasWidget
);
uasMsgTreeItems
.
insert
(
sysId
,
new
QMap
<
int
,
QTreeWidgetItem
*>
());
}
uasMsgTreeItems
.
insert
(
vehicleId
,
new
QMap
<
int
,
QTreeWidgetItem
*>
());
}
}
void
QGCMAVLinkInspector
::
removeVehicleFromTree
(
int
vehicleId
)
{
Q_UNUSED
(
vehicleId
);
// This doesn't work with multi-vehicle. But this code is so screwed up and crufty it's not worth the effort making that work.
// Especially since mult-vehicle support here has been broken for ages. Better to at least get single vehicle working.
clearView
();
}
void
QGCMAVLinkInspector
::
receiveMessage
(
LinkInterface
*
link
,
mavlink_message_t
message
)
{
Q_UNUSED
(
link
);
...
...
@@ -396,22 +402,6 @@ void QGCMAVLinkInspector::receiveMessage(LinkInterface* link,mavlink_message_t m
lastMsgUpdate
->
insert
(
message
.
msgid
,
receiveTime
);
}
if
(
selectedSystemID
==
0
||
selectedComponentID
==
0
)
{
return
;
}
switch
(
message
.
msgid
)
{
case
MAVLINK_MSG_ID_DATA_STREAM
:
{
mavlink_data_stream_t
stream
;
mavlink_msg_data_stream_decode
(
&
message
,
&
stream
);
onboardMessageInterval
.
insert
(
stream
.
stream_id
,
stream
.
message_rate
);
}
break
;
}
}
QGCMAVLinkInspector
::~
QGCMAVLinkInspector
()
...
...
src/ui/QGCMAVLinkInspector.h
View file @
59b882bf
...
...
@@ -39,9 +39,7 @@ protected:
MAVLinkProtocol
*
_protocol
;
///< MAVLink instance
int
selectedSystemID
;
///< Currently selected system
int
selectedComponentID
;
///< Currently selected component
QMap
<
int
,
int
>
systems
;
///< Already observed systems
QMap
<
int
,
int
>
components
;
///< Already observed components
QMap
<
int
,
float
>
onboardMessageInterval
;
///< Stores the onboard selected data rate
QTimer
updateTimer
;
///< Only update at 1 Hz to not overload the GUI
QMap
<
int
,
QTreeWidgetItem
*
>
uasTreeWidgetItems
;
///< Tree of available uas with their widget
...
...
@@ -54,18 +52,17 @@ protected:
QMap
<
int
,
QMap
<
int
,
quint64
>*
>
uasLastMessageUpdate
;
///< Stores the time of the last message for each message of each UAS
/* @brief Update one message field */
void
updateField
(
mavlink_message_t
*
msg
,
const
mavlink_message_info_t
*
msgInfo
,
int
fieldid
,
QTreeWidgetItem
*
item
);
/** @brief Rebuild the list of components */
void
rebuildComponentList
();
/* @brief Create a new tree for a new UAS */
void
addUAStoTree
(
int
sys
Id
);
void
addVehicleToTree
(
int
vehicleId
);
void
removeVehicleFromTree
(
int
vehicle
Id
);
static
const
unsigned
int
updateInterval
;
///< The update interval of the refresh function
static
const
float
updateHzLowpass
;
///< The low-pass filter value for the frequency of each message
private
slots
:
void
_vehicleAdded
(
Vehicle
*
vehicle
);
void
_vehicleAdded
(
Vehicle
*
vehicle
);
void
_vehicleRemoved
(
Vehicle
*
vehicle
);
private:
Ui
::
QGCMAVLinkInspector
*
ui
;
...
...
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