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
bcabd2ce
Commit
bcabd2ce
authored
Oct 21, 2011
by
LM
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added conversion functions
parent
a821d121
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
0 deletions
+24
-0
UASManager.cc
src/uas/UASManager.cc
+20
-0
UASManager.h
src/uas/UASManager.h
+4
-0
No files found.
src/uas/UASManager.cc
View file @
bcabd2ce
...
...
@@ -18,6 +18,10 @@
#include "UASManager.h"
#include "QGC.h"
#define PI 3.1415926535897932384626433832795
#define MEAN_EARTH_DIAMETER 12756274.0
#define UMR 0.017453292519943295769236907684886
UASManager
*
UASManager
::
instance
()
{
static
UASManager
*
_instance
=
0
;
...
...
@@ -181,6 +185,22 @@ void UASManager::wgs84ToEnu(const double& lat, const double& lon, const double&
//}
void
UASManager
::
enuToWgs84
(
const
double
&
x
,
const
double
&
y
,
const
double
&
z
,
double
*
lat
,
double
*
lon
,
double
*
alt
)
{
*
lat
=
homeLat
+
y
/
MEAN_EARTH_DIAMETER
*
360.
/
PI
;
*
lon
=
homeLon
+
x
/
MEAN_EARTH_DIAMETER
*
360.
/
PI
/
cos
(
homeLat
*
UMR
);
*
alt
=
homeAlt
+
z
;
}
void
UASManager
::
nedToWgs84
(
const
double
&
x
,
const
double
&
y
,
const
double
&
z
,
double
*
lat
,
double
*
lon
,
double
*
alt
)
{
*
lat
=
homeLat
+
x
/
MEAN_EARTH_DIAMETER
*
360.
/
PI
;
*
lon
=
homeLon
+
y
/
MEAN_EARTH_DIAMETER
*
360.
/
PI
/
cos
(
homeLat
*
UMR
);
*
alt
=
homeAlt
-
z
;
}
/**
* This function will change QGC's home position on a number of conditions only
*/
...
...
src/uas/UASManager.h
View file @
bcabd2ce
...
...
@@ -96,6 +96,10 @@ public:
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
);
void
getLocalNEDSafetyLimits
(
double
*
x1
,
double
*
y1
,
double
*
z1
,
double
*
x2
,
double
*
y2
,
double
*
z2
)
{
...
...
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