GAMS  1.2.2
GPSPosition.h
Go to the documentation of this file.
1 
56 #ifndef _GAMS_UTILITY_GPS_POSITION_H_
57 #define _GAMS_UTILITY_GPS_POSITION_H_
58 
59 #include "gams/GamsExport.h"
60 #include "madara/knowledge/containers/DoubleVector.h"
61 #include "madara/knowledge/containers/NativeDoubleVector.h"
62 
63 #include "Position.h"
64 
65 #include "gams/pose/Position.h"
66 #include "gams/pose/GPSFrame.h"
67 
68 namespace gams
69 {
70  namespace utility
71  {
78  {
79  public:
86  GPSPosition (
87  double init_lat = 0.0, double init_lon = 0.0, double init_alt = 0.0);
88 
92  GPSPosition (const GPSPosition & position);
93 
97  GPSPosition (const Position & position);
98 
100  : Position(pos.lat(), pos.lng(), pos.alt()) {}
101 
104  longitude(), latitude(), altitude());
105  }
106 
110  virtual ~GPSPosition ();
111 
115  bool operator< (const GPSPosition& rhs) const;
116 
121  void operator= (const GPSPosition & rhs);
122 
128  bool operator== (const GPSPosition & rhs) const;
129 
135  bool operator== (const
136  madara::knowledge::containers::DoubleArray & rhs) const;
137 
143  bool operator== (const
144  madara::knowledge::containers::NativeDoubleArray & rhs) const;
145 
151  bool operator!= (const GPSPosition & rhs) const;
152 
158  bool operator!= (const
159  madara::knowledge::containers::DoubleArray & rhs) const;
160 
166  bool operator!= (const
167  madara::knowledge::containers::NativeDoubleArray & rhs) const;
168 
175  bool approximately_equal(
176  const GPSPosition & rhs, const double & epsilon) const;
177 
183  void direction_to (const GPSPosition& rhs, double& phi) const;
184 
190  double distance_to (const GPSPosition & rhs) const;
191 
197  std::string to_string (const std::string & delimiter = ",",
198  const unsigned int precision = 8) const;
199 
205  virtual Position to_position (const GPSPosition& ref) const;
206 
213  static GPSPosition to_gps_position (const Position & source,
214  const GPSPosition & ref);
215 
220  static GPSPosition from_string (const std::string & delimiter = ",");
221 
226  virtual void to_container (
227  madara::knowledge::containers::DoubleArray & target) const;
228 
233  virtual void from_container (
234  madara::knowledge::containers::DoubleArray & source);
235 
240  virtual void to_container (
241  madara::knowledge::containers::NativeDoubleArray & target)
242  const;
243 
248  virtual void from_container (
249  madara::knowledge::containers::NativeDoubleArray & source);
250 
254  inline double latitude () const { return x; }
255 
259  inline double longitude () const { return y; }
260 
264  inline double altitude () const { return z; }
265 
269  inline void latitude (double input) { x = input; }
270 
274  inline void longitude (double input) { y = input; }
275 
279  inline void altitude (double input) { z = input; }
280 
281  }; // class GPSPosition
282 
283  // helpful typedef for vector of positions
284  typedef std::vector <GPSPosition> GpsPositions;
285  } // namespace utility
286 } // namespace gams
287 
288 #endif // _GAMS_UTILITY_GPS_POSITION_H_
double altitude() const
Returns the altitude of the GPS coordinate.
Definition: GPSPosition.h:264
void longitude(double input)
Sets the longitude to the input.
Definition: GPSPosition.h:274
double latitude() const
Returns the latitude of the GPS coordinate.
Definition: GPSPosition.h:254
double longitude() const
Returns the longitude of the GPS coordinate.
Definition: GPSPosition.h:259
void latitude(double input)
Sets the latitude to the input.
Definition: GPSPosition.h:269
std::vector< GPSPosition > GpsPositions
Definition: GPSPosition.h:284
pose::Position to_gps_pos() const
Definition: GPSPosition.h:102
Contains all GAMS-related tools, classes and code.
void altitude(double input)
Sets the altitude to the input.
Definition: GPSPosition.h:279
#define GAMS_EXPORT
Definition: GamsExport.h:20
bool operator<(const BasicVector< LDerived, Units > &lhs, const BasicVector< RDerived, Units > &rhs)
Definition: Coordinate.h:957
bool operator!=(const BasicVector< LDerived, Units > &lhs, const BasicVector< RDerived, Units > &rhs)
Definition: Coordinate.h:956
GPSPosition(const pose::Position &pos)
Definition: GPSPosition.h:99
A position in an x, y, z coordinate system.
Definition: Position.h:77
A position in the global positioning system reference frame.
Definition: GPSPosition.h:77
bool operator==(const BasicVector< LDerived, Units > &lhs, const BasicVector< RDerived, Units > &rhs)
Definition: Coordinate.h:955
GAMS_EXPORT const ReferenceFrame & gps_frame(void)
Returns the canonical GPS frame representing Earth.