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
52816235
Unverified
Commit
52816235
authored
Feb 02, 2018
by
Don Gagne
Committed by
GitHub
Feb 02, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #6059 from mavlink/fix-mission-upload-download
Robustify mission upload/download
parents
c8637237
8dee2570
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
12 deletions
+35
-12
PlanManager.cc
src/MissionManager/PlanManager.cc
+22
-3
PlanManager.h
src/MissionManager/PlanManager.h
+13
-9
No files found.
src/MissionManager/PlanManager.cc
View file @
52816235
...
@@ -30,12 +30,12 @@ PlanManager::PlanManager(Vehicle* vehicle, MAV_MISSION_TYPE planType)
...
@@ -30,12 +30,12 @@ PlanManager::PlanManager(Vehicle* vehicle, MAV_MISSION_TYPE planType)
,
_transactionInProgress
(
TransactionNone
)
,
_transactionInProgress
(
TransactionNone
)
,
_resumeMission
(
false
)
,
_resumeMission
(
false
)
,
_lastMissionRequest
(
-
1
)
,
_lastMissionRequest
(
-
1
)
,
_missionItemCountToRead
(
-
1
)
,
_currentMissionIndex
(
-
1
)
,
_currentMissionIndex
(
-
1
)
,
_lastCurrentIndex
(
-
1
)
,
_lastCurrentIndex
(
-
1
)
{
{
_ackTimeoutTimer
=
new
QTimer
(
this
);
_ackTimeoutTimer
=
new
QTimer
(
this
);
_ackTimeoutTimer
->
setSingleShot
(
true
);
_ackTimeoutTimer
->
setSingleShot
(
true
);
_ackTimeoutTimer
->
setInterval
(
_ackTimeoutMilliseconds
);
connect
(
_ackTimeoutTimer
,
&
QTimer
::
timeout
,
this
,
&
PlanManager
::
_ackTimeout
);
connect
(
_ackTimeoutTimer
,
&
QTimer
::
timeout
,
this
,
&
PlanManager
::
_ackTimeout
);
}
}
...
@@ -244,6 +244,24 @@ void PlanManager::_ackTimeout(void)
...
@@ -244,6 +244,24 @@ void PlanManager::_ackTimeout(void)
void
PlanManager
::
_startAckTimeout
(
AckType_t
ack
)
void
PlanManager
::
_startAckTimeout
(
AckType_t
ack
)
{
{
switch
(
ack
)
{
case
AckMissionItem
:
// We are actively trying to get the mission item, so we don't want to wait as long.
_ackTimeoutTimer
->
setInterval
(
_retryTimeoutMilliseconds
);
break
;
case
AckNone
:
// FALLTHROUGH
case
AckMissionCount
:
// FALLTHROUGH
case
AckMissionRequest
:
// FALLTHROUGH
case
AckMissionClearAll
:
// FALLTHROUGH
case
AckGuidedItem
:
_ackTimeoutTimer
->
setInterval
(
_ackTimeoutMilliseconds
);
break
;
}
_expectedAck
=
ack
;
_expectedAck
=
ack
;
_ackTimeoutTimer
->
start
();
_ackTimeoutTimer
->
start
();
}
}
...
@@ -317,6 +335,7 @@ void PlanManager::_handleMissionCount(const mavlink_message_t& message)
...
@@ -317,6 +335,7 @@ void PlanManager::_handleMissionCount(const mavlink_message_t& message)
for
(
int
i
=
0
;
i
<
missionCount
.
count
;
i
++
)
{
for
(
int
i
=
0
;
i
<
missionCount
.
count
;
i
++
)
{
_itemIndicesToRead
<<
i
;
_itemIndicesToRead
<<
i
;
}
}
_missionItemCountToRead
=
missionCount
.
count
;
_requestNextMissionItem
();
_requestNextMissionItem
();
}
}
}
}
...
@@ -460,7 +479,7 @@ void PlanManager::_handleMissionItem(const mavlink_message_t& message, bool miss
...
@@ -460,7 +479,7 @@ void PlanManager::_handleMissionItem(const mavlink_message_t& message, bool miss
return
;
return
;
}
}
emit
progressPct
((
double
)
seq
/
(
double
)
_missionItem
s
.
count
()
);
emit
progressPct
((
double
)
seq
/
(
double
)
_missionItem
CountToRead
);
_retryCount
=
0
;
_retryCount
=
0
;
if
(
_itemIndicesToRead
.
count
()
==
0
)
{
if
(
_itemIndicesToRead
.
count
()
==
0
)
{
...
...
src/MissionManager/PlanManager.h
View file @
52816235
...
@@ -70,7 +70,10 @@ public:
...
@@ -70,7 +70,10 @@ public:
}
ErrorCode_t
;
}
ErrorCode_t
;
// These values are public so the unit test can set appropriate signal wait times
// These values are public so the unit test can set appropriate signal wait times
// When passively waiting for a mission process, use a longer timeout.
static
const
int
_ackTimeoutMilliseconds
=
1000
;
static
const
int
_ackTimeoutMilliseconds
=
1000
;
// When actively retrying to request mission items, use a shorter timeout instead.
static
const
int
_retryTimeoutMilliseconds
=
250
;
static
const
int
_maxRetryCount
=
5
;
static
const
int
_maxRetryCount
=
5
;
signals:
signals:
...
@@ -144,6 +147,7 @@ protected:
...
@@ -144,6 +147,7 @@ protected:
QList
<
int
>
_itemIndicesToWrite
;
///< List of mission items which still need to be written to vehicle
QList
<
int
>
_itemIndicesToWrite
;
///< List of mission items which still need to be written to vehicle
QList
<
int
>
_itemIndicesToRead
;
///< List of mission items which still need to be requested from vehicle
QList
<
int
>
_itemIndicesToRead
;
///< List of mission items which still need to be requested from vehicle
int
_lastMissionRequest
;
///< Index of item last requested by MISSION_REQUEST
int
_lastMissionRequest
;
///< Index of item last requested by MISSION_REQUEST
int
_missionItemCountToRead
;
///< Count of all mission items to read
QList
<
MissionItem
*>
_missionItems
;
///< Set of mission items on vehicle
QList
<
MissionItem
*>
_missionItems
;
///< Set of mission items on vehicle
QList
<
MissionItem
*>
_writeMissionItems
;
///< Set of mission items currently being written to vehicle
QList
<
MissionItem
*>
_writeMissionItems
;
///< Set of mission items currently being written to 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