global_reference.h
Go to the documentation of this file.
00001 //=================================================================================================
00002 // Copyright (c) 2011, Johannes Meyer and Martin Nowara, TU Darmstadt
00003 // All rights reserved.
00004 
00005 // Redistribution and use in source and binary forms, with or without
00006 // modification, are permitted provided that the following conditions are met:
00007 //     * Redistributions of source code must retain the above copyright
00008 //       notice, this list of conditions and the following disclaimer.
00009 //     * Redistributions in binary form must reproduce the above copyright
00010 //       notice, this list of conditions and the following disclaimer in the
00011 //       documentation and/or other materials provided with the distribution.
00012 //     * Neither the name of the Flight Systems and Automatic Control group,
00013 //       TU Darmstadt, nor the names of its contributors may be used to
00014 //       endorse or promote products derived from this software without
00015 //       specific prior written permission.
00016 
00017 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
00018 // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
00019 // WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
00020 // DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY
00021 // DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
00022 // (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
00023 // LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
00024 // ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
00025 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
00026 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00027 //=================================================================================================
00028 
00029 #ifndef HECTOR_POSE_ESTIMATION_GLOBAL_REFERENCE_H
00030 #define HECTOR_POSE_ESTIMATION_GLOBAL_REFERENCE_H
00031 
00032 #include <hector_pose_estimation/types.h>
00033 #include <hector_pose_estimation/parameters.h>
00034 
00035 namespace hector_pose_estimation {
00036 
00037   class PoseEstimation;
00038 
00039   class GlobalReference {
00040   public:
00041     struct Position {
00042       Position() : latitude(0.0), longitude(0.0), altitude(0.0) {}
00043       double latitude;
00044       double longitude;
00045       double altitude;
00046     };
00047 
00048     struct Heading {
00049       Heading() : value(0.0), cos(1.0), sin(0.0) {}
00050       double value;
00051       double cos;
00052       double sin;
00053       operator double() const { return value; }
00054     };
00055 
00056     struct Radius {
00057       Radius() : north(0.0), east(0.0) {}
00058       double north;
00059       double east;
00060     };
00061 
00062     const Position& position() const { return position_; }
00063     const Heading& heading() const { return heading_; }
00064     const Radius& radius() const { return radius_; }
00065 
00066     GlobalReference& setPosition(double latitude, double longitude, bool quiet = false);
00067     GlobalReference& setHeading(double heading, bool quiet = false);
00068     GlobalReference& setAltitude(double altitude, bool quiet = false);
00069 
00070     GlobalReference& setCurrentPosition(const State& state, double latitude, double longitude);
00071     GlobalReference& setCurrentHeading(const State& state, double heading);
00072     GlobalReference& setCurrentAltitude(const State& state, double altitude);
00073 
00074     bool hasPosition() const { return has_position_; }
00075     bool hasHeading() const  { return has_heading_; }
00076     bool hasAltitude() const { return has_altitude_; }
00077 
00078     void fromWGS84(double latitude, double longitude, double &x, double &y);
00079     void toWGS84(double x, double y, double &latitude, double &longitude);
00080     void fromNorthEast(double north, double east, double &x, double &y);
00081     void toNorthEast(double x, double y, double &north, double &east);
00082 
00083     ParameterList& parameters();
00084 
00085     static const GlobalReferencePtr &Instance();
00086 
00087     void updated();
00088     void reset();
00089 
00090   private:
00091     GlobalReference();
00092 
00093     Position position_;
00094     Heading heading_;
00095     Radius radius_;
00096 
00097     bool has_position_;
00098     bool has_heading_;
00099     bool has_altitude_;
00100 
00101     ParameterList parameters_;
00102   };
00103 
00104 } // namespace hector_pose_estimation
00105 
00106 #endif // HECTOR_POSE_ESTIMATION_GLOBAL_REFERENCE_H


hector_pose_estimation_core
Author(s): Johannes Meyer
autogenerated on Mon Oct 6 2014 00:24:16