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
dfaafee2
Commit
dfaafee2
authored
Jun 23, 2016
by
Don Gagne
Committed by
GitHub
Jun 23, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3606 from DonLakeFlyer/MissionLoad
Plan: Mission loads from vehicle automatically
parents
d23621eb
90cfe9db
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
30 additions
and
16 deletions
+30
-16
MissionEditor.qml
src/MissionEditor/MissionEditor.qml
+5
-6
MissionController.cc
src/MissionManager/MissionController.cc
+9
-4
MissionControllerTest.cc
src/MissionManager/MissionControllerTest.cc
+6
-1
MissionManager.cc
src/MissionManager/MissionManager.cc
+10
-5
No files found.
src/MissionEditor/MissionEditor.qml
View file @
dfaafee2
...
...
@@ -28,8 +28,6 @@ import QGroundControl.Controllers 1.0
QGCView
{
id
:
_root
property
bool
syncNeeded
:
controller
.
visualItems
.
dirty
// Unsaved changes, visible to parent container
viewPanel
:
panel
// zOrder comes from the Loader in MainWindow.qml
...
...
@@ -46,6 +44,7 @@ QGCView {
readonly
property
int
_addMissionItemsButtonAutoOffTimeout
:
10000
readonly
property
var
_defaultVehicleCoordinate
:
QtPositioning
.
coordinate
(
37.803784
,
-
122.462276
)
property
bool
_syncNeeded
:
controller
.
visualItems
.
dirty
// Unsaved changes, visible to parent container
property
var
_visualItems
:
controller
.
visualItems
property
var
_currentMissionItem
property
int
_currentMissionIndex
:
0
...
...
@@ -561,7 +560,7 @@ QGCView {
DropButton
{
id
:
syncButton
dropDirection
:
dropRight
buttonImage
:
syncNeeded
?
"
/qmlimages/MapSyncChanged.svg
"
:
"
/qmlimages/MapSync.svg
"
buttonImage
:
_
syncNeeded
?
"
/qmlimages/MapSyncChanged.svg
"
:
"
/qmlimages/MapSync.svg
"
viewportMargins
:
ScreenTools
.
defaultFontPixelWidth
/
2
exclusiveGroup
:
_dropButtonsExclusiveGroup
dropDownComponent
:
syncDropDownComponent
...
...
@@ -745,7 +744,7 @@ QGCView {
QGCLabel
{
width
:
sendSaveGrid
.
width
wrapMode
:
Text
.
WordWrap
text
:
syncNeeded
&&
!
controller
.
autoSync
?
text
:
_
syncNeeded
&&
!
controller
.
autoSync
?
qsTr
(
"
You have unsaved changed to you mission. You should send to your vehicle, or save to a file:
"
)
:
qsTr
(
"
Sync:
"
)
}
...
...
@@ -771,7 +770,7 @@ QGCView {
enabled
:
_activeVehicle
&&
!
controller
.
syncInProgress
onClicked
:
{
syncButton
.
hideDropDown
()
if
(
syncNeeded
)
{
if
(
_
syncNeeded
)
{
_root
.
showDialog
(
syncLoadFromVehicleOverwrite
,
qsTr
(
"
Mission overwrite
"
),
_root
.
showDialogDefaultWidth
,
StandardButton
.
Yes
|
StandardButton
.
Cancel
)
}
else
{
loadFromVehicle
()
...
...
@@ -793,7 +792,7 @@ QGCView {
enabled
:
!
controller
.
syncInProgress
onClicked
:
{
syncButton
.
hideDropDown
()
if
(
syncNeeded
)
{
if
(
_
syncNeeded
)
{
_root
.
showDialog
(
syncLoadFromFileOverwrite
,
qsTr
(
"
Mission overwrite
"
),
_root
.
showDialogDefaultWidth
,
StandardButton
.
Yes
|
StandardButton
.
Cancel
)
}
else
{
loadFromFile
()
...
...
src/MissionManager/MissionController.cc
View file @
dfaafee2
...
...
@@ -76,10 +76,10 @@ void MissionController::_newMissionItemsAvailableFromVehicle(void)
if
(
!
_editMode
||
_missionItemsRequested
||
_visualItems
->
count
()
==
1
)
{
// Fly Mode:
// - Always accepts new items fromthe vehicle so Fly view is kept up to date
// - Always accepts new items from
the vehicle so Fly view is kept up to date
// Edit Mode:
// - Either a load from vehicle was manually requested or
// - The initial automatic load from a vehicle completed and the current editor i
t
empty
// - The initial automatic load from a vehicle completed and the current editor i
s
empty
QmlObjectListModel
*
newControllerMissionItems
=
new
QmlObjectListModel
(
this
);
const
QList
<
MissionItem
*>&
newMissionItems
=
_activeVehicle
->
missionManager
()
->
missionItems
();
...
...
@@ -948,6 +948,10 @@ void MissionController::_activeVehicleChanged(Vehicle* activeVehicle)
_activeVehicle
=
NULL
;
}
// We always remove all items on vehicle change. This leaves a user model hole:
// If the user has unsaved changes in the Plan view they will lose them
removeAllMissionItems
();
_activeVehicle
=
activeVehicle
;
if
(
_activeVehicle
)
{
...
...
@@ -959,8 +963,9 @@ void MissionController::_activeVehicleChanged(Vehicle* activeVehicle)
connect
(
_activeVehicle
,
&
Vehicle
::
homePositionAvailableChanged
,
this
,
&
MissionController
::
_activeVehicleHomePositionAvailableChanged
);
connect
(
_activeVehicle
,
&
Vehicle
::
homePositionChanged
,
this
,
&
MissionController
::
_activeVehicleHomePositionChanged
);
if
(
!
_editMode
)
{
removeAllMissionItems
();
if
(
!
syncInProgress
())
{
// We have to manually ask for the items from the Vehicle
getMissionItems
();
}
_activeVehicleHomePositionChanged
(
_activeVehicle
->
homePosition
());
...
...
src/MissionManager/MissionControllerTest.cc
View file @
dfaafee2
...
...
@@ -175,8 +175,13 @@ void MissionControllerTest::_testOfflineToOnlineWorker(MAV_AUTOPILOT firmwareTyp
// Go online to empty vehicle
MissionControllerManagerTest
::
_initForFirmwareType
(
firmwareType
);
// Make sure our offline mission items are still there
#if 1
// Due to current limitations, offline items will go away
QCOMPARE
(
_missionController
->
visualItems
()
->
count
(),
1
);
#else
//Make sure our offline mission items are still there
QCOMPARE
(
_missionController
->
visualItems
()
->
count
(),
2
);
#endif
}
void
MissionControllerTest
::
_testOfflineToOnlineAPM
(
void
)
...
...
src/MissionManager/MissionManager.cc
View file @
dfaafee2
...
...
@@ -44,6 +44,11 @@ MissionManager::~MissionManager()
void
MissionManager
::
writeMissionItems
(
const
QList
<
MissionItem
*>&
missionItems
)
{
if
(
inProgress
())
{
qCDebug
(
MissionManagerLog
)
<<
"writeMissionItems called while transaction in progress"
;
return
;
}
bool
skipFirstItem
=
!
_vehicle
->
firmwarePlugin
()
->
sendHomePositionToVehicle
();
_missionItems
.
clear
();
...
...
@@ -68,11 +73,6 @@ void MissionManager::writeMissionItems(const QList<MissionItem*>& missionItems)
qCDebug
(
MissionManagerLog
)
<<
"writeMissionItems count:"
<<
_missionItems
.
count
();
if
(
inProgress
())
{
qCDebug
(
MissionManagerLog
)
<<
"writeMissionItems called while transaction in progress"
;
return
;
}
// Prime write list
for
(
int
i
=
0
;
i
<
_missionItems
.
count
();
i
++
)
{
_itemIndicesToWrite
<<
i
;
...
...
@@ -132,6 +132,11 @@ void MissionManager::writeArduPilotGuidedMissionItem(const QGeoCoordinate& gotoC
void
MissionManager
::
requestMissionItems
(
void
)
{
qCDebug
(
MissionManagerLog
)
<<
"requestMissionItems read sequence"
;
if
(
inProgress
())
{
qCDebug
(
MissionManagerLog
)
<<
"requestMissionItems called while transaction in progress"
;
return
;
}
mavlink_message_t
message
;
mavlink_mission_request_list_t
request
;
...
...
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