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
21840a53
Commit
21840a53
authored
9 years ago
by
Franz
Committed by
oberion
9 years ago
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
UASWaypointManager: AutoUpdate new Waypoints when updated from other mavlink instances.
parent
c9a4636c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
3 deletions
+31
-3
UASWaypointManager.cc
src/uas/UASWaypointManager.cc
+29
-3
UASWaypointManager.h
src/uas/UASWaypointManager.h
+2
-0
No files found.
src/uas/UASWaypointManager.cc
View file @
21840a53
...
...
@@ -48,7 +48,8 @@ UASWaypointManager::UASWaypointManager(UAS* _uas)
current_partner_systemid
(
0
),
current_partner_compid
(
0
),
currentWaypointEditable
(),
protocol_timer
(
this
)
protocol_timer
(
this
),
_updateWPlist_timer
(
this
)
{
_offlineEditingModeMessage
=
tr
(
"You are in offline editing mode. Make sure to save your mission to a file before connecting to a system - you will need to load the file into the system, the offline list will be cleared on connect."
);
...
...
@@ -67,6 +68,9 @@ UASWaypointManager::UASWaypointManager(UAS* _uas)
// We signal to ourselves here so that tiemrs are started and stopped on correct thread
connect
(
this
,
SIGNAL
(
_startProtocolTimer
(
void
)),
this
,
SLOT
(
_startProtocolTimerOnThisThread
(
void
)));
connect
(
this
,
SIGNAL
(
_stopProtocolTimer
(
void
)),
this
,
SLOT
(
_stopProtocolTimerOnThisThread
(
void
)));
_updateWPlist_timer
.
setInterval
(
1500
);
_updateWPlist_timer
.
setSingleShot
(
true
);
connect
(
&
_updateWPlist_timer
,
SIGNAL
(
timeout
()),
this
,
SLOT
(
_updateWPonTimer
()));
}
UASWaypointManager
::~
UASWaypointManager
()
...
...
@@ -167,8 +171,20 @@ void UASWaypointManager::handleWaypointCount(quint8 systemId, quint8 compId, qui
}
else
{
qDebug
(
"Rejecting waypoint count message, check mismatch: current_state: %d == %d, system id %d == %d, comp id %d == %d"
,
current_state
,
WP_GETLIST
,
current_partner_systemid
,
systemId
,
current_partner_compid
,
compId
);
}
if
(
current_state
!=
WP_GETLIST_GETWPS
&&
systemId
==
current_partner_systemid
)
{
qDebug
(
"Requesting new waypoints. Propably changed onboard."
);
if
(
!
_updateWPlist_timer
.
isActive
())
{
current_state
=
WP_IDLE
;
_updateWPlist_timer
.
start
();
}
}
else
{
qDebug
(
"Rejecting waypoint count message, check mismatch: current_state: %d == %d, system id %d == %d, comp id %d == %d"
,
current_state
,
WP_GETLIST
,
current_partner_systemid
,
systemId
,
current_partner_compid
,
compId
);
}
}
}
void
UASWaypointManager
::
handleWaypoint
(
quint8
systemId
,
quint8
compId
,
mavlink_mission_item_t
*
wp
)
...
...
@@ -1197,3 +1213,13 @@ void UASWaypointManager::_stopProtocolTimerOnThisThread(void)
{
protocol_timer
.
stop
();
}
void
UASWaypointManager
::
_updateWPonTimer
()
{
while
(
current_state
!=
WP_IDLE
)
{
Sleep
(
100
);
}
readWaypoints
(
true
);
}
This diff is collapsed.
Click to expand it.
src/uas/UASWaypointManager.h
View file @
21840a53
...
...
@@ -168,6 +168,7 @@ signals:
private
slots
:
void
_startProtocolTimerOnThisThread
(
void
);
///< Starts the protocol timer
void
_stopProtocolTimerOnThisThread
(
void
);
///< Starts the protocol timer
void
_updateWPonTimer
(
void
);
private:
UAS
*
uas
;
///< Reference to the corresponding UAS
...
...
@@ -184,6 +185,7 @@ private:
QPointer
<
Waypoint
>
currentWaypointEditable
;
///< The currently used waypoint
QList
<
mavlink_mission_item_t
*>
waypoint_buffer
;
///< buffer for waypoints during communication
QTimer
protocol_timer
;
///< Timer to catch timeouts
QTimer
_updateWPlist_timer
;
/// update WP list if modified by another instance onboard
bool
standalone
;
///< If standalone is set, do not write to UAS
int
uasid
;
///< The ID of the current UAS. Retrieved via `uas->getUASID();`, stored as an `int` to match its return type.
...
...
This diff is collapsed.
Click to expand it.
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