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
7664ce33
Commit
7664ce33
authored
Oct 22, 2015
by
Gus Grubba
Browse files
Options
Browse Files
Download
Plain Diff
Merge master
parents
b878b8df
95d99cc6
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
144 additions
and
32 deletions
+144
-32
FlightDisplayView.qml
src/FlightDisplay/FlightDisplayView.qml
+10
-4
MissionEditor.qml
src/MissionEditor/MissionEditor.qml
+31
-19
MockLink.cc
src/comm/MockLink.cc
+54
-5
MockLink.h
src/comm/MockLink.h
+11
-1
MainWindow.qml
src/ui/MainWindow.qml
+19
-0
MockLinkConfiguration.cc
src/ui/MockLinkConfiguration.cc
+11
-3
MockLinkConfiguration.h
src/ui/MockLinkConfiguration.h
+1
-0
MockLinkConfiguration.ui
src/ui/MockLinkConfiguration.ui
+7
-0
No files found.
src/FlightDisplay/FlightDisplayView.qml
View file @
7664ce33
...
...
@@ -41,6 +41,9 @@ import QGroundControl.Controllers 1.0
Item
{
id
:
root
property
alias
latitude
:
flightMap
.
latitude
property
alias
longitude
:
flightMap
.
longitude
// Top margin for all widgets. Used to prevent overlap with the toolbar
property
real
topMargin
:
0
...
...
@@ -110,7 +113,6 @@ Item {
QGroundControl
.
flightMapSettings
.
saveMapSetting
(
flightMap
.
mapName
,
_showMapBackgroundKey
,
setBool
(
_showMap
))
}
FlightMap
{
id
:
flightMap
anchors.fill
:
parent
...
...
@@ -122,6 +124,8 @@ Item {
property
var
rootVehicleCoordinate
:
_vehicleCoordinate
property
bool
rootLoadCompleted
:
false
property
bool
_followVehicle
:
true
onRootVehicleCoordinateChanged
:
updateMapPosition
(
false
/* force */
)
Component.onCompleted
:
flightMapDelayLoader
.
source
=
"
FlightDisplayViewDelayLoadInner.qml
"
...
...
@@ -132,9 +136,6 @@ Item {
flightMap
.
longitude
=
root
.
_vehicleCoordinate
.
longitude
}
}
property
bool
_followVehicle
:
true
// Home position
MissionItemIndicator
{
label
:
"
H
"
...
...
@@ -188,6 +189,11 @@ Item {
id
:
flightMapDelayLoader
anchors.fill
:
parent
}
// Used to make pinch zoom work
MouseArea
{
anchors.fill
:
parent
}
}
// Flight Map
Loader
{
...
...
src/MissionEditor/MissionEditor.qml
View file @
7664ce33
...
...
@@ -60,10 +60,10 @@ QGCView {
property
var
_homePositionManager
:
QGroundControl
.
homePositionManager
property
string
_homePositionName
:
_homePositionManager
.
homePositions
.
get
(
0
).
name
property
var
offlineHomePosition
:
_homePositionManager
.
homePositions
.
get
(
0
).
coordinate
//
property var offlineHomePosition: _homePositionManager.homePositions.get(0).coordinate
property
var
liveHomePosition
:
controller
.
liveHomePosition
property
var
liveHomePositionAvailable
:
controller
.
liveHomePositionAvailable
property
var
homePosition
:
offlineHomePosition
// live or offline depending on state
//
property var homePosition: offlineHomePosition // live or offline depending on state
property
bool
_syncNeeded
:
controller
.
missionItems
.
dirty
property
bool
_syncInProgress
:
_activeVehicle
?
_activeVehicle
.
missionManager
.
inProgress
:
false
...
...
@@ -103,13 +103,14 @@ QGCView {
}
function
updateHomePosition
()
{
homePosition
=
liveHomePositionAvailable
?
liveHomePosition
:
offlineHomePosition
_missionItems
.
get
(
0
).
coordinate
=
homePosition
_missionItems
.
get
(
0
).
homePositionValid
=
true
if
(
liveHomePositionAvailable
)
{
_missionItems
.
get
(
0
).
coordinate
=
liveHomePosition
_missionItems
.
get
(
0
).
homePositionValid
=
true
}
}
Component.onCompleted
:
updateHomePosition
()
onOfflineHomePositionChanged
:
updateHomePosition
()
//
onOfflineHomePositionChanged: updateHomePosition()
onLiveHomePositionAvailableChanged
:
updateHomePosition
()
onLiveHomePositionChanged
:
updateHomePosition
()
...
...
@@ -124,11 +125,8 @@ QGCView {
id
:
editorMap
anchors.fill
:
parent
mapName
:
"
MissionEditor
"
Component.onCompleted
:
{
latitude
=
homePosition
.
latitude
longitude
=
homePosition
.
longitude
}
latitude
:
tabletPosition
.
latitude
longitude
:
tabletPosition
.
longitude
readonly
property
real
animationDuration
:
500
...
...
@@ -161,8 +159,8 @@ QGCView {
coordinate
.
latitude
=
coordinate
.
latitude
.
toFixed
(
_decimalPlaces
)
coordinate
.
longitude
=
coordinate
.
longitude
.
toFixed
(
_decimalPlaces
)
coordinate
.
altitude
=
coordinate
.
altitude
.
toFixed
(
_decimalPlaces
)
if
(
homePositionManagerButton
.
checked
)
{
offlineHomePosition
=
coordinate
if
(
false
/*homePositionManagerButton.checked*/
)
{
//
offlineHomePosition = coordinate
}
else
if
(
addMissionItemsButton
.
checked
)
{
var
index
=
controller
.
addMissionItem
(
coordinate
)
addMissionItemsButtonAutoOffTimer
.
start
()
...
...
@@ -240,7 +238,7 @@ QGCView {
anchors.bottom
:
parent
.
bottom
anchors.right
:
parent
.
right
width
:
_rightPanelWidth
visible
:
!
homePositionManagerButton
.
checked
&&
_missionItems
.
count
>
1
visible
:
_missionItems
.
count
>
1
opacity
:
_rightPanelOpacity
z
:
QGroundControl
.
zOrderTopMost
...
...
@@ -257,7 +255,8 @@ QGCView {
MissionItemEditor
{
missionItem
:
object
width
:
parent
.
width
readOnly
:
object
.
sequenceNumber
==
0
&&
liveHomePositionAvailable
readOnly
:
object
.
sequenceNumber
==
0
visible
:
!
readOnly
||
object
.
homePositionValid
onClicked
:
setCurrentItem
(
object
.
sequenceNumber
)
...
...
@@ -281,6 +280,9 @@ QGCView {
}
}
// Item - Mission Item editor
/*
Home Position Manager is commented out for now until a better implementation is completed
// Home Position Manager
Rectangle {
id: homePositionManager
...
...
@@ -552,6 +554,7 @@ QGCView {
}
} // Column - Online view
} // Item - Home Position Manager
*/
// Help Panel
Rectangle
{
...
...
@@ -650,6 +653,9 @@ QGCView {
"
Delete the currently selected mission item.
"
}
/*
Home Position Manager commented until more complete implementation is done
Image {
id: homePositionManagerHelpIcon
anchors.topMargin: ScreenTools.defaultFontPixelHeight
...
...
@@ -672,11 +678,12 @@ QGCView {
"When enabled, allows you to select/add/update flying field locations. " +
"You can save multiple flying field locations for use while creating missions while you are not connected to your vehicle."
}
*/
Image
{
id
:
mapCenterHelpIcon
anchors.topMargin
:
ScreenTools
.
defaultFontPixelHeight
anchors.top
:
homePositionManager
HelpText
.
bottom
anchors.top
:
delete
HelpText
.
bottom
width
:
ScreenTools
.
defaultFontPixelHeight
*
3
fillMode
:
Image
.
PreserveAspectFit
mipmap
:
true
...
...
@@ -793,6 +800,9 @@ QGCView {
}
}
/*
Home Position Manager commented until more complete implementation is done
RoundButton {
id: homePositionManagerButton
anchors.margins: _margin
...
...
@@ -802,12 +812,13 @@ QGCView {
exclusiveGroup: _dropButtonsExclusiveGroup
z: QGroundControl.zOrderWidgets
}
*/
DropButton
{
id
:
centerMapButton
anchors.margins
:
_margin
anchors.left
:
parent
.
left
anchors.top
:
homePositionManager
Button
.
bottom
anchors.top
:
deleteMissionItem
Button
.
bottom
dropDirection
:
dropRight
buttonImage
:
"
/qmlimages/MapCenter.svg
"
viewportMargins
:
ScreenTools
.
defaultFontPixelWidth
/
2
...
...
@@ -822,11 +833,12 @@ QGCView {
spacing
:
ScreenTools
.
defaultFontPixelWidth
QGCButton
{
text
:
"
Home
"
text
:
"
Home
"
enabled
:
liveHomePositionAvailable
onClicked
:
{
centerMapButton
.
hideDropDown
()
editorMap
.
center
=
QtPositioning
.
coordinate
(
homePosition
.
latitude
,
homePosition
.
longitude
)
editorMap
.
center
=
liveHomePosition
}
}
...
...
src/comm/MockLink.cc
View file @
7664ce33
...
...
@@ -71,7 +71,8 @@ float MockLink::_vehicleLatitude = 47.633033f;
float
MockLink
::
_vehicleLongitude
=
-
122.08794
f
;
float
MockLink
::
_vehicleAltitude
=
2.5
f
;
const
char
*
MockConfiguration
::
_firmwareTypeKey
=
"FirmwareType"
;
const
char
*
MockConfiguration
::
_firmwareTypeKey
=
"FirmwareType"
;
const
char
*
MockConfiguration
::
_sendStatusTextKey
=
"SendStatusText"
;
MockLink
::
MockLink
(
MockConfiguration
*
config
)
:
_missionItemHandler
(
this
)
...
...
@@ -85,10 +86,12 @@ MockLink::MockLink(MockConfiguration* config)
,
_mavState
(
MAV_STATE_STANDBY
)
,
_autopilotType
(
MAV_AUTOPILOT_PX4
)
,
_fileServer
(
NULL
)
,
_sendStatusText
(
false
)
{
_config
=
config
;
if
(
_config
)
{
_autopilotType
=
config
->
firmwareType
();
_sendStatusText
=
config
->
sendStatusText
();
}
union
px4_custom_mode
px4_cm
;
...
...
@@ -168,6 +171,10 @@ void MockLink::_run1HzTasks(void)
if
(
_mavlinkStarted
&&
_connected
)
{
_sendHeartBeat
();
_sendHomePosition
();
if
(
_sendStatusText
)
{
_sendStatusText
=
false
;
_sendStatusTextMessages
();
}
}
}
...
...
@@ -747,9 +754,42 @@ void MockLink::_sendGpsRawInt(void)
respondWithMavlinkMessage
(
msg
);
}
void
MockLink
::
_sendStatusTextMessages
(
void
)
{
struct
StatusMessage
{
MAV_SEVERITY
severity
;
const
char
*
msg
;
};
static
const
struct
StatusMessage
rgMessages
[]
=
{
{
MAV_SEVERITY_INFO
,
"#Testing audio output"
},
{
MAV_SEVERITY_EMERGENCY
,
"Status text emergency"
},
{
MAV_SEVERITY_ALERT
,
"Status text alert"
},
{
MAV_SEVERITY_CRITICAL
,
"Status text critical"
},
{
MAV_SEVERITY_ERROR
,
"Status text error"
},
{
MAV_SEVERITY_WARNING
,
"Status text warning"
},
{
MAV_SEVERITY_NOTICE
,
"Status text notice"
},
{
MAV_SEVERITY_INFO
,
"Status text info"
},
{
MAV_SEVERITY_DEBUG
,
"Status text debug"
},
};
for
(
size_t
i
=
0
;
i
<
sizeof
(
rgMessages
)
/
sizeof
(
rgMessages
[
0
]);
i
++
)
{
mavlink_message_t
msg
;
const
struct
StatusMessage
*
status
=
&
rgMessages
[
i
];
mavlink_msg_statustext_pack
(
_vehicleSystemId
,
_vehicleComponentId
,
&
msg
,
status
->
severity
,
status
->
msg
);
respondWithMavlinkMessage
(
msg
);
}
}
MockConfiguration
::
MockConfiguration
(
const
QString
&
name
)
:
LinkConfiguration
(
name
)
,
_firmwareType
(
MAV_AUTOPILOT_PX4
)
,
_sendStatusText
(
false
)
{
}
...
...
@@ -757,21 +797,29 @@ MockConfiguration::MockConfiguration(const QString& name)
MockConfiguration
::
MockConfiguration
(
MockConfiguration
*
source
)
:
LinkConfiguration
(
source
)
{
_firmwareType
=
source
->
_firmwareType
;
_firmwareType
=
source
->
_firmwareType
;
_sendStatusText
=
source
->
_sendStatusText
;
}
void
MockConfiguration
::
copyFrom
(
LinkConfiguration
*
source
)
{
LinkConfiguration
::
copyFrom
(
source
);
MockConfiguration
*
usource
=
dynamic_cast
<
MockConfiguration
*>
(
source
);
Q_ASSERT
(
usource
!=
NULL
);
_firmwareType
=
usource
->
_firmwareType
;
if
(
!
usource
)
{
qWarning
()
<<
"dynamic_cast failed"
<<
source
<<
usource
;
return
;
}
_firmwareType
=
usource
->
_firmwareType
;
_sendStatusText
=
usource
->
_sendStatusText
;
}
void
MockConfiguration
::
saveSettings
(
QSettings
&
settings
,
const
QString
&
root
)
{
settings
.
beginGroup
(
root
);
settings
.
setValue
(
_firmwareTypeKey
,
(
int
)
_firmwareType
);
settings
.
setValue
(
_sendStatusTextKey
,
_sendStatusText
);
settings
.
sync
();
settings
.
endGroup
();
}
...
...
@@ -780,6 +828,7 @@ void MockConfiguration::loadSettings(QSettings& settings, const QString& root)
{
settings
.
beginGroup
(
root
);
_firmwareType
=
(
MAV_AUTOPILOT
)
settings
.
value
(
_firmwareTypeKey
,
(
int
)
MAV_AUTOPILOT_PX4
).
toInt
();
_sendStatusText
=
settings
.
value
(
_sendStatusTextKey
,
false
).
toBool
();
settings
.
endGroup
();
}
...
...
@@ -789,7 +838,7 @@ void MockConfiguration::updateSettings()
MockLink
*
ulink
=
dynamic_cast
<
MockLink
*>
(
_link
);
if
(
ulink
)
{
// Restart connect not supported
Q_ASSERT
(
false
)
;
qWarning
()
<<
"updateSettings not supported"
;
//ulink->_restartConnection();
}
}
...
...
src/comm/MockLink.h
View file @
7664ce33
...
...
@@ -44,6 +44,10 @@ public:
MAV_AUTOPILOT
firmwareType
(
void
)
{
return
_firmwareType
;
}
void
setFirmwareType
(
MAV_AUTOPILOT
firmwareType
)
{
_firmwareType
=
firmwareType
;
}
/// @param sendStatusText true: mavlink status text messages will be sent for each severity, as well as voice output info message
void
setSendStatusText
(
bool
sendStatusText
)
{
_sendStatusText
=
sendStatusText
;
}
bool
sendStatusText
(
void
)
{
return
_sendStatusText
;
}
// Overrides from LinkConfiguration
int
type
(
void
)
{
return
LinkConfiguration
::
TypeMock
;
}
void
copyFrom
(
LinkConfiguration
*
source
);
...
...
@@ -52,9 +56,11 @@ public:
void
updateSettings
(
void
);
private:
MAV_AUTOPILOT
_firmwareType
;
MAV_AUTOPILOT
_firmwareType
;
bool
_sendStatusText
;
static
const
char
*
_firmwareTypeKey
;
static
const
char
*
_sendStatusTextKey
;
};
class
MockLink
:
public
LinkInterface
...
...
@@ -70,6 +76,7 @@ public:
int
vehicleId
(
void
)
{
return
_vehicleSystemId
;
}
MAV_AUTOPILOT
getAutopilotType
(
void
)
{
return
_autopilotType
;
}
void
setAutopilotType
(
MAV_AUTOPILOT
autopilot
)
{
_autopilotType
=
autopilot
;
}
void
setSendStatusText
(
bool
sendStatusText
)
{
_sendStatusText
=
sendStatusText
;
}
void
emitRemoteControlChannelRawChanged
(
int
channel
,
uint16_t
raw
);
/// Sends the specified mavlink message to QGC
...
...
@@ -149,6 +156,7 @@ private:
void
_setParamFloatUnionIntoMap
(
int
componentId
,
const
QString
&
paramName
,
float
paramFloat
);
void
_sendHomePosition
(
void
);
void
_sendGpsRawInt
(
void
);
void
_sendStatusTextMessages
(
void
);
MockLinkMissionItemHandler
_missionItemHandler
;
...
...
@@ -173,6 +181,8 @@ private:
MockLinkFileServer
*
_fileServer
;
bool
_sendStatusText
;
static
float
_vehicleLatitude
;
static
float
_vehicleLongitude
;
static
float
_vehicleAltitude
;
...
...
src/ui/MainWindow.qml
View file @
7664ce33
...
...
@@ -82,6 +82,21 @@ Item {
toolbarLoader
.
source
=
"
MainToolBar.qml
"
}
// Detect tablet position
property
var
tabletPosition
:
QtPositioning
.
coordinate
(
37.803784
,
-
122.462276
)
PositionSource
{
id
:
positionSource
updateInterval
:
1000
active
:
ScreenTools
.
isMobile
onPositionChanged
:
{
tabletPosition
=
positionSource
.
position
.
coordinate
_root
.
latitude
=
tabletPosition
.
latitude
_root
.
longitude
=
tabletPosition
.
longitude
positionSource
.
active
=
false
}
}
Loader
{
id
:
toolbarLoader
width
:
parent
.
width
...
...
@@ -105,6 +120,8 @@ Item {
anchors.top
:
toolbarLoader
.
bottom
anchors.bottom
:
parent
.
bottom
visible
:
false
property
var
tabletPosition
:
_root
.
tabletPosition
}
Loader
{
...
...
@@ -114,5 +131,7 @@ Item {
anchors.top
:
toolbarLoader
.
bottom
anchors.bottom
:
parent
.
bottom
visible
:
false
property
var
tabletPosition
:
_root
.
tabletPosition
}
}
src/ui/MockLinkConfiguration.cc
View file @
7664ce33
...
...
@@ -43,9 +43,12 @@ MockLinkConfiguration::MockLinkConfiguration(MockConfiguration *config, QWidget
break
;
}
connect
(
_ui
->
px4Radio
,
&
QRadioButton
::
clicked
,
this
,
&
MockLinkConfiguration
::
_px4RadioClicked
);
connect
(
_ui
->
apmRadio
,
&
QRadioButton
::
clicked
,
this
,
&
MockLinkConfiguration
::
_apmRadioClicked
);
connect
(
_ui
->
genericRadio
,
&
QRadioButton
::
clicked
,
this
,
&
MockLinkConfiguration
::
_genericRadioClicked
);
_ui
->
sendStatusTextCheckBox
->
setChecked
(
config
->
sendStatusText
());
connect
(
_ui
->
px4Radio
,
&
QRadioButton
::
clicked
,
this
,
&
MockLinkConfiguration
::
_px4RadioClicked
);
connect
(
_ui
->
apmRadio
,
&
QRadioButton
::
clicked
,
this
,
&
MockLinkConfiguration
::
_apmRadioClicked
);
connect
(
_ui
->
genericRadio
,
&
QRadioButton
::
clicked
,
this
,
&
MockLinkConfiguration
::
_genericRadioClicked
);
connect
(
_ui
->
sendStatusTextCheckBox
,
&
QCheckBox
::
clicked
,
this
,
&
MockLinkConfiguration
::
_sendStatusTextClicked
);
}
MockLinkConfiguration
::~
MockLinkConfiguration
()
...
...
@@ -73,3 +76,8 @@ void MockLinkConfiguration::_genericRadioClicked(bool checked)
_config
->
setFirmwareType
(
MAV_AUTOPILOT_GENERIC
);
}
}
void
MockLinkConfiguration
::
_sendStatusTextClicked
(
bool
checked
)
{
_config
->
setSendStatusText
(
checked
);
}
src/ui/MockLinkConfiguration.h
View file @
7664ce33
...
...
@@ -44,6 +44,7 @@ private slots:
void
_px4RadioClicked
(
bool
checked
);
void
_apmRadioClicked
(
bool
checked
);
void
_genericRadioClicked
(
bool
checked
);
void
_sendStatusTextClicked
(
bool
checked
);
private:
Ui
::
MockLinkConfiguration
*
_ui
;
...
...
src/ui/MockLinkConfiguration.ui
View file @
7664ce33
...
...
@@ -35,6 +35,13 @@
</property>
</widget>
</item>
<item>
<widget
class=
"QCheckBox"
name=
"sendStatusTextCheckBox"
>
<property
name=
"text"
>
<string>
Send status text + voice
</string>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
...
...
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