00001 /** 00002 \file Robots/LoBot/misc/LoPose.H 00003 \brief A simple structure for holding a robot's pose. 00004 00005 This file defines a class that holds a robot's pose, viz., its 00006 location and bearing. 00007 */ 00008 00009 // //////////////////////////////////////////////////////////////////// // 00010 // The iLab Neuromorphic Vision C++ Toolkit - Copyright (C) 2000-2005 // 00011 // by the University of Southern California (USC) and the iLab at USC. // 00012 // See http://iLab.usc.edu for information about this project. // 00013 // //////////////////////////////////////////////////////////////////// // 00014 // Major portions of the iLab Neuromorphic Vision Toolkit are protected // 00015 // under the U.S. patent ``Computation of Intrinsic Perceptual Saliency // 00016 // in Visual Environments, and Applications'' by Christof Koch and // 00017 // Laurent Itti, California Institute of Technology, 2001 (patent // 00018 // pending; application number 09/912,225 filed July 23, 2001; see // 00019 // http://pair.uspto.gov/cgi-bin/final/home.pl for current status). // 00020 // //////////////////////////////////////////////////////////////////// // 00021 // This file is part of the iLab Neuromorphic Vision C++ Toolkit. // 00022 // // 00023 // The iLab Neuromorphic Vision C++ Toolkit is free software; you can // 00024 // redistribute it and/or modify it under the terms of the GNU General // 00025 // Public License as published by the Free Software Foundation; either // 00026 // version 2 of the License, or (at your option) any later version. // 00027 // // 00028 // The iLab Neuromorphic Vision C++ Toolkit is distributed in the hope // 00029 // that it will be useful, but WITHOUT ANY WARRANTY; without even the // 00030 // implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR // 00031 // PURPOSE. See the GNU General Public License for more details. // 00032 // // 00033 // You should have received a copy of the GNU General Public License // 00034 // along with the iLab Neuromorphic Vision C++ Toolkit; if not, write // 00035 // to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, // 00036 // Boston, MA 02111-1307 USA. // 00037 // //////////////////////////////////////////////////////////////////// // 00038 // 00039 // Primary maintainer for this file: mviswana usc edu 00040 // $HeadURL: svn://isvn.usc.edu/software/invt/trunk/saliency/src/Robots/LoBot/slam/LoPose.H $ 00041 // $Id: LoPose.H 13619 2010-06-25 01:59:32Z mviswana $ 00042 // 00043 00044 #ifndef LOBOT_POSE_DOT_H 00045 #define LOBOT_POSE_DOT_H 00046 00047 //------------------------------ HEADERS -------------------------------- 00048 00049 // lobot headers 00050 #include "Robots/LoBot/util/triple.hh" 00051 00052 // Standard C++ headers 00053 #include <ostream> 00054 00055 //----------------------------- NAMESPACE ------------------------------- 00056 00057 namespace lobot { 00058 00059 //------------------------- CLASS DEFINITION ---------------------------- 00060 00061 /** 00062 \class lobot::Pose 00063 \brief A simple structure for representing a robot's pose. 00064 00065 A robot's pose consists of its location specified using an (x, y) 00066 coordinate pair and its heading/bearing (i.e., theta). This class 00067 packages these three quantities in one neat little bundle. 00068 */ 00069 class Pose { 00070 /// The robot's pose consists of an (x, y) position within the map 00071 /// and an angle to indicate the direction in which the robot is 00072 /// pointed. 00073 triple<float, float, float> m_pose ; 00074 00075 public: 00076 /// Pose initialization. 00077 //@{ 00078 Pose(float x = 0, float y = 0, float theta = 0) ; 00079 Pose(const triple<float, float, float>& pose) ; 00080 //@} 00081 00082 /// Retrieving pose values. 00083 //@{ 00084 float x() const {return m_pose.first ;} 00085 float y() const {return m_pose.second ;} 00086 float t() const {return m_pose.third ;} 00087 float theta() const {return t() ;} 00088 float heading() const {return t() ;} 00089 float bearing() const {return t() ;} 00090 //@} 00091 00092 /// Updating pose values. 00093 //@{ 00094 void x(float xx) {m_pose.first = xx ;} 00095 void y(float yy) {m_pose.second = yy ;} 00096 void t(float th) ; 00097 void theta(float th) {t(th) ;} 00098 void heading(float th) {t(th) ;} 00099 void bearing(float th) {t(th) ;} 00100 00101 void dx(float d) {m_pose.first += d ;} 00102 void dy(float d) {m_pose.second += d ;} 00103 void dt(float t) ; 00104 void dtheta(float t) {dt(t) ;} 00105 //@} 00106 00107 /// This operator adds this pose to another and retains the result in 00108 /// this Pose object itself. 00109 Pose& operator+=(const Pose&) ; 00110 00111 /// This operator adds this pose to another and returns the result via 00112 /// a new Pose object. 00113 Pose operator+(const Pose&) const ; 00114 00115 /// This operator multiplies this pose's values by the supplied 00116 /// weighting factor and returns the scaled result in a new Pose 00117 /// object. 00118 Pose operator*(float weight) const ; 00119 } ; 00120 00121 //----------------------- NON-MEMBER FUNCTIONS -------------------------- 00122 00123 /// Dump a pose to an output stream. 00124 std::ostream& operator<<(std::ostream&, const Pose&) ; 00125 00126 //----------------------------------------------------------------------- 00127 00128 } // end of namespace encapsulating this file's definitions 00129 00130 #endif 00131 00132 /* So things look consistent in everyone's emacs... */ 00133 /* Local Variables: */ 00134 /* indent-tabs-mode: nil */ 00135 /* End: */