RTAB-Map 0.23.10
Real-Time Appearance-Based Mapping
Loading...
Searching...
No Matches
GeodeticCoords.h
1/*
2Copyright (c) 2010-2016, Mathieu Labbe - IntRoLab - Universite de Sherbrooke
3All rights reserved.
4
5Redistribution and use in source and binary forms, with or without
6modification, are permitted provided that the following conditions are met:
7 * Redistributions of source code must retain the above copyright
8 notice, this list of conditions and the following disclaimer.
9 * Redistributions in binary form must reproduce the above copyright
10 notice, this list of conditions and the following disclaimer in the
11 documentation and/or other materials provided with the distribution.
12 * Neither the name of the Universite de Sherbrooke nor the
13 names of its contributors may be used to endorse or promote products
14 derived from this software without specific prior written permission.
15
16THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY
20DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26*/
27
28/*
29 * The methods in this file were modified from the originals of the MRPT toolkit (see notice below):
30 * https://github.com/MRPT/mrpt/blob/master/libs/topography/src/conversions.cpp
31 */
32
33/* +---------------------------------------------------------------------------+
34 | Mobile Robot Programming Toolkit (MRPT) |
35 | http://www.mrpt.org/ |
36 | |
37 | Copyright (c) 2005-2016, Individual contributors, see AUTHORS file |
38 | See: http://www.mrpt.org/Authors - All rights reserved. |
39 | Released under BSD License. See details in http://www.mrpt.org/License |
40 +---------------------------------------------------------------------------+ */
41
42
43#ifndef GEODETICCOORDS_H_
44#define GEODETICCOORDS_H_
45
46#include <rtabmap/core/rtabmap_core_export.h>
47
48#include <opencv2/core/core.hpp>
49
50namespace rtabmap {
51
61class RTABMAP_CORE_EXPORT GeodeticCoords
62{
63public:
72 GeodeticCoords(double latitude, double longitude, double altitude);
73
75 const double & latitude() const {return latitude_;}
77 const double & longitude() const {return longitude_;}
79 const double & altitude() const {return altitude_;}
80
82 void setLatitude(const double & value) {latitude_ = value;}
84 void setLongitude(const double & value) {longitude_ = value;}
86 void setAltitude(const double & value) {altitude_ = value;}
87
89 cv::Point3d toGeocentric_WGS84() const;
94 cv::Point3d toENU_WGS84(const GeodeticCoords & origin) const; // East=X, North=Y
95
97 void fromGeocentric_WGS84(const cv::Point3d& geocentric);
99 void fromENU_WGS84(const cv::Point3d & enu, const GeodeticCoords & origin);
100
102 static cv::Point3d ENU_WGS84ToGeocentric_WGS84(const cv::Point3d & enu, const GeodeticCoords & origin);
107 static cv::Point3d Geocentric_WGS84ToENU_WGS84(
108 const cv::Point3d & geocentric_WGS84,
109 const cv::Point3d & origin_geocentric_WGS84,
110 const GeodeticCoords & origin);
111
112private:
113 double latitude_; // deg
114 double longitude_; // deg
115 double altitude_; // m
116};
117
118}
119
120#endif /* GEODETICCOORDS_H_ */
WGS84 geodetic latitude, longitude and altitude with coordinate conversions.
GeodeticCoords(double latitude, double longitude, double altitude)
Constructs geodetic coordinates.
const double & altitude() const
GeodeticCoords()
Default-constructs coordinates at (0°, 0°, 0 m).
const double & longitude() const
static cv::Point3d Geocentric_WGS84ToENU_WGS84(const cv::Point3d &geocentric_WGS84, const cv::Point3d &origin_geocentric_WGS84, const GeodeticCoords &origin)
static cv::Point3d ENU_WGS84ToGeocentric_WGS84(const cv::Point3d &enu, const GeodeticCoords &origin)
void setLatitude(const double &value)
Sets latitude in decimal degrees.
void setLongitude(const double &value)
Sets longitude in decimal degrees.
void fromENU_WGS84(const cv::Point3d &enu, const GeodeticCoords &origin)
Sets this point from an ENU offset relative to origin.
const double & latitude() const
void fromGeocentric_WGS84(const cv::Point3d &geocentric)
Sets this point from ECEF geocentric geocentric coordinates.
cv::Point3d toGeocentric_WGS84() const
cv::Point3d toENU_WGS84(const GeodeticCoords &origin) const
void setAltitude(const double &value)
Sets altitude in meters.