SphericalCoordinates.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2012-2015 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 _GAZEBO_SPHERICALCOORDINATES_HH_
18 #define _GAZEBO_SPHERICALCOORDINATES_HH_
19 
20 #include <string>
21 
22 #include <ignition/math/Angle.hh>
23 #include <ignition/math/Vector3.hh>
24 
26 #include "gazebo/math/Angle.hh"
27 #include "gazebo/math/Vector3.hh"
28 #include "gazebo/math/Matrix3.hh"
29 #include "gazebo/util/system.hh"
30 
31 namespace gazebo
32 {
33  namespace common
34  {
35  class SphericalCoordinatesPrivate;
36 
39 
43  {
46  public: enum SurfaceType
47  {
50  EARTH_WGS84 = 1
51  };
52 
55  public: enum CoordinateType
56  {
58  SPHERICAL = 1,
59 
61  ECEF = 2,
62 
64  GLOBAL = 3,
65 
67  LOCAL = 4
68  };
69 
71  public: SphericalCoordinates();
72 
75  public: SphericalCoordinates(const SurfaceType _type);
76 
85  public: SphericalCoordinates(const SurfaceType _type,
86  const math::Angle &_latitude,
87  const math::Angle &_longitude,
88  double _elevation,
89  const math::Angle &_heading) GAZEBO_DEPRECATED(6.0);
90 
97  public: SphericalCoordinates(const SurfaceType _type,
98  const ignition::math::Angle &_latitude,
99  const ignition::math::Angle &_longitude,
100  double _elevation,
101  const ignition::math::Angle &_heading);
102 
104  public: ~SphericalCoordinates();
105 
112  public: math::Vector3 SphericalFromLocal(const math::Vector3 &_xyz) const
113  GAZEBO_DEPRECATED(6.0);
114 
119  public: ignition::math::Vector3d SphericalFromLocal(
120  const ignition::math::Vector3d &_xyz) const;
121 
128  public: math::Vector3 GlobalFromLocal(const math::Vector3 &_xyz) const
129  GAZEBO_DEPRECATED(6.0);
130 
135  public: ignition::math::Vector3d GlobalFromLocal(
136  const ignition::math::Vector3d &_xyz) const;
137 
141  public: static SurfaceType Convert(const std::string &_str);
142 
154  public: static double Distance(const math::Angle &_latA,
155  const math::Angle &_lonA,
156  const math::Angle &_latB,
157  const math::Angle &_lonB) GAZEBO_DEPRECATED(6.0);
158 
168  public: static double Distance(const ignition::math::Angle &_latA,
169  const ignition::math::Angle &_lonA,
170  const ignition::math::Angle &_latB,
171  const ignition::math::Angle &_lonB);
172 
175  public: SurfaceType GetSurfaceType() const;
176 
181  public: math::Angle GetLatitudeReference() const GAZEBO_DEPRECATED(6.0);
182 
185  public: ignition::math::Angle LatitudeReference() const;
186 
191  public: math::Angle GetLongitudeReference() const GAZEBO_DEPRECATED(6.0);
192 
195  public: ignition::math::Angle LongitudeReference() const;
196 
199  public: double GetElevationReference() const;
200 
207  public: math::Angle GetHeadingOffset() const GAZEBO_DEPRECATED(6.0);
208 
213  public: ignition::math::Angle HeadingOffset() const;
214 
217  public: void SetSurfaceType(const SurfaceType &_type);
218 
223  public: void SetLatitudeReference(const math::Angle &_angle)
224  GAZEBO_DEPRECATED(6.0);
225 
228  public: void SetLatitudeReference(const ignition::math::Angle &_angle);
229 
234  public: void SetLongitudeReference(const math::Angle &_angle)
235  GAZEBO_DEPRECATED(6.0);
236 
239  public: void SetLongitudeReference(const ignition::math::Angle &_angle);
240 
243  public: void SetElevationReference(double _elevation);
244 
249  public: void SetHeadingOffset(const math::Angle &_angle)
250  GAZEBO_DEPRECATED(6.0);
251 
254  public: void SetHeadingOffset(const ignition::math::Angle &_angle);
255 
259  public: ignition::math::Vector3d LocalFromSpherical(
260  const ignition::math::Vector3d &_xyz) const;
261 
266  public: ignition::math::Vector3d LocalFromGlobal(
267  const ignition::math::Vector3d &_xyz) const;
268 
270  public: void UpdateTransformationMatrix();
271 
277  public: ignition::math::Vector3d
278  PositionTransform(const ignition::math::Vector3d &_pos,
279  const CoordinateType &_in, const CoordinateType &_out) const;
280 
286  public: ignition::math::Vector3d VelocityTransform(
287  const ignition::math::Vector3d &_vel,
288  const CoordinateType &_in, const CoordinateType &_out) const;
289 
292  private: SphericalCoordinatesPrivate *dataPtr;
293  };
295  }
296 }
297 #endif
Convert spherical coordinates for planetary surfaces.
Definition: SphericalCoordinates.hh:42
Forward declarations for the common classes.
Definition: Animation.hh:33
The Vector3 class represents the generic vector containing 3 elements.
Definition: Vector3.hh:39
#define GAZEBO_DEPRECATED(version)
Definition: CommonTypes.hh:47
GAZEBO_VISIBLE msgs::Vector3d Convert(const math::Vector3 &_v) GAZEBO_DEPRECATED(6.0)
Convert a math::Vector3 to a msgs::Vector3d.
#define GZ_COMMON_VISIBLE
Definition: system.hh:91
commmon/common.hh
Definition: SphericalCoordinatesPrivate.hh:40
An angle and related functions.
Definition: Angle.hh:53
CoordinateType
Unique identifiers for coordinate types.
Definition: SphericalCoordinates.hh:55
Definition: Animation.hh:24
SurfaceType
Unique identifiers for planetary surface models.
Definition: SphericalCoordinates.hh:46