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
abbb4d4c
Commit
abbb4d4c
authored
Feb 16, 2018
by
Gus Grubba
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Set takeoff position
Add flight plan deletion
parent
b3c506ed
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
49 additions
and
2 deletions
+49
-2
AirMapFlightPlanManager.cc
src/Airmap/AirMapFlightPlanManager.cc
+29
-0
AirMapFlightPlanManager.h
src/Airmap/AirMapFlightPlanManager.h
+2
-0
MissionController.cc
src/MissionManager/MissionController.cc
+18
-2
No files found.
src/Airmap/AirMapFlightPlanManager.cc
View file @
abbb4d4c
...
...
@@ -228,6 +228,35 @@ AirMapFlightPlanManager::_pollBriefing()
});
}
//-----------------------------------------------------------------------------
void
AirMapFlightPlanManager
::
_deleteFlightPlan
()
{
if
(
_flightPlan
.
isEmpty
())
{
qCDebug
(
AirMapManagerLog
)
<<
"Delete non existing flight plan"
;
return
;
}
qCDebug
(
AirMapManagerLog
)
<<
"Deleting flight plan"
;
_state
=
State
::
FlightDelete
;
std
::
weak_ptr
<
LifetimeChecker
>
isAlive
(
_instance
);
FlightPlans
::
Delete
::
Parameters
params
;
params
.
authorization
=
_shared
.
loginToken
().
toStdString
();
params
.
id
=
_flightPlan
.
toStdString
();
//-- Delete flight plan
_shared
.
client
()
->
flight_plans
().
delete_
(
params
,
[
this
,
isAlive
](
const
FlightPlans
::
Delete
::
Result
&
result
)
{
if
(
!
isAlive
.
lock
())
return
;
if
(
_state
!=
State
::
FlightDelete
)
return
;
if
(
result
)
{
_flightPlan
.
clear
();
qCDebug
(
AirMapManagerLog
)
<<
"Flight plan deleted"
;
_state
=
State
::
Idle
;
}
else
{
QString
description
=
QString
::
fromStdString
(
result
.
error
().
description
()
?
result
.
error
().
description
().
get
()
:
""
);
emit
error
(
"Flight Plan deletion failed"
,
QString
::
fromStdString
(
result
.
error
().
message
()),
description
);
}
});
}
//-----------------------------------------------------------------------------
void
AirMapFlightPlanManager
::
_missionBoundingCubeChanged
()
...
...
src/Airmap/AirMapFlightPlanManager.h
View file @
abbb4d4c
...
...
@@ -40,6 +40,7 @@ private slots:
private:
void
_uploadFlightPlan
();
void
_createFlightPlan
();
void
_deleteFlightPlan
();
private:
enum
class
State
{
...
...
@@ -47,6 +48,7 @@ private:
GetPilotID
,
FlightUpload
,
FlightPolling
,
FlightDelete
};
struct
Flight
{
...
...
src/MissionManager/MissionController.cc
View file @
abbb4d4c
...
...
@@ -2018,6 +2018,7 @@ void MissionController::setCurrentPlanViewIndex(int sequenceNumber, bool force)
void
MissionController
::
_updateTimeout
()
{
QGeoCoordinate
firstCoordinate
;
QGeoCoordinate
takeoffCoordinate
;
QGCGeoBoundingCube
boundingCube
;
double
north
=
0.0
;
...
...
@@ -2033,11 +2034,14 @@ void MissionController::_updateTimeout()
if
(
pSimpleItem
)
{
switch
(
pSimpleItem
->
command
())
{
case
MAV_CMD_NAV_TAKEOFF
:
takeoffCoordinate
=
pSimpleItem
->
coordinate
();
// Fall through
case
MAV_CMD_NAV_WAYPOINT
:
case
MAV_CMD_NAV_LAND
:
if
(
pSimpleItem
->
coordinate
().
isValid
())
{
if
(
pSimpleItem
->
command
()
==
MAV_CMD_NAV_TAKEOFF
)
{
takeoffCoordinate
=
pSimpleItem
->
coordinate
();
}
else
if
(
!
firstCoordinate
.
isValid
())
{
firstCoordinate
=
pSimpleItem
->
coordinate
();
}
double
lat
=
pSimpleItem
->
coordinate
().
latitude
()
+
90.0
;
double
lon
=
pSimpleItem
->
coordinate
().
longitude
()
+
180.0
;
double
alt
=
pSimpleItem
->
coordinate
().
altitude
();
...
...
@@ -2058,6 +2062,9 @@ void MissionController::_updateTimeout()
if
(
pComplexItem
)
{
QGCGeoBoundingCube
bc
=
pComplexItem
->
boundingCube
();
if
(
bc
.
isValid
())
{
if
(
!
firstCoordinate
.
isValid
()
&&
pComplexItem
->
coordinate
().
isValid
())
{
firstCoordinate
=
pComplexItem
->
coordinate
();
}
north
=
fmax
(
north
,
bc
.
pointNW
.
latitude
()
+
90.0
);
south
=
fmin
(
south
,
bc
.
pointSE
.
latitude
()
+
90.0
);
east
=
fmax
(
east
,
bc
.
pointNW
.
longitude
()
+
180.0
);
...
...
@@ -2068,6 +2075,15 @@ void MissionController::_updateTimeout()
}
}
}
//-- Figure out where this thing is taking off from
if
(
!
takeoffCoordinate
.
isValid
())
{
if
(
firstCoordinate
.
isValid
())
{
takeoffCoordinate
=
firstCoordinate
;
}
else
{
takeoffCoordinate
=
plannedHomePosition
();
}
}
//-- Build bounding "cube"
boundingCube
=
QGCGeoBoundingCube
(
QGeoCoordinate
(
north
-
90.0
,
west
-
180.0
,
minAlt
),
QGeoCoordinate
(
south
-
90.0
,
east
-
180.0
,
maxAlt
));
...
...
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