00001 /***************************************************************** 00002 * 00003 * This file is part of the FLIRTLib project 00004 * 00005 * FLIRTLib Copyright (c) 2010 Gian Diego Tipaldi and Kai O. Arras 00006 * 00007 * This software is licensed under the "Creative Commons 00008 * License (Attribution-NonCommercial-ShareAlike 3.0)" 00009 * and is copyrighted by Gian Diego Tipaldi and Kai O. Arras 00010 * 00011 * Further information on this license can be found at: 00012 * http://creativecommons.org/licenses/by-nc-sa/3.0/ 00013 * 00014 * FLIRTLib is distributed in the hope that it will be useful, 00015 * but WITHOUT ANY WARRANTY; without even the implied 00016 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00017 * PURPOSE. 00018 * 00019 *****************************************************************/ 00020 00021 00022 00023 #ifndef LASERREADING_H_ 00024 #define LASERREADING_H_ 00025 00026 #include <sensors/AbstractReading.h> 00027 #include <geometry/point.h> 00028 #include <string> 00029 #include <vector> 00030 #include <cmath> 00031 00039 class LaserReading: public AbstractReading { 00040 public: 00049 LaserReading(const std::vector<double>& _phi, const std::vector<double>& _rho, 00050 double _time = 0.0, const std::string& _name = "ROBOTLASER1", const std::string& _robot = ""); 00051 00053 virtual ~LaserReading(); 00054 00056 virtual AbstractReading* clone() const; 00057 00058 00059 // Getter Methods 00061 inline const std::vector<double>& getPhi() const 00062 {return m_phi;} 00064 inline const std::vector<double>& getRho() const 00065 {return m_rho;} 00067 inline unsigned int getPolar(const std::vector<double>*& _phi, const std::vector<double>*& _rho) const 00068 {_phi = &m_phi; _rho = &m_rho; return m_phi.size();} 00073 inline const std::vector<Point2D>& getCartesian() const 00074 {return m_cartesian;} 00079 inline const std::vector<Point2D>& getWorldCartesian() const 00080 {return m_worldCartesian;} 00082 inline const std::vector<double>& getRemission() const 00083 {return m_remission;} 00085 inline double getMaxRange() const 00086 {return m_maxRange;} 00088 inline const OrientedPoint2D& getLaserPose() const 00089 {return m_laserPose;} 00090 00091 00092 // Setter Methods 00097 void setRemission(const std::vector<double>& _remi); 00099 inline void setMaxRange(double _max) 00100 {m_maxRange = _max; computeWorldCartesian(); computeLocalCartesian();} 00102 void setLaserPose(const OrientedPoint2D& _pose); 00103 00104 protected: 00106 void computeWorldCartesian(); 00111 void computeLocalCartesian(); 00113 double m_maxRange; 00115 OrientedPoint2D m_laserPose; 00117 std::vector<double> m_phi; 00119 std::vector<double> m_rho; 00121 std::vector<Point2D> m_worldCartesian; 00123 std::vector<Point2D> m_cartesian; 00125 std::vector<double> m_remission; 00126 }; 00127 00128 #endif