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
acc8b92c
Commit
acc8b92c
authored
Oct 25, 2015
by
Don Gagne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix home position handling
parent
d562a023
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
19 deletions
+29
-19
MissionController.cc
src/MissionManager/MissionController.cc
+27
-18
MissionController.h
src/MissionManager/MissionController.h
+2
-1
No files found.
src/MissionManager/MissionController.cc
View file @
acc8b92c
...
...
@@ -66,21 +66,23 @@ void MissionController::start(bool editMode)
connect
(
multiVehicleMgr
,
&
MultiVehicleManager
::
activeVehicleChanged
,
this
,
&
MissionController
::
_activeVehicleChanged
);
_setupMissionItems
(
true
/* fromVehicle */
,
true
/* force */
);
_setupMissionItems
(
true
/* loadFromVehicle */
,
true
/* forceLoad */
);
_setupActiveVehicle
(
multiVehicleMgr
->
activeVehicle
(),
true
/* forceLoadFromVehicle */
);
}
void
MissionController
::
_newMissionItemsAvailableFromVehicle
(
void
)
{
qCDebug
(
MissionControllerLog
)
<<
"_newMissionItemsAvailableFromVehicle"
;
_setupMissionItems
(
true
/*
fromVehicle */
,
false
/* force
*/
);
_setupMissionItems
(
true
/*
loadFromVehicle */
,
false
/* forceLoad
*/
);
}
/// @param
f
romVehicle true: load items from vehicle
/// @param force true: disregard any flags which may prevent load
void
MissionController
::
_setupMissionItems
(
bool
fromVehicle
,
bool
force
)
/// @param
loadF
romVehicle true: load items from vehicle
/// @param force
Load
true: disregard any flags which may prevent load
void
MissionController
::
_setupMissionItems
(
bool
loadFromVehicle
,
bool
forceLoad
)
{
qCDebug
(
MissionControllerLog
)
<<
"_setupMissionItems fromVehicle:force:_editMode:_firstItemsFromVehicle"
<<
fromVehicle
<<
force
<<
_editMode
<<
_firstItemsFromVehicle
;
qCDebug
(
MissionControllerLog
)
<<
"_setupMissionItems loadFromVehicle:forceLoad:_editMode:_firstItemsFromVehicle"
<<
loadFromVehicle
<<
forceLoad
<<
_editMode
<<
_firstItemsFromVehicle
;
MissionManager
*
missionManager
=
NULL
;
if
(
_activeVehicle
)
{
...
...
@@ -89,8 +91,8 @@ void MissionController::_setupMissionItems(bool fromVehicle, bool force)
qCDebug
(
MissionControllerLog
)
<<
"running offline"
;
}
if
(
!
force
)
{
if
(
_editMode
&&
f
romVehicle
)
{
if
(
!
force
Load
)
{
if
(
_editMode
&&
loadF
romVehicle
)
{
if
(
_firstItemsFromVehicle
)
{
if
(
missionManager
)
{
if
(
missionManager
->
inProgress
())
{
...
...
@@ -126,7 +128,7 @@ void MissionController::_setupMissionItems(bool fromVehicle, bool force)
_missionItems
->
deleteLater
();
}
if
(
!
missionManager
||
!
f
romVehicle
||
missionManager
->
inProgress
())
{
if
(
!
missionManager
||
!
loadF
romVehicle
||
missionManager
->
inProgress
())
{
_canEdit
=
true
;
_missionItems
=
new
QmlObjectListModel
(
this
);
qCDebug
(
MissionControllerLog
)
<<
"creating empty set"
;
...
...
@@ -440,10 +442,22 @@ void MissionController::_activeVehicleChanged(Vehicle* activeVehicle)
_activeVehicle
=
NULL
;
// When the active vehicle goes away we toss the editor items
_setupMissionItems
(
false
/*
fromVehicle */
,
true
/* force
*/
);
_setupMissionItems
(
false
/*
loadFromVehicle */
,
true
/* forceLoad
*/
);
_activeVehicleHomePositionAvailableChanged
(
false
);
}
_setupActiveVehicle
(
activeVehicle
,
false
/* forceLoadFromVehicle */
);
}
void
MissionController
::
_setupActiveVehicle
(
Vehicle
*
activeVehicle
,
bool
forceLoadFromVehicle
)
{
qCDebug
(
MissionControllerLog
)
<<
"_setupActiveVehicle activeVehicle:forceLoadFromVehicle"
<<
activeVehicle
<<
forceLoadFromVehicle
;
if
(
_activeVehicle
)
{
qCWarning
(
MissionControllerLog
)
<<
"_activeVehicle != NULL"
;
}
_activeVehicle
=
activeVehicle
;
if
(
_activeVehicle
)
{
...
...
@@ -455,7 +469,7 @@ void MissionController::_activeVehicleChanged(Vehicle* activeVehicle)
connect
(
_activeVehicle
,
&
Vehicle
::
homePositionChanged
,
this
,
&
MissionController
::
_activeVehicleHomePositionChanged
);
_firstItemsFromVehicle
=
true
;
_setupMissionItems
(
true
/* fromVehicle */
,
f
alse
/* force */
);
_setupMissionItems
(
true
/* fromVehicle */
,
f
orceLoadFromVehicle
);
_activeVehicleHomePositionChanged
(
_activeVehicle
->
homePosition
());
_activeVehicleHomePositionAvailableChanged
(
_activeVehicle
->
homePositionAvailable
());
...
...
@@ -464,20 +478,15 @@ void MissionController::_activeVehicleChanged(Vehicle* activeVehicle)
void
MissionController
::
_activeVehicleHomePositionAvailableChanged
(
bool
homePositionAvailable
)
{
MissionItem
*
homeItem
=
qobject_cast
<
MissionItem
*>
(
_missionItems
->
get
(
0
));
if
(
homePositionAvailable
)
{
homeItem
->
setCoordinate
(
_liveHomePosition
);
}
homeItem
->
setHomePositionValid
(
homePositionAvailable
);
_liveHomePositionAvailable
=
homePositionAvailable
;
qobject_cast
<
MissionItem
*>
(
_missionItems
->
get
(
0
))
->
setHomePositionValid
(
homePositionAvailable
);
emit
liveHomePositionAvailableChanged
(
_liveHomePositionAvailable
);
}
void
MissionController
::
_activeVehicleHomePositionChanged
(
const
QGeoCoordinate
&
homePosition
)
{
_liveHomePosition
=
homePosition
;
qobject_cast
<
MissionItem
*>
(
_missionItems
->
get
(
0
))
->
setCoordinate
(
_liveHomePosition
);
emit
liveHomePositionChanged
(
_liveHomePosition
);
}
...
...
src/MissionManager/MissionController.h
View file @
acc8b92c
...
...
@@ -94,7 +94,8 @@ private:
void
_initMissionItem
(
MissionItem
*
item
);
void
_deinitMissionItem
(
MissionItem
*
item
);
void
_autoSyncSend
(
void
);
void
_setupMissionItems
(
bool
fromVehicle
,
bool
force
);
void
_setupMissionItems
(
bool
loadFromVehicle
,
bool
forceLoad
);
void
_setupActiveVehicle
(
Vehicle
*
activeVehicle
,
bool
forceLoadFromVehicle
);
private:
bool
_editMode
;
...
...
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