Gazebo Math

API Reference

8.0.0
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 <optional>
21#include <string>
22
23#include <gz/math/Angle.hh>
25#include <gz/math/Vector3.hh>
26#include <gz/math/Helpers.hh>
27#include <gz/math/config.hh>
28#include <gz/utils/ImplPtr.hh>
29
30// MSVC doesn't like deprecating enum values with function macros
31#if _MSC_VER
32#define GZ_LOCAL2_DEPRECATED [[deprecated]]
33#else
34#define GZ_LOCAL2_DEPRECATED GZ_DEPRECATED(8)
35#endif
36
37namespace gz::math
38{
39 // Inline bracket to help doxygen filtering.
40 inline namespace GZ_MATH_VERSION_NAMESPACE {
41
44 {
47 public: enum SurfaceType
48 {
51 EARTH_WGS84 = 1,
52
56 MOON_SCS = 2,
57
59 CUSTOM_SURFACE = 10
60 };
61
64 public: enum CoordinateType
65 {
67 SPHERICAL = 1,
68
70 ECEF = 2,
71
73 GLOBAL = 3,
74
76 LOCAL = 4,
77
82 LOCAL2 GZ_LOCAL2_DEPRECATED = 5
83 };
84
87
90 public: explicit SphericalCoordinates(const SurfaceType _type);
91
98 const SurfaceType _type,
99 const double _axisEquatorial,
100 const double _axisPolar);
101
111 const double _elevation,
113
126 public: GZ_DEPRECATED(8) gz::math::Vector3d SphericalFromLocalPosition(
127 const gz::math::Vector3d &_xyz) const;
128
136 public: std::optional<math::CoordinateVector3> SphericalFromLocalPosition(
138
151 public: GZ_DEPRECATED(8) gz::math::Vector3d GlobalFromLocalVelocity(
152 const gz::math::Vector3d &_xyz) const;
153
161 public: std::optional<math::CoordinateVector3> GlobalFromLocalVelocity(
163
168 public: static SurfaceType Convert(const std::string &_str);
169
173 public: static std::string Convert(SurfaceType _type);
174
185 public: static double DistanceWGS84(
186 const gz::math::Angle &_latA,
187 const gz::math::Angle &_lonA,
188 const gz::math::Angle &_latB,
189 const gz::math::Angle &_lonB);
190
202 public: double DistanceBetweenPoints(
203 const gz::math::Angle &_latA,
204 const gz::math::Angle &_lonA,
205 const gz::math::Angle &_latB,
206 const gz::math::Angle &_lonB);
207
211
214 public: double SurfaceRadius() const;
215
218 public: double SurfaceAxisEquatorial() const;
219
222 public: double SurfaceAxisPolar() const;
223
226 public: double SurfaceFlattening() const;
227
230 public: gz::math::Angle LatitudeReference() const;
231
234 public: gz::math::Angle LongitudeReference() const;
235
238 public: double ElevationReference() const;
239
244 public: gz::math::Angle HeadingOffset() const;
245
248 public: void SetSurface(const SurfaceType &_type);
249
255 public: void SetSurface(
257 const double _axisEquatorial,
258 const double _axisPolar);
259
262 public: void SetLatitudeReference(const gz::math::Angle &_angle);
263
266 public: void SetLongitudeReference(const gz::math::Angle &_angle);
267
270 public: void SetElevationReference(const double _elevation);
271
274 public: void SetHeadingOffset(const gz::math::Angle &_angle);
275
282 public: GZ_DEPRECATED(8) gz::math::Vector3d LocalFromSphericalPosition(
284
290 public: std::optional<math::CoordinateVector3> LocalFromSphericalPosition(
292
299 public: GZ_DEPRECATED(8) gz::math::Vector3d LocalFromGlobalVelocity(
300 const gz::math::Vector3d &_xyz) const;
301
307 public: std::optional<math::CoordinateVector3> LocalFromGlobalVelocity(
309
311 public: void UpdateTransformationMatrix();
312
330 PositionTransform(const gz::math::Vector3d &_pos,
332
339 public: std::optional<gz::math::CoordinateVector3>
340 PositionTransform(const gz::math::CoordinateVector3 &_pos,
342
358 public: GZ_DEPRECATED(8) gz::math::Vector3d VelocityTransform(
359 const gz::math::Vector3d &_vel,
361
368 public: std::optional<gz::math::CoordinateVector3> VelocityTransform(
371
376
381
383 GZ_UTILS_IMPL_PTR(dataPtr)
384 };
385 } // namespace GZ_MATH_VERSION_NAMESPACE
386} // namespace gz::math
387#endif // GZ_MATH_SPHERICALCOORDINATES_HH_