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
03685412
Unverified
Commit
03685412
authored
Aug 24, 2020
by
Don Gagne
Committed by
GitHub
Aug 24, 2020
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #8989 from mattstraehl/pr-landing-heading
Set default landing heading to takeoff heading
parents
63bddf06
c0bb343a
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
46 additions
and
14 deletions
+46
-14
LandingComplexItem.cc
src/MissionManager/LandingComplexItem.cc
+10
-0
LandingComplexItem.h
src/MissionManager/LandingComplexItem.h
+2
-0
MissionController.cc
src/MissionManager/MissionController.cc
+25
-13
MissionController.h
src/MissionManager/MissionController.h
+5
-1
FWLandingPatternEditor.qml
src/PlanView/FWLandingPatternEditor.qml
+1
-0
FWLandingPatternMapVisual.qml
src/PlanView/FWLandingPatternMapVisual.qml
+1
-0
VTOLLandingPatternEditor.qml
src/PlanView/VTOLLandingPatternEditor.qml
+1
-0
VTOLLandingPatternMapVisual.qml
src/PlanView/VTOLLandingPatternMapVisual.qml
+1
-0
No files found.
src/MissionManager/LandingComplexItem.cc
View file @
03685412
...
...
@@ -14,6 +14,7 @@
#include "SimpleMissionItem.h"
#include "PlanMasterController.h"
#include "FlightPathSegment.h"
#include "TakeoffMissionItem.h"
#include <QPolygonF>
...
...
@@ -29,6 +30,15 @@ LandingComplexItem::LandingComplexItem(PlanMasterController* masterController, b
qgcApp
()
->
addCompressedSignal
(
QMetaMethod
::
fromSignal
(
&
LandingComplexItem
::
_updateFlightPathSegmentsSignal
));
}
void
LandingComplexItem
::
setLandingHeadingToTakeoffHeading
()
{
TakeoffMissionItem
*
takeoffMissionItem
=
_missionController
->
takeoffMissionItem
();
if
(
takeoffMissionItem
&&
takeoffMissionItem
->
specifiesCoordinate
())
{
qreal
heading
=
takeoffMissionItem
->
launchCoordinate
().
azimuthTo
(
takeoffMissionItem
->
coordinate
());
landingHeading
()
->
setRawValue
(
heading
);
}
}
double
LandingComplexItem
::
complexDistance
(
void
)
const
{
return
loiterCoordinate
().
distanceTo
(
loiterTangentCoordinate
())
+
loiterTangentCoordinate
().
distanceTo
(
landingCoordinate
());
...
...
src/MissionManager/LandingComplexItem.h
View file @
03685412
...
...
@@ -40,6 +40,8 @@ public:
Q_PROPERTY
(
QGeoCoordinate
landingCoordinate
READ
landingCoordinate
WRITE
setLandingCoordinate
NOTIFY
landingCoordinateChanged
)
Q_PROPERTY
(
bool
landingCoordSet
MEMBER
_landingCoordSet
NOTIFY
landingCoordSetChanged
)
Q_INVOKABLE
void
setLandingHeadingToTakeoffHeading
();
virtual
Fact
*
loiterAltitude
(
void
)
=
0
;
virtual
Fact
*
loiterRadius
(
void
)
=
0
;
virtual
Fact
*
landingAltitude
(
void
)
=
0
;
...
...
src/MissionManager/MissionController.cc
View file @
03685412
...
...
@@ -166,6 +166,7 @@ void MissionController::_newMissionItemsAvailableFromVehicle(bool removeAllReque
_visualItems
->
deleteLater
();
_visualItems
=
nullptr
;
_settingsItem
=
nullptr
;
_takeoffMissionItem
=
nullptr
;
_updateContainsItems
();
// This will clear containsItems which will be set again below. This will re-pop Start Mission confirmation.
QmlObjectListModel
*
newControllerMissionItems
=
new
QmlObjectListModel
(
this
);
...
...
@@ -192,9 +193,9 @@ void MissionController::_newMissionItemsAvailableFromVehicle(bool removeAllReque
SimpleMissionItem
*
simpleItem
=
new
SimpleMissionItem
(
_masterController
,
_flyView
,
*
missionItem
,
this
);
if
(
TakeoffMissionItem
::
isTakeoffCommand
(
static_cast
<
MAV_CMD
>
(
simpleItem
->
command
())))
{
// This needs to be a TakeoffMissionItem
TakeoffMissionItem
*
takeoff
Item
=
new
TakeoffMissionItem
(
*
missionItem
,
_masterController
,
_flyView
,
settingsItem
,
this
);
_takeoffMission
Item
=
new
TakeoffMissionItem
(
*
missionItem
,
_masterController
,
_flyView
,
settingsItem
,
this
);
simpleItem
->
deleteLater
();
simpleItem
=
takeoff
Item
;
simpleItem
=
_takeoffMission
Item
;
}
newControllerMissionItems
->
append
(
simpleItem
);
}
...
...
@@ -359,34 +360,34 @@ VisualMissionItem* MissionController::insertSimpleMissionItem(QGeoCoordinate coo
VisualMissionItem
*
MissionController
::
insertTakeoffItem
(
QGeoCoordinate
/*coordinate*/
,
int
visualItemIndex
,
bool
makeCurrentItem
)
{
int
sequenceNumber
=
_nextSequenceNumber
();
TakeoffMissionItem
*
new
Item
=
new
TakeoffMissionItem
(
_controllerVehicle
->
vtol
()
?
MAV_CMD_NAV_VTOL_TAKEOFF
:
MAV_CMD_NAV_TAKEOFF
,
_masterController
,
_flyView
,
_settingsItem
,
this
);
new
Item
->
setSequenceNumber
(
sequenceNumber
);
_initVisualItem
(
new
Item
);
_takeoffMission
Item
=
new
TakeoffMissionItem
(
_controllerVehicle
->
vtol
()
?
MAV_CMD_NAV_VTOL_TAKEOFF
:
MAV_CMD_NAV_TAKEOFF
,
_masterController
,
_flyView
,
_settingsItem
,
this
);
_takeoffMission
Item
->
setSequenceNumber
(
sequenceNumber
);
_initVisualItem
(
_takeoffMission
Item
);
if
(
new
Item
->
specifiesAltitude
())
{
if
(
_takeoffMission
Item
->
specifiesAltitude
())
{
double
prevAltitude
;
int
prevAltitudeMode
;
if
(
_findPreviousAltitude
(
visualItemIndex
,
&
prevAltitude
,
&
prevAltitudeMode
))
{
new
Item
->
altitude
()
->
setRawValue
(
prevAltitude
);
new
Item
->
setAltitudeMode
(
static_cast
<
QGroundControlQmlGlobal
::
AltitudeMode
>
(
prevAltitudeMode
));
_takeoffMission
Item
->
altitude
()
->
setRawValue
(
prevAltitude
);
_takeoffMission
Item
->
setAltitudeMode
(
static_cast
<
QGroundControlQmlGlobal
::
AltitudeMode
>
(
prevAltitudeMode
));
}
}
if
(
visualItemIndex
==
-
1
)
{
_visualItems
->
append
(
new
Item
);
_visualItems
->
append
(
_takeoffMission
Item
);
}
else
{
_visualItems
->
insert
(
visualItemIndex
,
new
Item
);
_visualItems
->
insert
(
visualItemIndex
,
_takeoffMission
Item
);
}
_recalcAll
();
if
(
makeCurrentItem
)
{
setCurrentPlanViewSeqNum
(
new
Item
->
sequenceNumber
(),
true
);
setCurrentPlanViewSeqNum
(
_takeoffMission
Item
->
sequenceNumber
(),
true
);
}
_firstItemAdded
();
return
new
Item
;
return
_takeoffMission
Item
;
}
VisualMissionItem
*
MissionController
::
insertLandItem
(
QGeoCoordinate
coordinate
,
int
visualItemIndex
,
bool
makeCurrentItem
)
...
...
@@ -536,6 +537,10 @@ void MissionController::removeVisualItem(int viIndex)
bool
removeSurveyStyle
=
_visualItems
->
value
<
SurveyComplexItem
*>
(
viIndex
)
||
_visualItems
->
value
<
CorridorScanComplexItem
*>
(
viIndex
);
VisualMissionItem
*
item
=
qobject_cast
<
VisualMissionItem
*>
(
_visualItems
->
removeAt
(
viIndex
));
if
(
item
==
_takeoffMissionItem
)
{
_takeoffMissionItem
=
nullptr
;
}
_deinitVisualItem
(
item
);
item
->
deleteLater
();
...
...
@@ -591,6 +596,7 @@ void MissionController::removeAll(void)
_visualItems
->
clearAndDeleteContents
();
_visualItems
->
deleteLater
();
_settingsItem
=
nullptr
;
_takeoffMissionItem
=
nullptr
;
_visualItems
=
new
QmlObjectListModel
(
this
);
_addMissionSettings
(
_visualItems
);
_initAllVisualItems
();
...
...
@@ -983,8 +989,9 @@ void MissionController::_initLoadedVisualItems(QmlObjectListModel* loadedVisualI
if
(
_visualItems
)
{
_deinitAllVisualItems
();
_visualItems
->
deleteLater
();
_settingsItem
=
nullptr
;
}
_settingsItem
=
nullptr
;
_takeoffMissionItem
=
nullptr
;
_visualItems
=
loadedVisualItems
;
...
...
@@ -1859,6 +1866,11 @@ void MissionController::_initAllVisualItems(void)
for
(
int
i
=
0
;
i
<
_visualItems
->
count
();
i
++
)
{
VisualMissionItem
*
item
=
qobject_cast
<
VisualMissionItem
*>
(
_visualItems
->
get
(
i
));
_initVisualItem
(
item
);
TakeoffMissionItem
*
takeoffItem
=
qobject_cast
<
TakeoffMissionItem
*>
(
item
);
if
(
takeoffItem
)
{
_takeoffMissionItem
=
takeoffItem
;
}
}
_recalcAll
();
...
...
src/MissionManager/MissionController.h
View file @
03685412
...
...
@@ -22,12 +22,12 @@
class
FlightPathSegment
;
class
VisualMissionItem
;
class
MissionItem
;
class
MissionSettingsItem
;
class
AppSettings
;
class
MissionManager
;
class
SimpleMissionItem
;
class
ComplexMissionItem
;
class
MissionSettingsItem
;
class
TakeoffMissionItem
;
class
QDomDocument
;
class
PlanViewSettings
;
...
...
@@ -86,6 +86,7 @@ public:
Q_PROPERTY
(
int
currentPlanViewSeqNum
READ
currentPlanViewSeqNum
NOTIFY
currentPlanViewSeqNumChanged
)
Q_PROPERTY
(
int
currentPlanViewVIIndex
READ
currentPlanViewVIIndex
NOTIFY
currentPlanViewVIIndexChanged
)
Q_PROPERTY
(
VisualMissionItem
*
currentPlanViewItem
READ
currentPlanViewItem
NOTIFY
currentPlanViewItemChanged
)
Q_PROPERTY
(
TakeoffMissionItem
*
takeoffMissionItem
READ
takeoffMissionItem
NOTIFY
takeoffMissionItemChanged
)
Q_PROPERTY
(
double
missionDistance
READ
missionDistance
NOTIFY
missionDistanceChanged
)
Q_PROPERTY
(
double
missionTime
READ
missionTime
NOTIFY
missionTimeChanged
)
Q_PROPERTY
(
double
missionHoverDistance
READ
missionHoverDistance
NOTIFY
missionHoverDistanceChanged
)
...
...
@@ -225,6 +226,7 @@ public:
QStringList
complexMissionItemNames
(
void
)
const
;
QGeoCoordinate
plannedHomePosition
(
void
)
const
;
VisualMissionItem
*
currentPlanViewItem
(
void
)
const
{
return
_currentPlanViewItem
;
}
TakeoffMissionItem
*
takeoffMissionItem
(
void
)
const
{
return
_takeoffMissionItem
;
}
double
progressPct
(
void
)
const
{
return
_progressPct
;
}
QString
surveyComplexItemName
(
void
)
const
;
QString
corridorScanComplexItemName
(
void
)
const
;
...
...
@@ -280,6 +282,7 @@ signals:
void
currentPlanViewSeqNumChanged
(
void
);
void
currentPlanViewVIIndexChanged
(
void
);
void
currentPlanViewItemChanged
(
void
);
void
takeoffMissionItemChanged
(
void
);
void
missionBoundingCubeChanged
(
void
);
void
missionItemCountChanged
(
int
missionItemCount
);
void
onlyInsertTakeoffValidChanged
(
void
);
...
...
@@ -379,6 +382,7 @@ private:
int
_currentPlanViewSeqNum
=
-
1
;
int
_currentPlanViewVIIndex
=
-
1
;
VisualMissionItem
*
_currentPlanViewItem
=
nullptr
;
TakeoffMissionItem
*
_takeoffMissionItem
=
nullptr
;
QTimer
_updateTimer
;
QGCGeoBoundingCube
_travelBoundingCube
;
QGeoCoordinate
_takeoffCoordinate
;
...
...
src/PlanView/FWLandingPatternEditor.qml
View file @
03685412
...
...
@@ -289,6 +289,7 @@ Rectangle {
onClicked
:
{
missionItem
.
landingCoordinate
=
activeVehicle
.
coordinate
missionItem
.
landingHeading
.
rawValue
=
activeVehicle
.
heading
.
rawValue
missionItem
.
setLandingHeadingToTakeoffHeading
()
}
}
}
...
...
src/PlanView/FWLandingPatternMapVisual.qml
View file @
03685412
...
...
@@ -189,6 +189,7 @@ Item {
coordinate
.
longitude
=
coordinate
.
longitude
.
toFixed
(
_decimalPlaces
)
coordinate
.
altitude
=
coordinate
.
altitude
.
toFixed
(
_decimalPlaces
)
_missionItem
.
landingCoordinate
=
coordinate
_missionItem
.
setLandingHeadingToTakeoffHeading
()
}
}
}
...
...
src/PlanView/VTOLLandingPatternEditor.qml
View file @
03685412
...
...
@@ -276,6 +276,7 @@ Rectangle {
onClicked
:
{
missionItem
.
landingCoordinate
=
activeVehicle
.
coordinate
missionItem
.
landingHeading
.
rawValue
=
activeVehicle
.
heading
.
rawValue
missionItem
.
setLandingHeadingToTakeoffHeading
()
}
}
}
...
...
src/PlanView/VTOLLandingPatternMapVisual.qml
View file @
03685412
...
...
@@ -159,6 +159,7 @@ Item {
coordinate
.
longitude
=
coordinate
.
longitude
.
toFixed
(
_decimalPlaces
)
coordinate
.
altitude
=
coordinate
.
altitude
.
toFixed
(
_decimalPlaces
)
_missionItem
.
landingCoordinate
=
coordinate
_missionItem
.
setLandingHeadingToTakeoffHeading
()
}
}
}
...
...
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