GeodeticCoords.h
Go to the documentation of this file.
1 /*
2 Copyright (c) 2010-2016, Mathieu Labbe - IntRoLab - Universite de Sherbrooke
3 All rights reserved.
4 
5 Redistribution and use in source and binary forms, with or without
6 modification, 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 
16 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY
20 DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 ON 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
25 SOFTWARE, 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 
47 
48 #include <opencv2/core/core.hpp>
49 
50 namespace rtabmap {
51 
53 {
54 public:
56  GeodeticCoords(double latitude, double longitude, double altitude);
57 
58  const double & latitude() const {return latitude_;}
59  const double & longitude() const {return longitude_;}
60  const double & altitude() const {return altitude_;}
61 
62  void setLatitude(const double & value) {latitude_ = value;}
63  void setLongitude(const double & value) {longitude_ = value;}
64  void setAltitude(const double & value) {altitude_ = value;}
65 
66  cv::Point3d toGeocentric_WGS84() const;
67  cv::Point3d toENU_WGS84(const GeodeticCoords & origin) const; // East=X, North=Y
68 
69  void fromGeocentric_WGS84(const cv::Point3d& geocentric);
70  void fromENU_WGS84(const cv::Point3d & enu, const GeodeticCoords & origin);
71 
72  static cv::Point3d ENU_WGS84ToGeocentric_WGS84(const cv::Point3d & enu, const GeodeticCoords & origin);
73 
74 private:
75  double latitude_; // deg
76  double longitude_; // deg
77  double altitude_; // m
78 };
79 
80 class GPS
81 {
82 public:
83  GPS():
84  stamp_(0.0),
85  longitude_(0.0),
86  latitude_(0.0),
87  altitude_(0.0),
88  error_(0.0),
89  bearing_(0.0)
90  {}
91  GPS(const double & stamp,
92  const double & longitude,
93  const double & latitude,
94  const double & altitude,
95  const double & error,
96  const double & bearing):
97  stamp_(stamp),
98  longitude_(longitude),
99  latitude_(latitude),
100  altitude_(altitude),
101  error_(error),
102  bearing_(bearing)
103  {}
104  const double & stamp() const {return stamp_;}
105  const double & longitude() const {return longitude_;}
106  const double & latitude() const {return latitude_;}
107  const double & altitude() const {return altitude_;}
108  const double & error() const {return error_;}
109  const double & bearing() const {return bearing_;}
110 
111  GeodeticCoords toGeodeticCoords() const {return GeodeticCoords(latitude_, longitude_, altitude_);}
112 private:
113  double stamp_; // in sec
114  double longitude_; // DD
115  double latitude_; // DD
116  double altitude_; // m
117  double error_; // m
118  double bearing_; // deg (North 0->360 clockwise)
119 };
120 
121 }
122 
123 #endif /* GEODETICCOORDS_H_ */
GPS(const double &stamp, const double &longitude, const double &latitude, const double &altitude, const double &error, const double &bearing)
void setLongitude(const double &value)
const double & altitude() const
const double & longitude() const
#define RTABMAP_EXP
Definition: RtabmapExp.h:38
const double & error() const
const double & latitude() const
GeodeticCoords toGeodeticCoords() const
const double & longitude() const
const double & altitude() const
void setLatitude(const double &value)
void setAltitude(const double &value)
const double & latitude() const
const double & bearing() const
const double & stamp() const


rtabmap
Author(s): Mathieu Labbe
autogenerated on Wed Jun 5 2019 22:41:31