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
3be7c93b
Commit
3be7c93b
authored
Nov 10, 2019
by
Matej Frančeškin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added MGRS position fact
parent
1be5d2bd
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
25 additions
and
1 deletion
+25
-1
QGCGeo.cc
src/Geo/QGCGeo.cc
+9
-1
GPSFact.json
src/Vehicle/GPSFact.json
+5
-0
Vehicle.cc
src/Vehicle/Vehicle.cc
+7
-0
Vehicle.h
src/Vehicle/Vehicle.h
+4
-0
No files found.
src/Geo/QGCGeo.cc
View file @
3be7c93b
...
...
@@ -125,7 +125,15 @@ QString convertGeoToMGRS(const QGeoCoordinate& coord)
mgrs
=
""
;
}
return
QString
::
fromStdString
(
mgrs
);
QString
qstr
=
QString
::
fromStdString
(
mgrs
);
for
(
int
i
=
qstr
.
length
()
-
1
;
i
>=
0
;
i
--
)
{
if
(
!
qstr
.
at
(
i
).
isDigit
())
{
int
l
=
(
qstr
.
length
()
-
i
)
/
2
;
return
qstr
.
left
(
i
+
1
)
+
" "
+
qstr
.
mid
(
i
+
1
,
l
)
+
" "
+
qstr
.
mid
(
i
+
1
+
l
);
}
}
return
qstr
;
}
bool
convertMGRSToGeo
(
QString
mgrs
,
QGeoCoordinate
&
coord
)
...
...
src/Vehicle/GPSFact.json
View file @
3be7c93b
...
...
@@ -11,6 +11,11 @@
"type"
:
"double"
,
"decimalPlaces"
:
7
},
{
"name"
:
"mgrs"
,
"shortDescription"
:
"MGRS Position"
,
"type"
:
"string"
},
{
"name"
:
"hdop"
,
"shortDescription"
:
"HDOP"
,
...
...
src/Vehicle/Vehicle.cc
View file @
3be7c93b
...
...
@@ -44,6 +44,7 @@
#include "PositionManager.h"
#include "VehicleObjectAvoidance.h"
#include "TrajectoryPoints.h"
#include "QGCGeo.h"
#if defined(QGC_AIRMAP_ENABLED)
#include "AirspaceVehicleManager.h"
...
...
@@ -1175,6 +1176,7 @@ void Vehicle::_handleGpsRawInt(mavlink_message_t& message)
_gpsFactGroup
.
lat
()
->
setRawValue
(
gpsRawInt
.
lat
*
1e-7
);
_gpsFactGroup
.
lon
()
->
setRawValue
(
gpsRawInt
.
lon
*
1e-7
);
_gpsFactGroup
.
mgrs
()
->
setRawValue
(
convertGeoToMGRS
(
QGeoCoordinate
(
gpsRawInt
.
lat
*
1e-7
,
gpsRawInt
.
lon
*
1e-7
)));
_gpsFactGroup
.
count
()
->
setRawValue
(
gpsRawInt
.
satellites_visible
==
255
?
0
:
gpsRawInt
.
satellites_visible
);
_gpsFactGroup
.
hdop
()
->
setRawValue
(
gpsRawInt
.
eph
==
UINT16_MAX
?
std
::
numeric_limits
<
double
>::
quiet_NaN
()
:
gpsRawInt
.
eph
/
100.0
);
_gpsFactGroup
.
vdop
()
->
setRawValue
(
gpsRawInt
.
epv
==
UINT16_MAX
?
std
::
numeric_limits
<
double
>::
quiet_NaN
()
:
gpsRawInt
.
epv
/
100.0
);
...
...
@@ -1248,6 +1250,7 @@ void Vehicle::_handleHighLatency2(mavlink_message_t& message)
_gpsFactGroup
.
lat
()
->
setRawValue
(
highLatency2
.
latitude
*
1e-7
);
_gpsFactGroup
.
lon
()
->
setRawValue
(
highLatency2
.
longitude
*
1e-7
);
_gpsFactGroup
.
mgrs
()
->
setRawValue
(
convertGeoToMGRS
(
QGeoCoordinate
(
highLatency2
.
latitude
*
1e-7
,
highLatency2
.
longitude
*
1e-7
)));
_gpsFactGroup
.
count
()
->
setRawValue
(
0
);
_gpsFactGroup
.
hdop
()
->
setRawValue
(
highLatency2
.
eph
==
UINT8_MAX
?
std
::
numeric_limits
<
double
>::
quiet_NaN
()
:
highLatency2
.
eph
/
10.0
);
_gpsFactGroup
.
vdop
()
->
setRawValue
(
highLatency2
.
epv
==
UINT8_MAX
?
std
::
numeric_limits
<
double
>::
quiet_NaN
()
:
highLatency2
.
epv
/
10.0
);
...
...
@@ -3577,6 +3580,7 @@ void Vehicle::setVtolInFwdFlight(bool vtolInFwdFlight)
const
char
*
VehicleGPSFactGroup
::
_latFactName
=
"lat"
;
const
char
*
VehicleGPSFactGroup
::
_lonFactName
=
"lon"
;
const
char
*
VehicleGPSFactGroup
::
_mgrsFactName
=
"mgrs"
;
const
char
*
VehicleGPSFactGroup
::
_hdopFactName
=
"hdop"
;
const
char
*
VehicleGPSFactGroup
::
_vdopFactName
=
"vdop"
;
const
char
*
VehicleGPSFactGroup
::
_courseOverGroundFactName
=
"courseOverGround"
;
...
...
@@ -3587,6 +3591,7 @@ VehicleGPSFactGroup::VehicleGPSFactGroup(QObject* parent)
:
FactGroup
(
1000
,
":/json/Vehicle/GPSFact.json"
,
parent
)
,
_latFact
(
0
,
_latFactName
,
FactMetaData
::
valueTypeDouble
)
,
_lonFact
(
0
,
_lonFactName
,
FactMetaData
::
valueTypeDouble
)
,
_mgrsFact
(
0
,
_mgrsFactName
,
FactMetaData
::
valueTypeString
)
,
_hdopFact
(
0
,
_hdopFactName
,
FactMetaData
::
valueTypeDouble
)
,
_vdopFact
(
0
,
_vdopFactName
,
FactMetaData
::
valueTypeDouble
)
,
_courseOverGroundFact
(
0
,
_courseOverGroundFactName
,
FactMetaData
::
valueTypeDouble
)
...
...
@@ -3595,6 +3600,7 @@ VehicleGPSFactGroup::VehicleGPSFactGroup(QObject* parent)
{
_addFact
(
&
_latFact
,
_latFactName
);
_addFact
(
&
_lonFact
,
_lonFactName
);
_addFact
(
&
_mgrsFact
,
_mgrsFactName
);
_addFact
(
&
_hdopFact
,
_hdopFactName
);
_addFact
(
&
_vdopFact
,
_vdopFactName
);
_addFact
(
&
_courseOverGroundFact
,
_courseOverGroundFactName
);
...
...
@@ -3603,6 +3609,7 @@ VehicleGPSFactGroup::VehicleGPSFactGroup(QObject* parent)
_latFact
.
setRawValue
(
std
::
numeric_limits
<
float
>::
quiet_NaN
());
_lonFact
.
setRawValue
(
std
::
numeric_limits
<
float
>::
quiet_NaN
());
_mgrsFact
.
setRawValue
(
""
);
_hdopFact
.
setRawValue
(
std
::
numeric_limits
<
float
>::
quiet_NaN
());
_vdopFact
.
setRawValue
(
std
::
numeric_limits
<
float
>::
quiet_NaN
());
_courseOverGroundFact
.
setRawValue
(
std
::
numeric_limits
<
float
>::
quiet_NaN
());
...
...
src/Vehicle/Vehicle.h
View file @
3be7c93b
...
...
@@ -217,6 +217,7 @@ public:
Q_PROPERTY
(
Fact
*
lat
READ
lat
CONSTANT
)
Q_PROPERTY
(
Fact
*
lon
READ
lon
CONSTANT
)
Q_PROPERTY
(
Fact
*
mgrs
READ
mgrs
CONSTANT
)
Q_PROPERTY
(
Fact
*
hdop
READ
hdop
CONSTANT
)
Q_PROPERTY
(
Fact
*
vdop
READ
vdop
CONSTANT
)
Q_PROPERTY
(
Fact
*
courseOverGround
READ
courseOverGround
CONSTANT
)
...
...
@@ -225,6 +226,7 @@ public:
Fact
*
lat
(
void
)
{
return
&
_latFact
;
}
Fact
*
lon
(
void
)
{
return
&
_lonFact
;
}
Fact
*
mgrs
(
void
)
{
return
&
_mgrsFact
;
}
Fact
*
hdop
(
void
)
{
return
&
_hdopFact
;
}
Fact
*
vdop
(
void
)
{
return
&
_vdopFact
;
}
Fact
*
courseOverGround
(
void
)
{
return
&
_courseOverGroundFact
;
}
...
...
@@ -233,6 +235,7 @@ public:
static
const
char
*
_latFactName
;
static
const
char
*
_lonFactName
;
static
const
char
*
_mgrsFactName
;
static
const
char
*
_hdopFactName
;
static
const
char
*
_vdopFactName
;
static
const
char
*
_courseOverGroundFactName
;
...
...
@@ -242,6 +245,7 @@ public:
private:
Fact
_latFact
;
Fact
_lonFact
;
Fact
_mgrsFact
;
Fact
_hdopFact
;
Fact
_vdopFact
;
Fact
_courseOverGroundFact
;
...
...
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