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
7199e9c4
Commit
7199e9c4
authored
Sep 25, 2015
by
Don Gagne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Take MissionManager off separate thread
parent
182726e2
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
40 additions
and
58 deletions
+40
-58
MissionEditor.qml
src/MissionEditor/MissionEditor.qml
+14
-0
MissionManager.cc
src/MissionManager/MissionManager.cc
+25
-48
MissionManager.h
src/MissionManager/MissionManager.h
+1
-10
No files found.
src/MissionEditor/MissionEditor.qml
View file @
7199e9c4
...
...
@@ -167,6 +167,20 @@ QGCView {
onTriggered
:
controller
.
saveMissionToFile
()
}
MenuSeparator
{
}
MenuItem
{
text
:
"
Move to current vehicle position
"
enabled
:
activeVehicle
&&
activeVehicle
.
latitude
!=
0
&&
activeVehicle
.
longitude
!=
0
property
var
activeVehicle
:
multiVehicleManager
.
activeVehicle
onTriggered
:
{
editorMap
.
latitude
=
activeVehicle
.
latitude
editorMap
.
longitude
=
activeVehicle
.
longitude
}
}
}
}
...
...
src/MissionManager/MissionManager.cc
View file @
7199e9c4
...
...
@@ -31,44 +31,26 @@
QGC_LOGGING_CATEGORY
(
MissionManagerLog
,
"MissionManagerLog"
)
MissionManager
::
MissionManager
(
Vehicle
*
vehicle
)
:
QThread
()
,
_vehicle
(
vehicle
)
:
_vehicle
(
vehicle
)
,
_cMissionItems
(
0
)
,
_canEdit
(
true
)
,
_ackTimeoutTimer
(
NULL
)
,
_retryAck
(
AckNone
)
{
moveToThread
(
this
);
connect
(
_vehicle
,
&
Vehicle
::
mavlinkMessageReceived
,
this
,
&
MissionManager
::
_mavlinkMessageReceived
);
connect
(
this
,
&
MissionManager
::
_writeMissionItemsOnThread
,
this
,
&
MissionManager
::
_writeMissionItems
);
connect
(
this
,
&
MissionManager
::
_requestMissionItemsOnThread
,
this
,
&
MissionManager
::
_requestMissionItems
);
start
();
}
MissionManager
::~
MissionManager
()
{
}
void
MissionManager
::
run
(
void
)
{
_ackTimeoutTimer
=
new
QTimer
(
this
);
_ackTimeoutTimer
->
setSingleShot
(
true
);
_ackTimeoutTimer
->
setInterval
(
_ackTimeoutMilliseconds
);
connect
(
_ackTimeoutTimer
,
&
QTimer
::
timeout
,
this
,
&
MissionManager
::
_ackTimeout
);
_requestMissionItems
();
exec
();
requestMissionItems
();
}
void
MissionManager
::
requestMissionItems
(
void
)
MissionManager
::~
MissionManager
(
)
{
emit
_requestMissionItemsOnThread
();
}
void
MissionManager
::
writeMissionItems
(
const
QmlObjectListModel
&
missionItems
)
...
...
@@ -78,10 +60,28 @@ void MissionManager::writeMissionItems(const QmlObjectListModel& missionItems)
_missionItems
.
append
(
new
MissionItem
(
*
qobject_cast
<
const
MissionItem
*>
(
missionItems
[
i
])));
}
emit
_writeMissionItemsOnThread
();
qCDebug
(
MissionManagerLog
)
<<
"writeMissionItems count:"
<<
_missionItems
.
count
();
if
(
inProgress
())
{
qCDebug
(
MissionManagerLog
)
<<
"writeMissionItems called while transaction in progress"
;
// FIXME: Better error handling
return
;
}
mavlink_message_t
message
;
mavlink_mission_count_t
missionCount
;
missionCount
.
target_system
=
_vehicle
->
id
();
missionCount
.
target_component
=
MAV_COMP_ID_MISSIONPLANNER
;
missionCount
.
count
=
_missionItems
.
count
();
mavlink_msg_mission_count_encode
(
MAVLinkProtocol
::
instance
()
->
getSystemId
(),
MAVLinkProtocol
::
instance
()
->
getComponentId
(),
&
message
,
&
missionCount
);
_vehicle
->
sendMessage
(
message
);
_startAckTimeout
(
AckMissionRequest
,
message
);
}
void
MissionManager
::
_
requestMissionItems
(
void
)
void
MissionManager
::
requestMissionItems
(
void
)
{
qCDebug
(
MissionManagerLog
)
<<
"_requestMissionItems"
;
...
...
@@ -173,7 +173,7 @@ void MissionManager::_handleMissionCount(const mavlink_message_t& message)
qCDebug
(
MissionManagerLog
)
<<
"_handleMissionCount count:"
<<
_cMissionItems
;
if
(
_cMissionItems
==
0
)
{
_sendTransactionComplet
e
();
emit
newMissionItemsAvailabl
e
();
}
else
{
_requestNextMissionItem
(
0
);
}
...
...
@@ -251,29 +251,6 @@ void MissionManager::_clearMissionItems(void)
_missionItems
.
clear
();
}
void
MissionManager
::
_writeMissionItems
(
void
)
{
qCDebug
(
MissionManagerLog
)
<<
"writeMissionItems count:"
<<
_missionItems
.
count
();
if
(
inProgress
())
{
qCDebug
(
MissionManagerLog
)
<<
"writeMissionItems called while transaction in progress"
;
// FIXME: Better error handling
return
;
}
mavlink_message_t
message
;
mavlink_mission_count_t
missionCount
;
missionCount
.
target_system
=
_vehicle
->
id
();
missionCount
.
target_component
=
MAV_COMP_ID_MISSIONPLANNER
;
missionCount
.
count
=
_missionItems
.
count
();
mavlink_msg_mission_count_encode
(
MAVLinkProtocol
::
instance
()
->
getSystemId
(),
MAVLinkProtocol
::
instance
()
->
getComponentId
(),
&
message
,
&
missionCount
);
_vehicle
->
sendMessage
(
message
);
_startAckTimeout
(
AckMissionRequest
,
message
);
}
void
MissionManager
::
_handleMissionRequest
(
const
mavlink_message_t
&
message
)
{
mavlink_mission_request_t
missionRequest
;
...
...
src/MissionManager/MissionManager.h
View file @
7199e9c4
...
...
@@ -38,7 +38,7 @@ class Vehicle;
Q_DECLARE_LOGGING_CATEGORY
(
MissionManagerLog
)
class
MissionManager
:
public
Q
Thread
class
MissionManager
:
public
Q
Object
{
Q_OBJECT
...
...
@@ -73,10 +73,6 @@ signals:
void
canEditChanged
(
bool
canEdit
);
void
newMissionItemsAvailable
(
void
);
// Internal signals
void
_requestMissionItemsOnThread
(
void
);
void
_writeMissionItemsOnThread
(
void
);
private
slots
:
void
_mavlinkMessageReceived
(
const
mavlink_message_t
&
message
);
void
_ackTimeout
(
void
);
...
...
@@ -98,11 +94,6 @@ private:
void
_handleMissionAck
(
const
mavlink_message_t
&
message
);
void
_requestNextMissionItem
(
int
sequenceNumber
);
void
_clearMissionItems
(
void
);
void
_requestMissionItems
(
void
);
void
_writeMissionItems
(
void
);
// Overrides from QThread
void
run
(
void
);
private:
Vehicle
*
_vehicle
;
...
...
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