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
9e967dc9
Commit
9e967dc9
authored
Sep 26, 2015
by
Don Gagne
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1893 from DonLakeFlyer/HomePositionManager
Home position manager
parents
837de8bb
143bb616
Changes
13
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
556 additions
and
181 deletions
+556
-181
QGCApplication.pro
QGCApplication.pro
+2
-0
HomePositionManager.cc
src/HomePositionManager.cc
+119
-66
HomePositionManager.h
src/HomePositionManager.h
+69
-51
MissionEditor.qml
src/MissionEditor/MissionEditor.qml
+245
-50
QGCApplication.cc
src/QGCApplication.cc
+19
-10
QGroundControlQmlGlobal.cc
src/QmlControls/QGroundControlQmlGlobal.cc
+39
-0
QGroundControlQmlGlobal.h
src/QmlControls/QGroundControlQmlGlobal.h
+52
-0
QmlObjectListModel.cc
src/QmlControls/QmlObjectListModel.cc
+4
-0
QmlObjectListModel.h
src/QmlControls/QmlObjectListModel.h
+1
-0
QGCFlightGearLink.cc
src/comm/QGCFlightGearLink.cc
+1
-0
QGCXPlaneLink.cc
src/comm/QGCXPlaneLink.cc
+4
-1
UAS.cc
src/uas/UAS.cc
+1
-2
MainWindow.cc
src/ui/MainWindow.cc
+0
-1
No files found.
QGCApplication.pro
View file @
9e967dc9
...
...
@@ -264,6 +264,7 @@ HEADERS += \
src
/
QmlControls
/
MavlinkQmlSingleton
.
h
\
src
/
QmlControls
/
ParameterEditorController
.
h
\
src
/
QmlControls
/
ScreenToolsController
.
h
\
src
/
QmlControls
/
QGroundControlQmlGlobal
.
h
\
src
/
QmlControls
/
QmlObjectListModel
.
h
\
src
/
SerialPortIds
.
h
\
src
/
uas
/
FileManager
.
h
\
...
...
@@ -394,6 +395,7 @@ SOURCES += \
src
/
QGCTemporaryFile
.
cc
\
src
/
QmlControls
/
ParameterEditorController
.
cc
\
src
/
QmlControls
/
ScreenToolsController
.
cc
\
src
/
QmlControls
/
QGroundControlQmlGlobal
.
cc
\
src
/
QmlControls
/
QmlObjectListModel
.
cc
\
src
/
uas
/
FileManager
.
cc
\
src
/
uas
/
UAS
.
cc
\
...
...
src/HomePositionManager.cc
View file @
9e967dc9
...
...
@@ -40,24 +40,47 @@
IMPLEMENT_QGC_SINGLETON
(
HomePositionManager
,
HomePositionManager
)
HomePositionManager
::
HomePositionManager
(
QObject
*
parent
)
:
QObject
(
parent
),
homeLat
(
47.3769
),
homeLon
(
8.549444
),
homeAlt
(
470.0
),
homeFrame
(
MAV_FRAME_GLOBAL
)
const
char
*
HomePositionManager
::
_settingsGroup
=
"HomePositionManager"
;
const
char
*
HomePositionManager
::
_latitudeKey
=
"Latitude"
;
const
char
*
HomePositionManager
::
_longitudeKey
=
"Longitude"
;
const
char
*
HomePositionManager
::
_altitudeKey
=
"Altitude"
;
HomePositionManager
::
HomePositionManager
(
QObject
*
parent
)
:
QObject
(
parent
)
,
homeLat
(
47.3769
)
,
homeLon
(
8.549444
)
,
homeAlt
(
470.0
)
{
loadSettings
();
_
loadSettings
();
}
HomePositionManager
::~
HomePositionManager
()
{
storeSettings
();
}
void
HomePositionManager
::
storeSettings
(
)
void
HomePositionManager
::
_storeSettings
(
void
)
{
QSettings
settings
;
settings
.
remove
(
_settingsGroup
);
settings
.
beginGroup
(
_settingsGroup
);
for
(
int
i
=
0
;
i
<
_homePositions
.
count
();
i
++
)
{
HomePosition
*
homePos
=
qobject_cast
<
HomePosition
*>
(
_homePositions
[
i
]);
qDebug
()
<<
"Saving"
<<
homePos
->
name
();
settings
.
beginGroup
(
homePos
->
name
());
settings
.
setValue
(
_latitudeKey
,
homePos
->
coordinate
().
latitude
());
settings
.
setValue
(
_longitudeKey
,
homePos
->
coordinate
().
longitude
());
settings
.
setValue
(
_altitudeKey
,
homePos
->
coordinate
().
altitude
());
settings
.
endGroup
();
}
settings
.
endGroup
();
// Deprecated settings for old editor
settings
.
beginGroup
(
"QGC_UASMANAGER"
);
settings
.
setValue
(
"HOMELAT"
,
homeLat
);
settings
.
setValue
(
"HOMELON"
,
homeLon
);
...
...
@@ -65,9 +88,36 @@ void HomePositionManager::storeSettings()
settings
.
endGroup
();
}
void
HomePositionManager
::
loadSettings
(
)
void
HomePositionManager
::
_loadSettings
(
void
)
{
QSettings
settings
;
_homePositions
.
clear
();
settings
.
beginGroup
(
_settingsGroup
);
foreach
(
QString
name
,
settings
.
childGroups
())
{
QGeoCoordinate
coordinate
;
qDebug
()
<<
"Load setting"
<<
name
;
settings
.
beginGroup
(
name
);
coordinate
.
setLatitude
(
settings
.
value
(
_latitudeKey
).
toDouble
());
coordinate
.
setLongitude
(
settings
.
value
(
_longitudeKey
).
toDouble
());
coordinate
.
setAltitude
(
settings
.
value
(
_altitudeKey
).
toDouble
());
settings
.
endGroup
();
_homePositions
.
append
(
new
HomePosition
(
name
,
coordinate
,
this
));
}
settings
.
endGroup
();
if
(
_homePositions
.
count
()
==
0
)
{
_homePositions
.
append
(
new
HomePosition
(
"ETH Campus"
,
QGeoCoordinate
(
47.3769
,
8.549444
,
470.0
)));
}
// Deprecated settings for old editor
settings
.
beginGroup
(
"QGC_UASMANAGER"
);
bool
changed
=
setHomePosition
(
settings
.
value
(
"HOMELAT"
,
homeLat
).
toDouble
(),
settings
.
value
(
"HOMELON"
,
homeLon
).
toDouble
(),
...
...
@@ -97,9 +147,6 @@ bool HomePositionManager::setHomePosition(double lat, double lon, double alt)
if
(
fabs
(
homeLon
-
lon
)
>
1e-7
)
changed
=
true
;
if
(
fabs
(
homeAlt
-
alt
)
>
0.5
f
)
changed
=
true
;
// Initialize conversion reference in any case
initReference
(
lat
,
lon
,
alt
);
if
(
changed
)
{
homeLat
=
lat
;
...
...
@@ -125,75 +172,81 @@ bool HomePositionManager::setHomePositionAndNotify(double lat, double lon, doubl
return
changed
;
}
void
HomePositionManager
::
initReference
(
const
double
&
latitude
,
const
double
&
longitude
,
const
double
&
altitud
e
)
void
HomePositionManager
::
updateHomePosition
(
const
QString
&
name
,
const
QGeoCoordinate
&
coordinat
e
)
{
Eigen
::
Matrix3d
R
;
double
s_long
,
s_lat
,
c_long
,
c_lat
;
sincos
(
latitude
*
DEG2RAD
,
&
s_lat
,
&
c_lat
);
sincos
(
longitude
*
DEG2RAD
,
&
s_long
,
&
c_long
);
R
(
0
,
0
)
=
-
s_long
;
R
(
0
,
1
)
=
c_long
;
R
(
0
,
2
)
=
0
;
R
(
1
,
0
)
=
-
s_lat
*
c_long
;
R
(
1
,
1
)
=
-
s_lat
*
s_long
;
R
(
1
,
2
)
=
c_lat
;
R
(
2
,
0
)
=
c_lat
*
c_long
;
R
(
2
,
1
)
=
c_lat
*
s_long
;
R
(
2
,
2
)
=
s_lat
;
ecef_ref_orientation_
=
Eigen
::
Quaterniond
(
R
);
ecef_ref_point_
=
wgs84ToEcef
(
latitude
,
longitude
,
altitude
);
HomePosition
*
homePos
=
NULL
;
for
(
int
i
=
0
;
i
<
_homePositions
.
count
();
i
++
)
{
homePos
=
qobject_cast
<
HomePosition
*>
(
_homePositions
[
i
]);
if
(
homePos
->
name
()
==
name
)
{
break
;
}
homePos
=
NULL
;
}
if
(
homePos
==
NULL
)
{
HomePosition
*
homePos
=
new
HomePosition
(
name
,
coordinate
,
this
);
_homePositions
.
append
(
homePos
);
}
else
{
homePos
->
setName
(
name
);
homePos
->
setCoordinate
(
coordinate
);
}
_storeSettings
();
}
Eigen
::
Vector3d
HomePositionManager
::
wgs84ToEcef
(
const
double
&
latitude
,
const
double
&
longitude
,
const
double
&
altitud
e
)
void
HomePositionManager
::
deleteHomePosition
(
const
QString
&
nam
e
)
{
const
double
a
=
6378137.0
;
// semi-major axis
const
double
e_sq
=
6.69437999014e-3
;
// first eccentricity squared
double
s_long
,
s_lat
,
c_long
,
c_lat
;
sincos
(
latitude
*
DEG2RAD
,
&
s_lat
,
&
c_lat
);
sincos
(
longitude
*
DEG2RAD
,
&
s_long
,
&
c_long
);
const
double
N
=
a
/
sqrt
(
1
-
e_sq
*
s_lat
*
s_lat
);
Eigen
::
Vector3d
ecef
;
ecef
[
0
]
=
(
N
+
altitude
)
*
c_lat
*
c_long
;
ecef
[
1
]
=
(
N
+
altitude
)
*
c_lat
*
s_long
;
ecef
[
2
]
=
(
N
*
(
1
-
e_sq
)
+
altitude
)
*
s_lat
;
// Don't allow delete of last position
if
(
_homePositions
.
count
()
==
1
)
{
return
;
}
qDebug
()
<<
"Attempting delete"
<<
name
;
for
(
int
i
=
0
;
i
<
_homePositions
.
count
();
i
++
)
{
if
(
qobject_cast
<
HomePosition
*>
(
_homePositions
[
i
])
->
name
()
==
name
)
{
qDebug
()
<<
"Deleting"
<<
name
;
_homePositions
.
removeAt
(
i
);
break
;
}
}
_storeSettings
();
}
return
ecef
;
HomePosition
::
HomePosition
(
const
QString
&
name
,
const
QGeoCoordinate
&
coordinate
,
QObject
*
parent
)
:
QObject
(
parent
)
,
_coordinate
(
coordinate
)
{
setObjectName
(
name
);
}
Eigen
::
Vector3d
HomePositionManager
::
ecefToEnu
(
const
Eigen
::
Vector3d
&
ecef
)
HomePosition
::~
HomePosition
(
)
{
return
ecef_ref_orientation_
*
(
ecef
-
ecef_ref_point_
);
}
void
HomePositionManager
::
wgs84ToEnu
(
const
double
&
lat
,
const
double
&
lon
,
const
double
&
alt
,
double
*
east
,
double
*
north
,
double
*
up
)
QString
HomePosition
::
name
(
void
)
{
Eigen
::
Vector3d
ecef
=
wgs84ToEcef
(
lat
,
lon
,
alt
);
Eigen
::
Vector3d
enu
=
ecefToEnu
(
ecef
);
*
east
=
enu
.
x
();
*
north
=
enu
.
y
();
*
up
=
enu
.
z
();
return
objectName
();
}
void
HomePosition
Manager
::
enuToWgs84
(
const
double
&
x
,
const
double
&
y
,
const
double
&
z
,
double
*
lat
,
double
*
lon
,
double
*
alt
)
void
HomePosition
::
setName
(
const
QString
&
name
)
{
*
lat
=
homeLat
+
y
/
MEAN_EARTH_DIAMETER
*
360.
/
PI
;
*
lon
=
homeLon
+
x
/
MEAN_EARTH_DIAMETER
*
360.
/
PI
/
cos
(
homeLat
*
UMR
);
*
alt
=
homeAlt
+
z
;
setObjectName
(
name
)
;
HomePositionManager
::
instance
()
->
_storeSettings
(
);
emit
nameChanged
(
name
)
;
}
void
HomePositionManager
::
nedToWgs84
(
const
double
&
x
,
const
double
&
y
,
const
double
&
z
,
double
*
lat
,
double
*
lon
,
double
*
alt
)
QGeoCoordinate
HomePosition
::
coordinate
(
void
)
{
*
lat
=
homeLat
+
x
/
MEAN_EARTH_DIAMETER
*
360.
/
PI
;
*
lon
=
homeLon
+
y
/
MEAN_EARTH_DIAMETER
*
360.
/
PI
/
cos
(
homeLat
*
UMR
);
*
alt
=
homeAlt
-
z
;
return
_coordinate
;
}
void
HomePosition
::
setCoordinate
(
const
QGeoCoordinate
&
coordinate
)
{
_coordinate
=
coordinate
;
HomePositionManager
::
instance
()
->
_storeSettings
();
emit
coordinateChanged
(
coordinate
);
}
src/HomePositionManager.h
View file @
9e967dc9
...
...
@@ -21,21 +21,41 @@ This file is part of the QGROUNDCONTROL project
======================================================================*/
#ifndef
_UASMANAGER_H_
#define
_UASMANAGER_H_
#ifndef
HomePositionManager_H
#define
HomePositionManager_H
#include "UASInterface.h"
#include <QList>
#include <QMutex>
#include "QGCSingleton.h"
#include "QmlObjectListModel.h"
#include <
Eigen/Eigen
>
#include <
QGeoCoordinate
>
#include "QGCGeo.h"
#include "QGCSingleton.h"
class
HomePosition
:
public
QObject
{
Q_OBJECT
public:
HomePosition
(
const
QString
&
name
,
const
QGeoCoordinate
&
coordinate
,
QObject
*
parent
=
NULL
);
~
HomePosition
();
Q_PROPERTY
(
QString
name
READ
name
WRITE
setName
NOTIFY
nameChanged
)
Q_PROPERTY
(
QGeoCoordinate
coordinate
READ
coordinate
WRITE
setCoordinate
NOTIFY
coordinateChanged
)
// Property accessors
QString
name
(
void
);
void
setName
(
const
QString
&
name
);
QGeoCoordinate
coordinate
(
void
);
void
setCoordinate
(
const
QGeoCoordinate
&
coordinate
);
signals:
void
nameChanged
(
const
QString
&
name
);
void
coordinateChanged
(
const
QGeoCoordinate
&
coordinate
);
private:
QGeoCoordinate
_coordinate
;
};
/// Manages an offline home position as well as performance coordinate transformations
/// around a home position.
class
HomePositionManager
:
public
QObject
{
Q_OBJECT
...
...
@@ -43,6 +63,40 @@ class HomePositionManager : public QObject
DECLARE_QGC_SINGLETON
(
HomePositionManager
,
HomePositionManager
)
public:
Q_PROPERTY
(
QmlObjectListModel
*
homePositions
READ
homePositions
CONSTANT
)
/// If name is not already a home position a new one will be added, otherwise the existing
/// home position will be updated
Q_INVOKABLE
void
updateHomePosition
(
const
QString
&
name
,
const
QGeoCoordinate
&
coordinate
);
Q_INVOKABLE
void
deleteHomePosition
(
const
QString
&
name
);
// Property accesors
QmlObjectListModel
*
homePositions
(
void
)
{
return
&
_homePositions
;
}
// Should only be called by HomePosition
void
_storeSettings
(
void
);
private:
/// @brief All access to HomePositionManager singleton is through HomePositionManager::instance
HomePositionManager
(
QObject
*
parent
=
NULL
);
~
HomePositionManager
();
void
_loadSettings
(
void
);
QmlObjectListModel
_homePositions
;
static
const
char
*
_settingsGroup
;
static
const
char
*
_latitudeKey
;
static
const
char
*
_longitudeKey
;
static
const
char
*
_altitudeKey
;
// Everything below is deprecated and will be removed once old Map code is removed
public:
// Deprecated methods
/** @brief Get home position latitude */
double
getHomeLatitude
()
const
{
return
homeLat
;
...
...
@@ -56,24 +110,10 @@ public:
return
homeAlt
;
}
/** @brief Get the home position coordinate frame */
int
getHomeFrame
()
const
{
return
homeFrame
;
}
/** @brief Convert WGS84 coordinates to earth centric frame */
Eigen
::
Vector3d
wgs84ToEcef
(
const
double
&
latitude
,
const
double
&
longitude
,
const
double
&
altitude
);
/** @brief Convert earth centric frame to EAST-NORTH-UP frame (x-y-z directions */
Eigen
::
Vector3d
ecefToEnu
(
const
Eigen
::
Vector3d
&
ecef
);
/** @brief Convert WGS84 lat/lon coordinates to carthesian coordinates with home position as origin */
void
wgs84ToEnu
(
const
double
&
lat
,
const
double
&
lon
,
const
double
&
alt
,
double
*
east
,
double
*
north
,
double
*
up
);
/** @brief Convert x,y,z coordinates to lat / lon / alt coordinates in east-north-up frame */
void
enuToWgs84
(
const
double
&
x
,
const
double
&
y
,
const
double
&
z
,
double
*
lat
,
double
*
lon
,
double
*
alt
);
/** @brief Convert x,y,z coordinates to lat / lon / alt coordinates in north-east-down frame */
void
nedToWgs84
(
const
double
&
x
,
const
double
&
y
,
const
double
&
z
,
double
*
lat
,
double
*
lon
,
double
*
alt
);
public
slots
:
// Deprecated methods
/** @brief Set the current home position, but do not change it on the UAVs */
bool
setHomePosition
(
double
lat
,
double
lon
,
double
alt
);
...
...
@@ -81,11 +121,6 @@ public slots:
bool
setHomePositionAndNotify
(
double
lat
,
double
lon
,
double
alt
);
/** @brief Load settings */
void
loadSettings
();
/** @brief Store settings */
void
storeSettings
();
signals:
/** @brief Current home position changed */
void
homePositionChanged
(
double
lat
,
double
lon
,
double
alt
);
...
...
@@ -94,23 +129,6 @@ protected:
double
homeLat
;
double
homeLon
;
double
homeAlt
;
int
homeFrame
;
Eigen
::
Quaterniond
ecef_ref_orientation_
;
Eigen
::
Vector3d
ecef_ref_point_
;
void
initReference
(
const
double
&
latitude
,
const
double
&
longitude
,
const
double
&
altitude
);
private:
/// @brief All access to HomePositionManager singleton is through HomePositionManager::instance
HomePositionManager
(
QObject
*
parent
=
NULL
);
~
HomePositionManager
();
public:
/* Need to align struct pointer to prevent a memory assertion:
* See http://eigen.tuxfamily.org/dox-devel/TopicUnalignedArrayAssert.html
* for details
*/
EIGEN_MAKE_ALIGNED_OPERATOR_NEW
};
#endif
// _UASMANAGER_H_
#endif
src/MissionEditor/MissionEditor.qml
View file @
9e967dc9
This diff is collapsed.
Click to expand it.
src/QGCApplication.cc
View file @
9e967dc9
...
...
@@ -81,6 +81,8 @@
#include "JoystickManager.h"
#include "QmlObjectListModel.h"
#include "MissionManager.h"
#include "QGroundControlQmlGlobal.h"
#include "HomePositionManager.h"
#ifndef __ios__
#include "SerialLink.h"
...
...
@@ -125,6 +127,11 @@ static QObject* mavlinkQmlSingletonFactory(QQmlEngine*, QJSEngine*)
return
new
MavlinkQmlSingleton
;
}
static
QObject
*
qgroundcontrolQmlGlobalSingletonFactory
(
QQmlEngine
*
,
QJSEngine
*
)
{
return
new
QGroundControlQmlGlobal
;
}
#if defined(QGC_GST_STREAMING)
#ifdef Q_OS_MAC
#ifndef __ios__
...
...
@@ -298,14 +305,15 @@ void QGCApplication::_initCommon(void)
qmlRegisterType
<
QGCPalette
>
(
"QGroundControl.Palette"
,
1
,
0
,
"QGCPalette"
);
qmlRegisterUncreatableType
<
AutoPilotPlugin
>
(
"QGroundControl.AutoPilotPlugin"
,
1
,
0
,
"AutoPilotPlugin"
,
"Can only reference, cannot create"
);
qmlRegisterUncreatableType
<
VehicleComponent
>
(
"QGroundControl.AutoPilotPlugin"
,
1
,
0
,
"VehicleComponent"
,
"Can only reference, cannot create"
);
qmlRegisterUncreatableType
<
Vehicle
>
(
"QGroundControl.Vehicle"
,
1
,
0
,
"Vehicle"
,
"Can only reference, cannot create"
);
qmlRegisterUncreatableType
<
MissionItem
>
(
"QGroundControl.Vehicle"
,
1
,
0
,
"MissionItem"
,
"Can only reference, cannot create"
);
qmlRegisterUncreatableType
<
MissionManager
>
(
"QGroundControl.Vehicle"
,
1
,
0
,
"MissionManager"
,
"Can only reference, cannot create"
);
qmlRegisterUncreatableType
<
JoystickManager
>
(
"QGroundControl.JoystickManager"
,
1
,
0
,
"JoystickManager"
,
"Reference only"
);
qmlRegisterUncreatableType
<
Joystick
>
(
"QGroundControl.JoystickManager"
,
1
,
0
,
"Joystick"
,
"Reference only"
);
qmlRegisterUncreatableType
<
QmlObjectListModel
>
(
"QGroundControl"
,
1
,
0
,
"QmlObjectListModel"
,
"Reference only"
);
qmlRegisterUncreatableType
<
AutoPilotPlugin
>
(
"QGroundControl.AutoPilotPlugin"
,
1
,
0
,
"AutoPilotPlugin"
,
"Reference only"
);
qmlRegisterUncreatableType
<
VehicleComponent
>
(
"QGroundControl.AutoPilotPlugin"
,
1
,
0
,
"VehicleComponent"
,
"Reference only"
);
qmlRegisterUncreatableType
<
Vehicle
>
(
"QGroundControl.Vehicle"
,
1
,
0
,
"Vehicle"
,
"Reference only"
);
qmlRegisterUncreatableType
<
MissionItem
>
(
"QGroundControl.Vehicle"
,
1
,
0
,
"MissionItem"
,
"Reference only"
);
qmlRegisterUncreatableType
<
MissionManager
>
(
"QGroundControl.Vehicle"
,
1
,
0
,
"MissionManager"
,
"Reference only"
);
qmlRegisterUncreatableType
<
JoystickManager
>
(
"QGroundControl.JoystickManager"
,
1
,
0
,
"JoystickManager"
,
"Reference only"
);
qmlRegisterUncreatableType
<
Joystick
>
(
"QGroundControl.JoystickManager"
,
1
,
0
,
"Joystick"
,
"Reference only"
);
qmlRegisterUncreatableType
<
QmlObjectListModel
>
(
"QGroundControl"
,
1
,
0
,
"QmlObjectListModel"
,
"Reference only"
);
qmlRegisterUncreatableType
<
HomePositionManager
>
(
"QGroundControl"
,
1
,
0
,
"HomePositionManager"
,
"Reference only"
);
qmlRegisterType
<
ViewWidgetController
>
(
"QGroundControl.Controllers"
,
1
,
0
,
"ViewWidgetController"
);
qmlRegisterType
<
ParameterEditorController
>
(
"QGroundControl.Controllers"
,
1
,
0
,
"ParameterEditorController"
);
...
...
@@ -323,8 +331,9 @@ void QGCApplication::_initCommon(void)
#endif
// Register Qml Singletons
qmlRegisterSingletonType
<
ScreenToolsController
>
(
"QGroundControl.ScreenToolsController"
,
1
,
0
,
"ScreenToolsController"
,
screenToolsControllerSingletonFactory
);
qmlRegisterSingletonType
<
MavlinkQmlSingleton
>
(
"QGroundControl.Mavlink"
,
1
,
0
,
"Mavlink"
,
mavlinkQmlSingletonFactory
);
qmlRegisterSingletonType
<
QGroundControlQmlGlobal
>
(
"QGroundControl"
,
1
,
0
,
"QGroundControl"
,
qgroundcontrolQmlGlobalSingletonFactory
);
qmlRegisterSingletonType
<
ScreenToolsController
>
(
"QGroundControl.ScreenToolsController"
,
1
,
0
,
"ScreenToolsController"
,
screenToolsControllerSingletonFactory
);
qmlRegisterSingletonType
<
MavlinkQmlSingleton
>
(
"QGroundControl.Mavlink"
,
1
,
0
,
"Mavlink"
,
mavlinkQmlSingletonFactory
);
// Show user an upgrade message if the settings version has been bumped up
bool
settingsUpgraded
=
false
;
...
...
src/QmlControls/QGroundControlQmlGlobal.cc
0 → 100644
View file @
9e967dc9
/*=====================================================================
QGroundControl Open Source Ground Control Station
(c) 2009 - 2014 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
This file is part of the QGROUNDCONTROL project
QGROUNDCONTROL is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
QGROUNDCONTROL is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with QGROUNDCONTROL. If not, see <http://www.gnu.org/licenses/>.
======================================================================*/
/// @file
/// @author Don Gagne <don@thegagnes.com>
#include "QGroundControlQmlGlobal.h"
QGroundControlQmlGlobal
::
QGroundControlQmlGlobal
(
QObject
*
parent
)
:
QObject
(
parent
)
,
_homePositionManager
(
HomePositionManager
::
instance
())
{
}
QGroundControlQmlGlobal
::~
QGroundControlQmlGlobal
()
{
}
src/QmlControls/QGroundControlQmlGlobal.h
0 → 100644
View file @
9e967dc9
/*=====================================================================
QGroundControl Open Source Ground Control Station
(c) 2009 - 2014 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
This file is part of the QGROUNDCONTROL project
QGROUNDCONTROL is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
QGROUNDCONTROL is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with QGROUNDCONTROL. If not, see <http://www.gnu.org/licenses/>.
======================================================================*/
/// @file
/// @author Don Gagne <don@thegagnes.com>
#ifndef QGroundControlQmlGlobal_H
#define QGroundControlQmlGlobal_H
#include <QObject>
#include "HomePositionManager.h"
class
QGroundControlQmlGlobal
:
public
QObject
{
Q_OBJECT
public:
QGroundControlQmlGlobal
(
QObject
*
parent
=
NULL
);
~
QGroundControlQmlGlobal
();
Q_PROPERTY
(
HomePositionManager
*
homePositionManager
READ
homePositionManager
CONSTANT
)
// Property accesors
HomePositionManager
*
homePositionManager
(
void
)
{
return
_homePositionManager
;
}
private:
HomePositionManager
*
_homePositionManager
;
};
#endif
src/QmlControls/QmlObjectListModel.cc
View file @
9e967dc9
...
...
@@ -29,6 +29,7 @@
#include <QDebug>
const
int
QmlObjectListModel
::
ObjectRole
=
Qt
::
UserRole
;
const
int
QmlObjectListModel
::
TextRole
=
Qt
::
UserRole
+
1
;
QmlObjectListModel
::
QmlObjectListModel
(
QObject
*
parent
)
:
QAbstractListModel
(
parent
)
...
...
@@ -60,6 +61,8 @@ QVariant QmlObjectListModel::data(const QModelIndex &index, int role) const
if
(
role
==
ObjectRole
)
{
return
QVariant
::
fromValue
(
_objectList
[
index
.
row
()]);
}
else
if
(
role
==
TextRole
)
{
return
QVariant
::
fromValue
(
_objectList
[
index
.
row
()]
->
objectName
());
}
else
{
return
QVariant
();
}
...
...
@@ -70,6 +73,7 @@ QHash<int, QByteArray> QmlObjectListModel::roleNames(void) const
QHash
<
int
,
QByteArray
>
hash
;
hash
[
ObjectRole
]
=
"object"
;
hash
[
TextRole
]
=
"text"
;
return
hash
;
}
...
...
src/QmlControls/QmlObjectListModel.h
View file @
9e967dc9
...
...
@@ -65,6 +65,7 @@ private:
QList
<
QObject
*>
_objectList
;
static
const
int
ObjectRole
;
static
const
int
TextRole
;
};
#endif
src/comm/QGCFlightGearLink.cc
View file @
9e967dc9
...
...
@@ -38,6 +38,7 @@ This file is part of the QGROUNDCONTROL project
#include <QMessageBox>
#include <iostream>
#include <Eigen/Eigen>
#include "QGCFlightGearLink.h"
#include "QGC.h"
...
...
src/comm/QGCXPlaneLink.cc
View file @
9e967dc9
...
...
@@ -33,10 +33,13 @@ This file is part of the QGROUNDCONTROL project
#include <QDebug>
#include <QMutexLocker>
#include <QNetworkInterface>
#include <QHostInfo>
#include <iostream>
#include <Eigen/Eigen>
#include "QGCXPlaneLink.h"
#include "QGC.h"
#include <QHostInfo>
#include "UAS.h"
#include "UASInterface.h"
#include "QGCMessageBox.h"
...
...
src/uas/UAS.cc
View file @
9e967dc9
...
...
@@ -2784,9 +2784,8 @@ void UAS::home()
double
latitude
=
HomePositionManager
::
instance
()
->
getHomeLatitude
();
double
longitude
=
HomePositionManager
::
instance
()
->
getHomeLongitude
();
double
altitude
=
HomePositionManager
::
instance
()
->
getHomeAltitude
();
int
frame
=
HomePositionManager
::
instance
()
->
getHomeFrame
();
mavlink_msg_command_long_pack
(
mavlink
->
getSystemId
(),
mavlink
->
getComponentId
(),
&
msg
,
uasId
,
MAV_COMP_ID_ALL
,
MAV_CMD_OVERRIDE_GOTO
,
1
,
MAV_GOTO_DO_CONTINUE
,
MAV_GOTO_HOLD_AT_CURRENT_POSITION
,
frame
,
0
,
latitude
,
longitude
,
altitude
);
mavlink_msg_command_long_pack
(
mavlink
->
getSystemId
(),
mavlink
->
getComponentId
(),
&
msg
,
uasId
,
MAV_COMP_ID_ALL
,
MAV_CMD_OVERRIDE_GOTO
,
1
,
MAV_GOTO_DO_CONTINUE
,
MAV_GOTO_HOLD_AT_CURRENT_POSITION
,
MAV_FRAME_GLOBAL
,
0
,
latitude
,
longitude
,
altitude
);
_vehicle
->
sendMessage
(
msg
);
}
...
...
src/ui/MainWindow.cc
View file @
9e967dc9
...
...
@@ -609,7 +609,6 @@ void MainWindow::closeEvent(QCloseEvent *event)
_storeCurrentViewState
();
storeSettings
();
HomePositionManager
::
instance
()
->
storeSettings
();
event
->
accept
();
}
...
...
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