types.hh
00001 /* 00002 * Player - One Hell of a Robot Server 00003 * Copyright (C) 2010 00004 * Alejandro R. Mosteo 00005 * 00006 * 00007 * This library is free software; you can redistribute it and/or 00008 * modify it under the terms of the GNU Lesser General Public 00009 * License as published by the Free Software Foundation; either 00010 * version 2.1 of the License, or (at your option) any later version. 00011 * 00012 * This library is distributed in the hope that it will be useful, 00013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00015 * Lesser General Public License for more details. 00016 * 00017 * You should have received a copy of the GNU Lesser General Public 00018 * License along with this library; if not, write to the Free Software 00019 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00020 */ 00021 00022 #ifndef TYPES_HH_ 00023 #define TYPES_HH_ 00024 00025 #include <vector> 00026 00027 typedef std::vector<double> DoublesVector; 00028 00029 class Segment 00030 { 00031 public: 00032 double x1, y1, x2, y2; 00033 Segment(double x1, double y1, double x2, double y2) 00034 { 00035 this->x1 = x1; this->y1 = y1; 00036 this->x2 = x2; this->y2 = y2; 00037 } 00038 }; 00039 00040 typedef std::vector<Segment> SegmentsVector; 00041 00042 class Pose 00043 { 00044 public: 00045 double x, y, th; 00046 Pose(double x, double y, double th) 00047 { 00048 this->x = x; this->y = y; this->th = th; 00049 } 00050 }; 00051 00052 class GuiSegment 00053 { 00054 public: 00055 GuiSegment(double rho0, double phi0, double rho1, double phi1) : 00056 rho0_(rho0), phi0_(phi0), rho1_(rho1), phi1_(phi1) {}; 00057 00058 double rho0(void) const { return rho0_; }; 00059 double rho1(void) const { return rho1_; }; 00060 double phi0(void) const { return phi0_; }; 00061 double phi1(void) const { return phi1_; }; 00062 private: 00063 double rho0_, phi0_, rho1_, phi1_; 00064 }; 00065 00066 class GuiRegion : public GuiSegment 00067 { 00068 public: 00069 GuiRegion(double rho0, double phi0, double rho1, double phi1) : 00070 GuiSegment(rho0, phi0, rho1, phi1) {}; 00071 }; 00072 00073 class GuiSplit : public GuiSegment 00074 { 00075 public: 00076 GuiSplit(double rho0, double phi0, double rho1, double phi1) : 00077 GuiSegment(rho0, phi0, rho1, phi1) {}; 00078 }; 00079 00080 class GuiData 00081 { 00082 public: 00083 void Clear(void) 00084 { 00085 regions.clear(); splits.clear(); matches.clear(); mahala.clear(); 00086 laser_rho.clear(); laser_phi.clear(); 00087 } 00088 00089 std::vector<GuiRegion> regions; 00090 std::vector<GuiSplit> splits; 00091 std::vector<GuiSplit> matches; // lasers that match 00092 std::vector<double> mahala; // mahala distance of the match, norm to 1 00093 std::vector<double> laser_rho; 00094 std::vector<double> laser_phi; 00095 }; 00096 00097 extern GuiData GUI_DATA; // Declared in the driver, for passing via the opaque 00098 00099 #endif /* TYPES_HH_ */

