raysensor.h

Go to the documentation of this file.
00001 /*************************************************************************** 00002 * Copyright (C) 2005 by Robot Group Leipzig * 00003 * martius@informatik.uni-leipzig.de * 00004 * fhesse@informatik.uni-leipzig.de * 00005 * der@informatik.uni-leipzig.de * 00006 * * 00007 * This program is free software; you can redistribute it and/or modify * 00008 * it under the terms of the GNU General Public License as published by * 00009 * the Free Software Foundation; either version 2 of the License, or * 00010 * (at your option) any later version. * 00011 * * 00012 * This program 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 * 00015 * GNU General Public License for more details. * 00016 * * 00017 * You should have received a copy of the GNU General Public License * 00018 * along with this program; if not, write to the * 00019 * Free Software Foundation, Inc., * 00020 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * 00021 * * 00022 * $Log: raysensor.h,v $ 00023 * Revision 1.7 2006/09/20 12:56:28 martius 00024 * setRange 00025 * 00026 * Revision 1.6 2006/08/28 12:18:31 martius 00027 * documentation 00028 * 00029 * Revision 1.5 2006/08/08 17:03:27 martius 00030 * new sensors model 00031 * 00032 * Revision 1.4 2006/07/14 12:23:43 martius 00033 * selforg becomes HEAD 00034 * 00035 * Revision 1.3.4.3 2006/01/31 15:46:16 martius 00036 * virtual destructor 00037 * 00038 * Revision 1.3.4.2 2005/12/13 18:11:53 martius 00039 * sensors ported, but not yet finished 00040 * 00041 * Revision 1.3.4.1 2005/11/14 17:37:21 martius 00042 * moved to selforg 00043 * 00044 * Revision 1.3 2005/09/27 13:59:26 martius 00045 * ir sensors are working now 00046 * 00047 * Revision 1.2 2005/09/27 11:03:34 fhesse 00048 * sensorbank added 00049 * 00050 * Revision 1.1 2005/09/22 12:56:47 martius 00051 * ray based sensors 00052 * 00053 * * 00054 ***************************************************************************/ 00055 #ifndef __RAYSENSOR_H 00056 #define __RAYSENSOR_H 00057 00058 #include <ode/common.h> 00059 #include "osgforwarddecl.h" 00060 #include "odehandle.h" 00061 #include "osghandle.h" 00062 00063 00064 namespace lpzrobots { 00065 class Primitive; 00066 00067 /** Abstract class for Ray-based sensors. 00068 This are sensors which are based on distance measurements using the ODE geom class Ray. 00069 The sensor value is obtained by collisions. 00070 However of no collision is detected the sensor needs to ajust its output as well. 00071 Therefore a reset function is provided. 00072 See also RaySensorBank, which is an object for managing multiple ray sensors. 00073 */ 00074 class RaySensor { 00075 public: 00076 enum rayDrawMode { drawNothing, drawRay, drawSensor, drawAll}; 00077 00078 RaySensor() {} 00079 virtual ~RaySensor(){} 00080 00081 /** providing essential informations 00082 @param odeHandle OdeHandle 00083 @param osgHandle OsgHandle 00084 @param body primitive to which the sensor will be attached 00085 @param pose relative pose in respect to body in which the sensor will be placed 00086 @param range length of the sensor 00087 @param drawMode whether to draw nothing, sensor body, ray, or both 00088 */ 00089 virtual void init(const OdeHandle& odeHandle, 00090 const OsgHandle& osgHandle, Primitive* body, 00091 const osg::Matrix pose, double range, 00092 rayDrawMode drawMode = drawSensor) = 0; 00093 00094 /** used for reseting the sensor value to a value of maximal distance. 00095 */ 00096 virtual void reset() = 0; 00097 00098 /** performs sense action by checking collision with the given object 00099 @return true for collision handled (sensed) and false for no interaction 00100 */ 00101 virtual bool sense(dGeomID object) = 0; 00102 00103 /** returns the sensor value (usually in the range [-1,1] ) 00104 */ 00105 virtual double get() = 0; 00106 00107 /** set the range of the sensor 00108 @param range new length of the sensor 00109 */ 00110 virtual void setRange(double range) = 0; 00111 00112 /** updates the position of the osg nodes 00113 */ 00114 virtual void update() = 0; 00115 00116 /** returns the geomID of the ray geom (used for optimisation) 00117 */ 00118 virtual dGeomID getGeomID() =0; 00119 00120 }; 00121 00122 } 00123 00124 #endif

Generated on Tue Jan 16 02:14:37 2007 for Robotsystem of the Robot Group Leipzig by doxygen 1.3.8