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
4131c134
Commit
4131c134
authored
Jan 05, 2016
by
Don Gagne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Mission protocol robustness rework
parent
7f43851e
Changes
8
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
153 additions
and
263 deletions
+153
-263
MissionManager.cc
src/MissionManager/MissionManager.cc
+106
-159
MissionManager.h
src/MissionManager/MissionManager.h
+9
-9
MissionManagerTest.cc
src/MissionManager/MissionManagerTest.cc
+29
-64
MissionManagerTest.h
src/MissionManager/MissionManagerTest.h
+4
-4
MockLink.cc
src/comm/MockLink.cc
+2
-2
MockLink.h
src/comm/MockLink.h
+1
-2
MockLinkMissionItemHandler.cc
src/comm/MockLinkMissionItemHandler.cc
+1
-20
MockLinkMissionItemHandler.h
src/comm/MockLinkMissionItemHandler.h
+1
-3
No files found.
src/MissionManager/MissionManager.cc
View file @
4131c134
This diff is collapsed.
Click to expand it.
src/MissionManager/MissionManager.h
View file @
4131c134
...
@@ -52,7 +52,7 @@ public:
...
@@ -52,7 +52,7 @@ public:
// Property accessors
// Property accessors
bool
inProgress
(
void
)
{
return
_retryAck
!=
AckNone
;
}
bool
inProgress
(
void
)
;
QmlObjectListModel
*
missionItems
(
void
)
{
return
&
_missionItems
;
}
QmlObjectListModel
*
missionItems
(
void
)
{
return
&
_missionItems
;
}
// C++ methods
// C++ methods
...
@@ -76,6 +76,7 @@ public:
...
@@ -76,6 +76,7 @@ public:
ItemMismatchError
,
///< Vehicle returned item with seq # different than requested
ItemMismatchError
,
///< Vehicle returned item with seq # different than requested
VehicleError
,
///< Vehicle returned error
VehicleError
,
///< Vehicle returned error
MissingRequestsError
,
///< Vehicle did not request all items during write sequence
MissingRequestsError
,
///< Vehicle did not request all items during write sequence
MaxRetryExceeded
,
///< Retry failed
}
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
...
@@ -106,25 +107,24 @@ private:
...
@@ -106,25 +107,24 @@ private:
void
_handleMissionItem
(
const
mavlink_message_t
&
message
);
void
_handleMissionItem
(
const
mavlink_message_t
&
message
);
void
_handleMissionRequest
(
const
mavlink_message_t
&
message
);
void
_handleMissionRequest
(
const
mavlink_message_t
&
message
);
void
_handleMissionAck
(
const
mavlink_message_t
&
message
);
void
_handleMissionAck
(
const
mavlink_message_t
&
message
);
void
_requestNextMissionItem
(
int
sequenceNumber
);
void
_requestNextMissionItem
(
void
);
void
_clearMissionItems
(
void
);
void
_clearMissionItems
(
void
);
void
_sendError
(
ErrorCode_t
errorCode
,
const
QString
&
errorMsg
);
void
_sendError
(
ErrorCode_t
errorCode
,
const
QString
&
errorMsg
);
void
_retryWrite
(
void
);
void
_retryRead
(
void
);
bool
_retrySequence
(
AckType_t
ackType
);
QString
_ackTypeToString
(
AckType_t
ackType
);
QString
_ackTypeToString
(
AckType_t
ackType
);
QString
_missionResultToString
(
MAV_MISSION_RESULT
result
);
QString
_missionResultToString
(
MAV_MISSION_RESULT
result
);
void
_finishTransaction
(
bool
success
);
private:
private:
Vehicle
*
_vehicle
;
Vehicle
*
_vehicle
;
int
_cMissionItems
;
///< Mission items on vehicle
QTimer
*
_ackTimeoutTimer
;
QTimer
*
_ackTimeoutTimer
;
AckType_t
_retryAck
;
AckType_t
_retryAck
;
int
_retryCount
;
int
_re
questItemRe
tryCount
;
int
_expectedSequenceNumber
;
bool
_readTransactionInProgress
;
bool
_writeTransactionInProgress
;
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
QMutex
_dataMutex
;
QMutex
_dataMutex
;
...
...
src/MissionManager/MissionManagerTest.cc
View file @
4131c134
This diff is collapsed.
Click to expand it.
src/MissionManager/MissionManagerTest.h
View file @
4131c134
...
@@ -40,14 +40,14 @@ public:
...
@@ -40,14 +40,14 @@ public:
MissionManagerTest
(
void
);
MissionManagerTest
(
void
);
private
slots
:
private
slots
:
void
_testWriteFailureHandlingAPM
(
void
);
void
_testReadFailureHandlingAPM
(
void
);
void
_testWriteFailureHandlingPX4
(
void
);
void
_testWriteFailureHandlingPX4
(
void
);
void
_testWriteFailureHandlingAPM
(
void
);
void
_testReadFailureHandlingPX4
(
void
);
void
_testReadFailureHandlingPX4
(
void
);
void
_testReadFailureHandlingAPM
(
void
);
private:
private:
void
_roundTripItems
(
MockLinkMissionItemHandler
::
FailureMode_t
failureMode
,
MissionManager
::
ErrorCode_t
errorCode
,
bool
failFirstTimeOnly
);
void
_roundTripItems
(
MockLinkMissionItemHandler
::
FailureMode_t
failureMode
);
void
_writeItems
(
MockLinkMissionItemHandler
::
FailureMode_t
failureMode
,
MissionManager
::
ErrorCode_t
errorCode
,
bool
failFirstTimeOnly
);
void
_writeItems
(
MockLinkMissionItemHandler
::
FailureMode_t
failureMode
);
void
_testWriteFailureHandlingWorker
(
void
);
void
_testWriteFailureHandlingWorker
(
void
);
void
_testReadFailureHandlingWorker
(
void
);
void
_testReadFailureHandlingWorker
(
void
);
...
...
src/comm/MockLink.cc
View file @
4131c134
...
@@ -783,9 +783,9 @@ void MockLink::_handleCommandLong(const mavlink_message_t& msg)
...
@@ -783,9 +783,9 @@ void MockLink::_handleCommandLong(const mavlink_message_t& msg)
}
}
}
}
void
MockLink
::
setMissionItemFailureMode
(
MockLinkMissionItemHandler
::
FailureMode_t
failureMode
,
bool
firstTimeOnly
)
void
MockLink
::
setMissionItemFailureMode
(
MockLinkMissionItemHandler
::
FailureMode_t
failureMode
)
{
{
_missionItemHandler
.
setMissionItemFailureMode
(
failureMode
,
firstTimeOnly
);
_missionItemHandler
.
setMissionItemFailureMode
(
failureMode
);
}
}
void
MockLink
::
_sendHomePosition
(
void
)
void
MockLink
::
_sendHomePosition
(
void
)
...
...
src/comm/MockLink.h
View file @
4131c134
...
@@ -131,8 +131,7 @@ public:
...
@@ -131,8 +131,7 @@ public:
/// Sets a failure mode for unit testing
/// Sets a failure mode for unit testing
/// @param failureMode Type of failure to simulate
/// @param failureMode Type of failure to simulate
/// @param firstTimeOnly true: fail first call, success subsequent calls, false: fail all calls
void
setMissionItemFailureMode
(
MockLinkMissionItemHandler
::
FailureMode_t
failureMode
);
void
setMissionItemFailureMode
(
MockLinkMissionItemHandler
::
FailureMode_t
failureMode
,
bool
firstTimeOnly
);
/// Called to send a MISSION_ACK message while the MissionManager is in idle state
/// Called to send a MISSION_ACK message while the MissionManager is in idle state
void
sendUnexpectedMissionAck
(
MAV_MISSION_RESULT
ackType
)
{
_missionItemHandler
.
sendUnexpectedMissionAck
(
ackType
);
}
void
sendUnexpectedMissionAck
(
MAV_MISSION_RESULT
ackType
)
{
_missionItemHandler
.
sendUnexpectedMissionAck
(
ackType
);
}
...
...
src/comm/MockLinkMissionItemHandler.cc
View file @
4131c134
...
@@ -119,10 +119,6 @@ void MockLinkMissionItemHandler::_handleMissionRequestList(const mavlink_message
...
@@ -119,10 +119,6 @@ void MockLinkMissionItemHandler::_handleMissionRequestList(const mavlink_message
}
else
{
}
else
{
qCDebug
(
MockLinkMissionItemHandlerLog
)
<<
"_handleMissionRequestList not responding due to failure mode"
;
qCDebug
(
MockLinkMissionItemHandlerLog
)
<<
"_handleMissionRequestList not responding due to failure mode"
;
}
}
if
(
_failureFirstTimeOnly
)
{
_failureMode
=
FailNone
;
}
}
}
void
MockLinkMissionItemHandler
::
_handleMissionRequest
(
const
mavlink_message_t
&
msg
)
void
MockLinkMissionItemHandler
::
_handleMissionRequest
(
const
mavlink_message_t
&
msg
)
...
@@ -181,10 +177,6 @@ void MockLinkMissionItemHandler::_handleMissionRequest(const mavlink_message_t&
...
@@ -181,10 +177,6 @@ void MockLinkMissionItemHandler::_handleMissionRequest(const mavlink_message_t&
_mockLink
->
respondWithMavlinkMessage
(
responseMsg
);
_mockLink
->
respondWithMavlinkMessage
(
responseMsg
);
}
}
}
}
if
(
_failureFirstTimeOnly
)
{
_failureMode
=
FailNone
;
}
}
}
void
MockLinkMissionItemHandler
::
_handleMissionCount
(
const
mavlink_message_t
&
msg
)
void
MockLinkMissionItemHandler
::
_handleMissionCount
(
const
mavlink_message_t
&
msg
)
...
@@ -246,10 +238,6 @@ void MockLinkMissionItemHandler::_requestNextMissionItem(int sequenceNumber)
...
@@ -246,10 +238,6 @@ void MockLinkMissionItemHandler::_requestNextMissionItem(int sequenceNumber)
_startMissionItemResponseTimer
();
_startMissionItemResponseTimer
();
}
}
}
}
if
(
_failureFirstTimeOnly
)
{
_failureMode
=
FailNone
;
}
}
}
void
MockLinkMissionItemHandler
::
_sendAck
(
MAV_MISSION_RESULT
ackType
)
void
MockLinkMissionItemHandler
::
_sendAck
(
MAV_MISSION_RESULT
ackType
)
...
@@ -279,9 +267,6 @@ void MockLinkMissionItemHandler::_handleMissionItem(const mavlink_message_t& msg
...
@@ -279,9 +267,6 @@ void MockLinkMissionItemHandler::_handleMissionItem(const mavlink_message_t& msg
Q_ASSERT
(
missionItem
.
target_system
==
_mockLink
->
vehicleId
());
Q_ASSERT
(
missionItem
.
target_system
==
_mockLink
->
vehicleId
());
Q_ASSERT
(
!
_missionItems
.
contains
(
missionItem
.
seq
));
Q_ASSERT
(
missionItem
.
seq
==
_writeSequenceIndex
);
_missionItems
[
missionItem
.
seq
]
=
missionItem
;
_missionItems
[
missionItem
.
seq
]
=
missionItem
;
_writeSequenceIndex
++
;
_writeSequenceIndex
++
;
...
@@ -302,9 +287,6 @@ void MockLinkMissionItemHandler::_handleMissionItem(const mavlink_message_t& msg
...
@@ -302,9 +287,6 @@ void MockLinkMissionItemHandler::_handleMissionItem(const mavlink_message_t& msg
_sendAck
(
ack
);
_sendAck
(
ack
);
}
}
}
}
if
(
_failureFirstTimeOnly
)
{
_failureMode
=
FailNone
;
}
}
}
void
MockLinkMissionItemHandler
::
_missionItemResponseTimeout
(
void
)
void
MockLinkMissionItemHandler
::
_missionItemResponseTimeout
(
void
)
...
@@ -330,9 +312,8 @@ void MockLinkMissionItemHandler::sendUnexpectedMissionRequest(void)
...
@@ -330,9 +312,8 @@ void MockLinkMissionItemHandler::sendUnexpectedMissionRequest(void)
Q_ASSERT
(
false
);
Q_ASSERT
(
false
);
}
}
void
MockLinkMissionItemHandler
::
setMissionItemFailureMode
(
FailureMode_t
failureMode
,
bool
firstTimeOnly
)
void
MockLinkMissionItemHandler
::
setMissionItemFailureMode
(
FailureMode_t
failureMode
)
{
{
_failureFirstTimeOnly
=
firstTimeOnly
;
_failureMode
=
failureMode
;
_failureMode
=
failureMode
;
}
}
...
...
src/comm/MockLinkMissionItemHandler.h
View file @
4131c134
...
@@ -74,8 +74,7 @@ public:
...
@@ -74,8 +74,7 @@ public:
/// Sets a failure mode for unit testing
/// Sets a failure mode for unit testing
/// @param failureMode Type of failure to simulate
/// @param failureMode Type of failure to simulate
/// @param firstTimeOnly true: fail first call, success subsequent calls, false: fail all calls
void
setMissionItemFailureMode
(
FailureMode_t
failureMode
);
void
setMissionItemFailureMode
(
FailureMode_t
failureMode
,
bool
firstTimeOnly
);
/// Called to send a MISSION_ACK message while the MissionManager is in idle state
/// Called to send a MISSION_ACK message while the MissionManager is in idle state
void
sendUnexpectedMissionAck
(
MAV_MISSION_RESULT
ackType
);
void
sendUnexpectedMissionAck
(
MAV_MISSION_RESULT
ackType
);
...
@@ -114,7 +113,6 @@ private:
...
@@ -114,7 +113,6 @@ private:
QTimer
*
_missionItemResponseTimer
;
QTimer
*
_missionItemResponseTimer
;
FailureMode_t
_failureMode
;
FailureMode_t
_failureMode
;
bool
_failureFirstTimeOnly
;
bool
_sendHomePositionOnEmptyList
;
bool
_sendHomePositionOnEmptyList
;
MAVLinkProtocol
*
_mavlinkProtocol
;
MAVLinkProtocol
*
_mavlinkProtocol
;
};
};
...
...
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