SE2.h

Go to the documentation of this file.
00001 // ----------------------------------------------------------------------------
00002 //
00003 // $Id$
00004 //
00005 // Copyright 2008, 2009, 2010, 2011, 2012  Antonio Franchi and Paolo Stegagno    
00006 //
00007 // This file is part of MIP.
00008 //
00009 // MIP is free software: you can redistribute it and/or modify
00010 // it under the terms of the GNU General Public License as published by
00011 // the Free Software Foundation, either version 3 of the License, or
00012 // (at your option) any later version.
00013 //
00014 // MIP is distributed in the hope that it will be useful,
00015 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00016 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017 // GNU General Public License for more details.
00018 //
00019 // You should have received a copy of the GNU General Public License
00020 // along with MIP. If not, see <http://www.gnu.org/licenses/>.
00021 //
00022 // Contact info: antonio.franchi@tuebingen.mpg.de stegagno@diag.uniroma1.it
00023 //
00024 // ----------------------------------------------------------------------------
00025 
00026 
00030 
00032 /* @{ */
00033 
00034 
00035 #ifndef __SE2_H_
00036 #define __SE2_H_
00037 
00038 #ifdef MIP_HOST_APPLE
00039 #include <applePatch.h>
00040 #endif
00041 
00042 #include <stdio.h>
00043 #include <math.h>
00044 #include <vector>
00045 #include <iostream>
00046 #include <string>
00047 #include <sstream>
00048 #include <sys/time.h>
00049 #include <sys/select.h>
00050 #include <assert.h>
00051 
00052 #ifdef FOUND_BOOST_SER
00053  #include <boost/serialization/vector.hpp>
00054  #include <boost/archive/text_iarchive.hpp>
00055  #include <boost/archive/text_oarchive.hpp>
00056 #endif
00057 
00058 #include <Types.h>
00059 
00060 #include <R2.h>
00061 #include <S1.h>
00062 #include <Time.h>
00063 
00064 using namespace std;
00065 
00070 class Pose {
00071  public:
00073   Pose();
00074   
00076   Pose(Decimal x, Decimal y,Angle theta);
00077   
00079   Pose(Position pos,Angle ori);
00080     
00082   Pose(const Pose& p);
00083     
00085   Pose& operator=(const Pose& rhs);
00086     
00088   Pose& operator+=(const Pose& a);
00089     
00091   Pose& operator-=(const Pose& a);
00092     
00094   const Pose operator+(const Pose &other) const;
00095   
00097   const Pose operator-(const Pose &other) const;
00098   
00101   const Position operator*(Position p);
00102   
00104   bool operator==(const Pose &other) const;
00105   
00107   bool operator!=(const Pose &other) const;
00108 
00110   Decimal x() const;
00111   
00113   Decimal y() const;
00114 
00116   Position pos() const;
00117 
00119   Angle ori() const;
00120   
00122   void setX(Decimal);
00123   
00125   void setY(Decimal);
00126   
00128   void setOri(Angle);
00129   
00131   bool valid();
00132   
00134   string print(int linPrecision=4,int angPrecision=2) const;
00135   
00136   // String getter & setter (Syntax "x,y,theta")
00137   bool fromString(const string& s);
00138   string toString() const;
00139 
00141   void directComposition(Pose &t);
00142   
00144   void inverseComposition(Pose &t);
00145   
00147   void uRotateFrame(Angle &t);
00148   
00150   void uInverseRotateFrame(Angle &t);
00151 
00152 
00153  private:
00154 #ifdef FOUND_BOOST_SER
00155   friend class boost::serialization::access;
00156   template<class Archive>
00157     void serialize(Archive & ar, const unsigned int version){
00158    ar & _pos; 
00159    ar & _ori;
00160    ar & _valid;
00161     }
00162 #endif
00163 
00164   Position _pos;
00165   Angle   _ori;
00166   bool   _valid; 
00167 };
00168 
00169 
00170 
00171 
00172 
00173 
00174 
00175 #endif
00176 
00177 
00178 
00179 /* @} */

Generated on Mon Feb 20 07:01:07 2017 for MIP by  doxygen 1.5.6