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 
18 #ifndef _SPHERICALCOORDINATES_HH_
19 #define _SPHERICALCOORDINATES_HH_
20 
21 #include <string>
22 
23 #include "gazebo/math/Angle.hh"
24 #include "gazebo/math/Vector3.hh"
25 #include "gazebo/util/system.hh"
26 
27 namespace gazebo
28 {
29  namespace common
30  {
31  class SphericalCoordinatesPrivate;
32 
35 
39  {
42  public: enum SurfaceType
43  {
46  EARTH_WGS84 = 1
47  };
48 
50  public: SphericalCoordinates();
51 
54  public: SphericalCoordinates(const SurfaceType _type);
55 
62  public: SphericalCoordinates(const SurfaceType _type,
63  const math::Angle &_latitude,
64  const math::Angle &_longitude,
65  double _elevation,
66  const math::Angle &_heading);
67 
69  public: ~SphericalCoordinates();
70 
75  public: math::Vector3 SphericalFromLocal(const math::Vector3 &_xyz) const;
76 
81  public: math::Vector3 GlobalFromLocal(const math::Vector3 &_xyz) const;
82 
86  public: static SurfaceType Convert(const std::string &_str);
87 
97  public: static double Distance(const math::Angle &_latA,
98  const math::Angle &_lonA,
99  const math::Angle &_latB,
100  const math::Angle &_lonB);
101 
104  public: SurfaceType GetSurfaceType() const;
105 
108  public: math::Angle GetLatitudeReference() const;
109 
112  public: math::Angle GetLongitudeReference() const;
113 
116  public: double GetElevationReference() const;
117 
122  public: math::Angle GetHeadingOffset() const;
123 
126  public: void SetSurfaceType(const SurfaceType &_type);
127 
130  public: void SetLatitudeReference(const math::Angle &_angle);
131 
134  public: void SetLongitudeReference(const math::Angle &_angle);
135 
138  public: void SetElevationReference(double _elevation);
139 
142  public: void SetHeadingOffset(const math::Angle &_angle);
143 
146  private: SphericalCoordinatesPrivate *dataPtr;
147  };
149  }
150 }
151 #endif
Convert spherical coordinates for planetary surfaces.
Definition: SphericalCoordinates.hh:38
The Vector3 class represents the generic vector containing 3 elements.
Definition: Vector3.hh:43
GAZEBO_VISIBLE msgs::Vector3d Convert(const math::Vector3 &_v)
Convert a math::Vector3 to a msgs::Vector3d.
commmon/common.hh
Definition: SphericalCoordinatesPrivate.hh:38
An angle and related functions.
Definition: Angle.hh:52
SurfaceType
Unique identifiers for planetary surface models.
Definition: SphericalCoordinates.hh:42
#define GAZEBO_VISIBLE
Use to represent "symbol visible" if supported.
Definition: system.hh:48