GAMS  1.4.0
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:
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 
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_
#define GAMS_EXPORT
Definition: GamsExport.h:20
A position in the global positioning system reference frame.
Definition: GPSPosition.h:78
double latitude() const
Returns the latitude of the GPS coordinate.
Definition: GPSPosition.h:254
void latitude(double input)
Sets the latitude to the input.
Definition: GPSPosition.h:269
virtual void from_container(madara::knowledge::containers::DoubleArray &source)
Helper function for copying values to a MADARA double array.
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 longitude() const
Returns the longitude of the GPS coordinate.
Definition: GPSPosition.h:259
bool approximately_equal(const GPSPosition &rhs, const double &epsilon) const
Approximate equality.
static GPSPosition to_gps_position(const Position &source, const GPSPosition &ref)
Convert source to a GPSPosition.
pose::Position to_gps_pos() const
Definition: GPSPosition.h:102
GPSPosition(const GPSPosition &position)
Constructor.
double distance_to(const GPSPosition &rhs) const
Get distance between two positions.
GPSPosition(const pose::Position &pos)
Definition: GPSPosition.h:99
void direction_to(const GPSPosition &rhs, double &phi) const
Get spherical direction to position.
virtual ~GPSPosition()
Destructor.
virtual void to_container(madara::knowledge::containers::NativeDoubleArray &target) const
Helper function for copying values to a MADARA double array.
virtual void to_container(madara::knowledge::containers::DoubleArray &target) const
Helper function for copying values to a MADARA double array.
virtual void from_container(madara::knowledge::containers::NativeDoubleArray &source)
Helper function for copying values to a MADARA double array.
std::string to_string(const std::string &delimiter=",", const unsigned int precision=8) const
Helper function for converting the position to a string.
virtual Position to_position(const GPSPosition &ref) const
Convert to position using reference location.
GPSPosition(double init_lat=0.0, double init_lon=0.0, double init_alt=0.0)
Constructor.
void altitude(double input)
Sets the altitude to the input.
Definition: GPSPosition.h:279
GPSPosition(const Position &position)
Constructor.
static GPSPosition from_string(const std::string &delimiter=",")
Helper function for creating a GPSPosition from a string.
A position in an x, y, z coordinate system.
Definition: Position.h:78
GAMS_EXPORT const ReferenceFrame & gps_frame(void)
Returns the canonical GPS frame representing Earth.
bool operator==(const BasicVector< LDerived, Units > &lhs, const BasicVector< RDerived, Units > &rhs)
Equality operator for coordinates.
Definition: Coordinate.h:936
bool operator<(const BasicVector< LDerived, Units > &lhs, const BasicVector< RDerived, Units > &rhs)
Definition: Coordinate.h:1018
bool operator!=(const BasicVector< LDerived, Units > &lhs, const BasicVector< RDerived, Units > &rhs)
Inequality operator for coordinates.
Definition: Coordinate.h:984
std::vector< GPSPosition > GpsPositions
Definition: GPSPosition.h:284
Contains all GAMS-related tools, classes and code.
Copyright (c) 2015 Carnegie Mellon University.
Copyright (c) 2015-2018 Carnegie Mellon University.
Copyright(c) 2014 Carnegie Mellon University.