Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Q
qgroundcontrol
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Valentin Platzgummer
qgroundcontrol
Commits
9082fac0
Commit
9082fac0
authored
9 years ago
by
Don Gagne
Browse files
Options
Downloads
Patches
Plain Diff
Show home position on flight map
parent
837de8bb
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/FlightDisplay/FlightDisplayView.qml
+8
-0
8 additions, 0 deletions
src/FlightDisplay/FlightDisplayView.qml
src/Vehicle/Vehicle.cc
+29
-0
29 additions, 0 deletions
src/Vehicle/Vehicle.cc
src/Vehicle/Vehicle.h
+11
-0
11 additions, 0 deletions
src/Vehicle/Vehicle.h
with
48 additions
and
0 deletions
src/FlightDisplay/FlightDisplayView.qml
+
8
−
0
View file @
9082fac0
...
...
@@ -26,6 +26,7 @@ import QtQuick.Controls 1.3
import
QtQuick
.
Controls
.
Styles
1.2
import
QtQuick
.
Dialogs
1.2
import
QtLocation
5.3
import
QtPositioning
5.2
import
QGroundControl
.
FlightMap
1.0
import
QGroundControl
.
ScreenTools
1.0
...
...
@@ -92,6 +93,13 @@ Item {
longitude
:
parent
.
_longitude
visible
:
_showMap
// Home position
MissionItemIndicator
{
label
:
"
H
"
coordinate
:
(
_activeVehicle
&&
_activeVehicle
.
homePositionAvailable
)
?
_activeVehicle
.
homePosition
:
QtPositioning
.
coordinate
(
0
,
0
)
visible
:
_activeVehicle
?
_activeVehicle
.
homePositionAvailable
:
false
}
// Add the vehicles to the map
MapItemView
{
model
:
multiVehicleManager
.
vehicles
...
...
This diff is collapsed.
Click to expand it.
src/Vehicle/Vehicle.cc
+
29
−
0
View file @
9082fac0
...
...
@@ -51,6 +51,7 @@ Vehicle::Vehicle(LinkInterface* link, int vehicleId, MAV_AUTOPILOT firmwareType)
,
_joystickMode
(
JoystickModeRC
)
,
_joystickEnabled
(
false
)
,
_uas
(
NULL
)
,
_homePositionAvailable
(
false
)
,
_mav
(
NULL
)
,
_currentMessageCount
(
0
)
,
_messageCount
(
0
)
...
...
@@ -203,6 +204,20 @@ void Vehicle::_mavlinkMessageReceived(LinkInterface* link, mavlink_message_t mes
// Give the plugin a change to adjust the message contents
_firmwarePlugin
->
adjustMavlinkMessage
(
&
message
);
if
(
message
.
msgid
==
MAVLINK_MSG_ID_HOME_POSITION
)
{
mavlink_home_position_t
homePos
;
mavlink_msg_home_position_decode
(
&
message
,
&
homePos
);
_homePosition
.
setLatitude
(
homePos
.
latitude
/
10000000.0
);
_homePosition
.
setLongitude
(
homePos
.
longitude
/
10000000.0
);
_homePosition
.
setAltitude
(
homePos
.
altitude
/
1000.0
);
_homePositionAvailable
=
true
;
emit
homePositionAvailableChanged
(
true
);
emit
homePositionChanged
(
_homePosition
);
}
emit
mavlinkMessageReceived
(
message
);
_uas
->
receiveMessage
(
message
);
...
...
@@ -945,3 +960,17 @@ QmlObjectListModel* Vehicle::missionItemsModel(void)
return
&
_missionItems
;
}
}
bool
Vehicle
::
homePositionAvailable
(
void
)
{
return
_homePositionAvailable
;
}
QGeoCoordinate
Vehicle
::
homePosition
(
void
)
{
if
(
!
_homePositionAvailable
)
{
qWarning
()
<<
"Call to homePosition while _homePositionAvailable == false"
;
}
return
_homePosition
;
}
This diff is collapsed.
Click to expand it.
src/Vehicle/Vehicle.h
+
11
−
0
View file @
9082fac0
...
...
@@ -59,6 +59,9 @@ public:
Q_PROPERTY
(
QGeoCoordinate
coordinate
MEMBER
_geoCoordinate
NOTIFY
coordinateChanged
)
Q_PROPERTY
(
MissionManager
*
missionManager
MEMBER
_missionManager
CONSTANT
)
Q_PROPERTY
(
bool
homePositionAvailable
READ
homePositionAvailable
NOTIFY
homePositionAvailableChanged
)
Q_PROPERTY
(
QGeoCoordinate
homePosition
READ
homePosition
NOTIFY
homePositionChanged
)
Q_INVOKABLE
QString
getMavIconColor
();
//-- System Messages
...
...
@@ -154,6 +157,9 @@ public:
MissionManager
*
missionManager
(
void
)
{
return
_missionManager
;
}
bool
homePositionAvailable
(
void
);
QGeoCoordinate
homePosition
(
void
);
typedef
enum
{
MessageNone
,
MessageNormal
,
...
...
@@ -221,6 +227,8 @@ signals:
void
joystickEnabledChanged
(
bool
enabled
);
void
activeChanged
(
bool
active
);
void
mavlinkMessageReceived
(
const
mavlink_message_t
&
message
);
void
homePositionAvailableChanged
(
bool
homePositionAvailable
);
void
homePositionChanged
(
const
QGeoCoordinate
&
homePosition
);
/// Used internally to move sendMessage call to main thread
void
_sendMessageOnThread
(
mavlink_message_t
message
);
...
...
@@ -318,6 +326,9 @@ private:
QGeoCoordinate
_geoCoordinate
;
bool
_homePositionAvailable
;
QGeoCoordinate
_homePosition
;
UASInterface
*
_mav
;
int
_currentMessageCount
;
int
_messageCount
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment