Gazebo

RaySensor.hh

00001 /*
00002  *  Gazebo - Outdoor Multi-Robot Simulator
00003  *  Copyright (C) 2003  
00004  *     Nate Koenig & Andrew Howard
00005  *
00006  *  This program is free software; you can redistribute it and/or modify
00007  *  it under the terms of the GNU General Public License as published by
00008  *  the Free Software Foundation; either version 2 of the License, or
00009  *  (at your option) any later version.
00010  *
00011  *  This program is distributed in the hope that it will be useful,
00012  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  *  GNU General Public License for more details.
00015  *
00016  *  You should have received a copy of the GNU General Public License
00017  *  along with this program; if not, write to the Free Software
00018  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00019  *
00020  */
00021 /* Desc: RaySensor proximity sensor
00022  * Author: Carle Cote
00023  * Date: 23 february 2004
00024  * SVN: $Id: RaySensor.hh 156 2007-11-26 20:26:57Z natepak $
00025 */
00026 
00027 #ifndef RAYSENSOR_HH
00028 #define RAYSENSOR_HH
00029 
00030 #include <vector>
00031 
00032 #include "Sensor.hh"
00033 #include "Body.hh"
00034 
00035 namespace gazebo
00036 {
00037 
00038   class XMLConfigNode;
00039   class RayGeom;
00045 // \{
00046 
00052 class RaySensor: public Sensor
00053 {
00057   public: RaySensor(Body *body);
00058 
00060   public: virtual ~RaySensor();
00061 
00064   protected: virtual void LoadChild(XMLConfigNode *node);
00065 
00067   protected: virtual void InitChild();
00068 
00070   protected: virtual void UpdateChild(UpdateParams &params);
00071   
00073   protected: virtual void FiniChild();
00074 
00077   public: double GetMinAngle() const;
00078 
00081   public: double GetMaxAngle() const;
00082 
00085   public: double GetMinRange() const;
00086 
00089   public: double GetMaxRange() const;
00090 
00093   public: int GetRayCount() const;
00094 
00097   public: int GetRangeCount() const;
00098 
00103   public: void SetRay(int index, const Vector3 &a, const Vector3 &b);
00104 
00108   public: void GetRay(int index, Vector3 &pos, Vector3 &dir);
00109 
00112   public: double GetRange(int index);   
00113 
00115   public: double GetRetro(int index);   
00116 
00118   public: int GetFiducial(int index);   
00119 
00121   private: static void UpdateCallback( void *data, dGeomID o1, dGeomID o2 );
00122   
00124   private: dSpaceID superSpaceId;
00125   private: dSpaceID raySpaceId; 
00126 
00128   private: std::vector<RayGeom*> rays;
00129 
00130   private: double minAngle, maxAngle;
00131   private: double minRange, maxRange;
00132   private: Vector3 origin;
00133 
00134   private: Pose3d prevPose;
00135   private: int rayCount;
00136   private: int rangeCount;
00137 
00138 };
00141 }
00142 
00143 #endif

Last updated Aug 04 2007