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
f95fbf70
Unverified
Commit
f95fbf70
authored
Dec 31, 2018
by
Don Gagne
Committed by
GitHub
Dec 31, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #7105 from DonLakeFlyer/GuidedCancel
Better handling of guided map indicator show/hide
parents
50a42e36
9ad555d0
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
93 additions
and
39 deletions
+93
-39
APMFirmwarePlugin.h
src/FirmwarePlugin/APM/APMFirmwarePlugin.h
+1
-0
FirmwarePlugin.cc
src/FirmwarePlugin/FirmwarePlugin.cc
+5
-0
FirmwarePlugin.h
src/FirmwarePlugin/FirmwarePlugin.h
+3
-0
PX4FirmwarePlugin.h
src/FirmwarePlugin/PX4/PX4FirmwarePlugin.h
+1
-0
FlightDisplayViewMap.qml
src/FlightDisplay/FlightDisplayViewMap.qml
+44
-5
GuidedActionConfirm.qml
src/FlightDisplay/GuidedActionConfirm.qml
+19
-14
GuidedActionsController.qml
src/FlightDisplay/GuidedActionsController.qml
+2
-2
SliderSwitch.qml
src/QmlControls/SliderSwitch.qml
+0
-7
Vehicle.cc
src/Vehicle/Vehicle.cc
+5
-0
Vehicle.h
src/Vehicle/Vehicle.h
+13
-11
No files found.
src/FirmwarePlugin/APM/APMFirmwarePlugin.h
View file @
f95fbf70
...
...
@@ -84,6 +84,7 @@ public:
QString
flightMode
(
uint8_t
base_mode
,
uint32_t
custom_mode
)
const
override
;
bool
setFlightMode
(
const
QString
&
flightMode
,
uint8_t
*
base_mode
,
uint32_t
*
custom_mode
)
override
;
bool
isGuidedMode
(
const
Vehicle
*
vehicle
)
const
override
;
QString
gotoFlightMode
(
void
)
const
override
{
return
QStringLiteral
(
"Guided"
);
}
QString
rtlFlightMode
(
void
)
const
override
{
return
QString
(
"RTL"
);
}
QString
missionFlightMode
(
void
)
const
override
{
return
QString
(
"Auto"
);
}
void
pauseVehicle
(
Vehicle
*
vehicle
)
override
;
...
...
src/FirmwarePlugin/FirmwarePlugin.cc
View file @
f95fbf70
...
...
@@ -757,3 +757,8 @@ int FirmwarePlugin::versionCompare(Vehicle* vehicle, QString& compare)
int
patch
=
versionNumbers
[
2
].
toInt
();
return
versionCompare
(
vehicle
,
major
,
minor
,
patch
);
}
QString
FirmwarePlugin
::
gotoFlightMode
(
void
)
const
{
return
QString
();
}
src/FirmwarePlugin/FirmwarePlugin.h
View file @
f95fbf70
...
...
@@ -114,6 +114,9 @@ public:
/// Returns whether the vehicle is in guided mode or not.
virtual
bool
isGuidedMode
(
const
Vehicle
*
vehicle
)
const
;
/// Returns the flight mode which the vehicle will be in if it is performing a goto location
virtual
QString
gotoFlightMode
(
void
)
const
;
/// Set guided flight mode
virtual
void
setGuidedMode
(
Vehicle
*
vehicle
,
bool
guidedMode
);
...
...
src/FirmwarePlugin/PX4/PX4FirmwarePlugin.h
View file @
f95fbf70
...
...
@@ -42,6 +42,7 @@ public:
QString
rtlFlightMode
(
void
)
const
override
{
return
_rtlFlightMode
;
}
QString
landFlightMode
(
void
)
const
override
{
return
_landingFlightMode
;
}
QString
takeControlFlightMode
(
void
)
const
override
{
return
_manualFlightMode
;
}
QString
gotoFlightMode
(
void
)
const
override
{
return
_holdFlightMode
;
}
void
pauseVehicle
(
Vehicle
*
vehicle
)
override
;
void
guidedModeRTL
(
Vehicle
*
vehicle
)
override
;
void
guidedModeLand
(
Vehicle
*
vehicle
)
override
;
...
...
src/FlightDisplay/FlightDisplayViewMap.qml
View file @
f95fbf70
...
...
@@ -295,6 +295,7 @@ FlightMap {
}
}
// GoTo Location visuals
MapQuickItem
{
id
:
gotoLocationItem
visible
:
false
...
...
@@ -308,6 +309,22 @@ FlightMap {
label
:
qsTr
(
"
Goto here
"
,
"
Goto here waypoint
"
)
}
property
bool
inGotoFlightMode
:
_activeVehicle
?
_activeVehicle
.
flightMode
===
_activeVehicle
.
gotoFlightMode
:
false
property
var
activeVehicle
:
_activeVehicle
onInGotoFlightModeChanged
:
{
if
(
!
inGotoFlightMode
&&
visible
)
{
// Hide goto indicator when vehicle falls out of guided mode
visible
=
false
}
}
onActiveVehicleChanged
:
{
if
(
!
_activeVehicle
)
{
visible
=
false
}
}
function
show
(
coord
)
{
gotoLocationItem
.
coordinate
=
coord
gotoLocationItem
.
visible
=
true
...
...
@@ -316,10 +333,17 @@ FlightMap {
function
hide
()
{
gotoLocationItem
.
visible
=
false
}
}
// Orbit visuals
function
actionConfirmed
()
{
// We leave the indicator visible. The handling for onInGuidedModeChanged will hide it.
}
function
actionCancelled
()
{
hide
()
}
}
// Orbit editing visuals
QGCMapCircleVisuals
{
id
:
orbitMapCircle
mapControl
:
parent
...
...
@@ -328,9 +352,16 @@ FlightMap {
property
alias
center
:
_mapCircle
.
center
property
alias
clockwiseRotation
:
_mapCircle
.
clockwiseRotation
property
var
activeVehicle
:
_activeVehicle
readonly
property
real
defaultRadius
:
30
onActiveVehicleChanged
:
{
if
(
!
_activeVehicle
)
{
visible
=
false
}
}
function
show
(
coord
)
{
_mapCircle
.
radius
.
rawValue
=
defaultRadius
orbitMapCircle
.
center
=
coord
...
...
@@ -341,6 +372,15 @@ FlightMap {
orbitMapCircle
.
visible
=
false
}
function
actionConfirmed
()
{
// Live orbit status is handled by telemetry so we hide here and telemetry will show again.
hide
()
}
function
actionCancelled
()
{
hide
()
}
function
radius
()
{
return
_mapCircle
.
radius
.
rawValue
}
...
...
@@ -357,7 +397,6 @@ FlightMap {
}
// Orbit telemetry visuals
QGCMapCircleVisuals
{
id
:
orbitTelemetryCircle
mapControl
:
parent
...
...
@@ -395,7 +434,7 @@ FlightMap {
onTriggered
:
{
gotoLocationItem
.
show
(
clickMenu
.
coord
)
orbitMapCircle
.
hide
()
guidedActionsController
.
confirmAction
(
guidedActionsController
.
actionGoto
,
clickMenu
.
coord
)
guidedActionsController
.
confirmAction
(
guidedActionsController
.
actionGoto
,
clickMenu
.
coord
,
gotoLocationItem
)
}
}
...
...
@@ -406,7 +445,7 @@ FlightMap {
onTriggered
:
{
orbitMapCircle
.
show
(
clickMenu
.
coord
)
gotoLocationItem
.
hide
()
guidedActionsController
.
confirmAction
(
guidedActionsController
.
actionOrbit
,
clickMenu
.
coord
)
guidedActionsController
.
confirmAction
(
guidedActionsController
.
actionOrbit
,
clickMenu
.
coord
,
orbitMapCircle
)
}
}
}
...
...
src/FlightDisplay/GuidedActionConfirm.qml
View file @
f95fbf70
...
...
@@ -34,16 +34,14 @@ Rectangle {
property
int
action
property
var
actionData
property
bool
hideTrigger
:
false
property
var
mapIndicator
property
real
_margins
:
ScreenTools
.
defaultFontPixelWidth
property
bool
_emergencyAction
:
action
===
guidedController
.
actionEmergencyStop
onHideTriggerChanged
:
{
if
(
hideTrigger
)
{
hideTrigger
=
false
altitudeSlider
.
visible
=
false
visibleTimer
.
stop
()
visible
=
false
confirmCancelled
()
}
}
...
...
@@ -57,6 +55,17 @@ Rectangle {
}
}
function
confirmCancelled
()
{
altitudeSlider
.
visible
=
false
visible
=
false
hideTrigger
=
false
visibleTimer
.
stop
()
if
(
mapIndicator
)
{
mapIndicator
.
actionCancelled
()
mapIndicator
=
undefined
}
}
Timer
{
id
:
visibleTimer
interval
:
1000
...
...
@@ -107,12 +116,10 @@ Rectangle {
}
hideTrigger
=
false
guidedController
.
executeAction
(
_root
.
action
,
_root
.
actionData
,
altitudeChange
)
}
onReject
:
{
altitudeSlider
.
visible
=
false
_root
.
visible
=
false
hideTrigger
=
false
if
(
mapIndicator
)
{
mapIndicator
.
actionConfirmed
()
mapIndicator
=
undefined
}
}
}
}
...
...
@@ -127,12 +134,10 @@ Rectangle {
source
:
"
/res/XDelete.svg
"
fillMode
:
Image
.
PreserveAspectFit
color
:
qgcPal
.
text
QGCMouseArea
{
fillItem
:
parent
onClicked
:
{
altitudeSlider
.
visible
=
false
_root
.
visible
=
false
}
onClicked
:
confirmCancelled
()
}
}
}
src/FlightDisplay/GuidedActionsController.qml
View file @
f95fbf70
...
...
@@ -209,12 +209,13 @@ Item {
}
// Called when an action is about to be executed in order to confirm
function
confirmAction
(
actionCode
,
actionData
)
{
function
confirmAction
(
actionCode
,
actionData
,
mapIndicator
)
{
var
showImmediate
=
true
closeAll
()
confirmDialog
.
action
=
actionCode
confirmDialog
.
actionData
=
actionData
confirmDialog
.
hideTrigger
=
true
confirmDialog
.
mapIndicator
=
mapIndicator
_actionData
=
actionData
switch
(
actionCode
)
{
case
actionArm
:
...
...
@@ -385,7 +386,6 @@ Item {
break
case
actionOrbit
:
_activeVehicle
.
guidedModeOrbit
(
orbitMapCircle
.
center
,
orbitMapCircle
.
radius
()
*
(
orbitMapCircle
.
clockwiseRotation
?
1
:
-
1
),
_activeVehicle
.
altitudeAMSL
.
rawValue
+
actionAltitudeChange
)
orbitMapCircle
.
hide
()
break
case
actionLandAbort
:
_activeVehicle
.
abortLanding
(
50
)
// hardcoded value for climbOutAltitude that is currently ignored
...
...
src/QmlControls/SliderSwitch.qml
View file @
f95fbf70
...
...
@@ -14,7 +14,6 @@ Rectangle {
color
:
qgcPal
.
windowShade
signal
accept
///< Action confirmed
signal
reject
///< Action rejected
property
string
confirmText
///< Text for slider
property
alias
fontPointSize
:
label
.
font
.
pointSize
///< Point size for text
...
...
@@ -70,12 +69,6 @@ Rectangle {
property
bool
dragActive
:
drag
.
active
property
real
_dragOffset
:
1
//Component.onCompleted: console.log(height, ScreenTools.minTouchPixels)
onPressed
:
{
mouse
.
x
}
onDragActiveChanged
:
{
if
(
!
sliderDragArea
.
drag
.
active
)
{
if
(
slider
.
x
>
_maxXDrag
-
_border
)
{
...
...
src/Vehicle/Vehicle.cc
View file @
f95fbf70
...
...
@@ -2962,6 +2962,11 @@ bool Vehicle::takeoffVehicleSupported() const
return
_firmwarePlugin
->
isCapable
(
this
,
FirmwarePlugin
::
TakeoffVehicleCapability
);
}
QString
Vehicle
::
gotoFlightMode
()
const
{
return
_firmwarePlugin
->
gotoFlightMode
();
}
void
Vehicle
::
guidedModeRTL
(
void
)
{
if
(
!
guidedModeSupported
())
{
...
...
src/Vehicle/Vehicle.h
View file @
f95fbf70
...
...
@@ -636,13 +636,14 @@ public:
Q_PROPERTY
(
QGCMapCircle
*
orbitMapCircle
READ
orbitMapCircle
CONSTANT
)
// Vehicle state used for guided control
Q_PROPERTY
(
bool
flying
READ
flying
NOTIFY
flyingChanged
)
///< Vehicle is flying
Q_PROPERTY
(
bool
landing
READ
landing
NOTIFY
landingChanged
)
///< Vehicle is in landing pattern (DO_LAND_START)
Q_PROPERTY
(
bool
guidedMode
READ
guidedMode
WRITE
setGuidedMode
NOTIFY
guidedModeChanged
)
///< Vehicle is in Guided mode and can respond to guided commands
Q_PROPERTY
(
bool
guidedModeSupported
READ
guidedModeSupported
CONSTANT
)
///< Guided mode commands are supported by this vehicle
Q_PROPERTY
(
bool
pauseVehicleSupported
READ
pauseVehicleSupported
CONSTANT
)
///< Pause vehicle command is supported
Q_PROPERTY
(
bool
orbitModeSupported
READ
orbitModeSupported
CONSTANT
)
///< Orbit mode is supported by this vehicle
Q_PROPERTY
(
bool
takeoffVehicleSupported
READ
takeoffVehicleSupported
CONSTANT
)
///< Guided takeoff supported
Q_PROPERTY
(
bool
flying
READ
flying
NOTIFY
flyingChanged
)
///< Vehicle is flying
Q_PROPERTY
(
bool
landing
READ
landing
NOTIFY
landingChanged
)
///< Vehicle is in landing pattern (DO_LAND_START)
Q_PROPERTY
(
bool
guidedMode
READ
guidedMode
WRITE
setGuidedMode
NOTIFY
guidedModeChanged
)
///< Vehicle is in Guided mode and can respond to guided commands
Q_PROPERTY
(
bool
guidedModeSupported
READ
guidedModeSupported
CONSTANT
)
///< Guided mode commands are supported by this vehicle
Q_PROPERTY
(
bool
pauseVehicleSupported
READ
pauseVehicleSupported
CONSTANT
)
///< Pause vehicle command is supported
Q_PROPERTY
(
bool
orbitModeSupported
READ
orbitModeSupported
CONSTANT
)
///< Orbit mode is supported by this vehicle
Q_PROPERTY
(
bool
takeoffVehicleSupported
READ
takeoffVehicleSupported
CONSTANT
)
///< Guided takeoff supported
Q_PROPERTY
(
QString
gotoFlightMode
READ
gotoFlightMode
CONSTANT
)
///< Flight mode vehicle is in while performing goto
Q_PROPERTY
(
ParameterManager
*
parameterManager
READ
parameterManager
CONSTANT
)
...
...
@@ -761,10 +762,11 @@ public:
/// @param percent 0-no power, 100-full power
Q_INVOKABLE
void
motorTest
(
int
motor
,
int
percent
);
bool
guidedModeSupported
(
void
)
const
;
bool
pauseVehicleSupported
(
void
)
const
;
bool
orbitModeSupported
(
void
)
const
;
bool
takeoffVehicleSupported
(
void
)
const
;
bool
guidedModeSupported
(
void
)
const
;
bool
pauseVehicleSupported
(
void
)
const
;
bool
orbitModeSupported
(
void
)
const
;
bool
takeoffVehicleSupported
(
void
)
const
;
QString
gotoFlightMode
(
void
)
const
;
// Property accessors
...
...
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