Gazebo Math

API Reference

7.4.0
gz/math/SphericalCoordinates.hh
Go to the documentation of this file.
1/*
2 * Copyright (C) 2012 Open Source Robotics Foundation
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 *
16*/
17#ifndef GZ_MATH_SPHERICALCOORDINATES_HH_
18#define GZ_MATH_SPHERICALCOORDINATES_HH_
19
20#include <string>
21
22#include <gz/math/Angle.hh>
23#include <gz/math/Vector3.hh>
24#include <gz/math/Helpers.hh>
25#include <gz/math/config.hh>
26#include <gz/utils/ImplPtr.hh>
27
28namespace gz
29{
30 namespace math
31 {
32 // Inline bracket to help doxygen filtering.
33 inline namespace GZ_MATH_VERSION_NAMESPACE {
34
36 class GZ_MATH_VISIBLE SphericalCoordinates
37 {
40 public: enum SurfaceType
41 {
44 EARTH_WGS84 = 1,
45
49 MOON_SCS = 2,
50
52 CUSTOM_SURFACE = 10
53 };
54
57 public: enum CoordinateType
58 {
60 SPHERICAL = 1,
61
63 ECEF = 2,
64
66 GLOBAL = 3,
67
71 LOCAL = 4,
72
74 LOCAL2 = 5
75 };
76
79
82 public: explicit SphericalCoordinates(const SurfaceType _type);
83
90 const SurfaceType _type,
91 const double _axisEquatorial,
92 const double _axisPolar);
93
101 const gz::math::Angle &_latitude,
102 const gz::math::Angle &_longitude,
103 const double _elevation,
104 const gz::math::Angle &_heading);
105
120 const gz::math::Vector3d &_xyz) const;
121
134 const gz::math::Vector3d &_xyz) const;
135
140 public: static SurfaceType Convert(const std::string &_str);
141
145 public: static std::string Convert(SurfaceType _type);
146
157 public: GZ_DEPRECATED(7) static double Distance(
158 const gz::math::Angle &_latA,
159 const gz::math::Angle &_lonA,
160 const gz::math::Angle &_latB,
161 const gz::math::Angle &_lonB);
162
173 public: static double DistanceWGS84(
174 const gz::math::Angle &_latA,
175 const gz::math::Angle &_lonA,
176 const gz::math::Angle &_latB,
177 const gz::math::Angle &_lonB);
178
190 public: double DistanceBetweenPoints(
191 const gz::math::Angle &_latA,
192 const gz::math::Angle &_lonA,
193 const gz::math::Angle &_latB,
194 const gz::math::Angle &_lonB);
195
198 public: SurfaceType Surface() const;
199
202 public: double SurfaceRadius() const;
203
206 public: double SurfaceAxisEquatorial() const;
207
210 public: double SurfaceAxisPolar() const;
211
214 public: double SurfaceFlattening() const;
215
218 public: gz::math::Angle LatitudeReference() const;
219
222 public: gz::math::Angle LongitudeReference() const;
223
226 public: double ElevationReference() const;
227
232 public: gz::math::Angle HeadingOffset() const;
233
236 public: void SetSurface(const SurfaceType &_type);
237
243 public: void SetSurface(
244 const SurfaceType &_type,
245 const double _axisEquatorial,
246 const double _axisPolar);
247
250 public: void SetLatitudeReference(const gz::math::Angle &_angle);
251
254 public: void SetLongitudeReference(const gz::math::Angle &_angle);
255
258 public: void SetElevationReference(const double _elevation);
259
262 public: void SetHeadingOffset(const gz::math::Angle &_angle);
263
269 public: gz::math::Vector3d LocalFromSphericalPosition(
270 const gz::math::Vector3d &_latLonEle) const;
271
277 public: gz::math::Vector3d LocalFromGlobalVelocity(
278 const gz::math::Vector3d &_xyz) const;
279
281 public: void UpdateTransformationMatrix();
282
289 public: gz::math::Vector3d
290 PositionTransform(const gz::math::Vector3d &_pos,
291 const CoordinateType &_in, const CoordinateType &_out) const;
292
299 public: gz::math::Vector3d VelocityTransform(
300 const gz::math::Vector3d &_vel,
301 const CoordinateType &_in, const CoordinateType &_out) const;
302
306 public: bool operator==(const SphericalCoordinates &_sc) const;
307
311 public: bool operator!=(const SphericalCoordinates &_sc) const;
312
314 GZ_UTILS_IMPL_PTR(dataPtr)
315 };
316 }
317 }
318}
319#endif