00001 /** 00002 * @file PSDPercept.h 00003 * 00004 * Declaration of classes PSDPercept 00005 * 00006 * @author Martin Lötzsch 00007 */ 00008 00009 #ifndef __PSDPercept_h_ 00010 #define __PSDPercept_h_ 00011 00012 00013 #include "Tools/Streams/InOut.h" 00014 #include "Tools/Math/Vector3.h" 00015 #include "SensorDataBuffer.h" 00016 00017 00018 /** 00019 * @class SinglePSDPercept 00020 * 00021 * A spot relative to the robot that was detected by the PSD Sensor. 00022 * 00023 * @author Martin Lötzsch 00024 */ 00025 class SinglePSDPercept : public Vector3<double> 00026 { 00027 public: 00028 00029 /** The frame number when perceived. */ 00030 unsigned long frameNumber; 00031 00032 /** 00033 * The functions sets the frame number 00034 */ 00035 void setFrameNumber(unsigned long frameNumber) {this->frameNumber = frameNumber;} 00036 00037 /** 00038 * If true, then the object was farer away than 90 cm 00039 * The measured distance is then clipped to 90 cm 00040 */ 00041 bool tooFarAway; 00042 00043 /** 00044 * The tilt of the robot's head. Necessary because 00045 * sometimes you don't want to trust the PSD if 00046 * things are measured below a certain PSD angle 00047 */ 00048 double neckTilt; 00049 00050 /** The PSDPercept is only valid if motion was stable. */ 00051 bool isValid; 00052 00053 /** 00054 * value of the body psd sensor (if present) 00055 */ 00056 double body; 00057 00058 /** Constructor */ 00059 SinglePSDPercept(); 00060 00061 /** Destructor */ 00062 ~SinglePSDPercept(); 00063 }; 00064 00065 /** 00066 * @class PSDPercept 00067 * 00068 * Class containg all single PSD spots perceived in one frame. 00069 * 00070 * @author Max Risler 00071 * 00072 */ 00073 class PSDPercept 00074 { 00075 public: 00076 00077 /** number of psd percepts */ 00078 int numOfPercepts; 00079 00080 /** array of single psd percepts */ 00081 SinglePSDPercept percepts[SensorDataBuffer::maxNumOfFrames]; 00082 00083 /** Constructor */ 00084 PSDPercept(); 00085 00086 /** Destructor */ 00087 ~PSDPercept(); 00088 00089 /** [] operator */ 00090 SinglePSDPercept& operator[](int index) 00091 { 00092 return percepts[index]; 00093 } 00094 00095 /** [] operator */ 00096 const SinglePSDPercept& operator[](int index) const 00097 { 00098 return percepts[index]; 00099 } 00100 00101 }; 00102 00103 00104 /** 00105 * Streaming operator that reads a PSDPercept from a stream. 00106 * @param stream The stream from which is read. 00107 * @param psdPercept The PSDPercept object. 00108 * @return The stream. 00109 */ 00110 In& operator>>(In& stream,PSDPercept& psdPercept); 00111 00112 /** 00113 * Streaming operator that writes a PSDPercept to a stream. 00114 * @param stream The stream to write on. 00115 * @param psdPercept The PSDPercept object. 00116 * @return The stream. 00117 */ 00118 Out& operator<<(Out& stream, const PSDPercept& psdPercept); 00119 00120 /** 00121 * Streaming operator that reads a SinglePSDPercept from a stream. 00122 * @param stream The stream from which is read. 00123 * @param psdPercept The PSDPercept object. 00124 * @return The stream. 00125 */ 00126 In& operator>>(In& stream,SinglePSDPercept& psdPercept); 00127 00128 /** 00129 * Streaming operator that writes a SinglePSDPercept to a stream. 00130 * @param stream The stream to write on. 00131 * @param psdPercept The PSDPercept object. 00132 * @return The stream. 00133 */ 00134 Out& operator<<(Out& stream, const SinglePSDPercept& psdPercept); 00135 00136 00137 #endif //__PSDPercept_h_ 00138 00139 /* 00140 * Change log : 00141 * 00142 * $Log: PSDPercept.h,v $ 00143 * Revision 1.2 2004/05/27 17:13:38 jhoffman 00144 * - renaming: tilt1 -> neckTilt, pan -> headPan, tilt2 -> headTilt 00145 * - clipping included for setJoints 00146 * - removed some microrad/rad-bugs 00147 * - bodyPosture constructor and "=" operator fixed 00148 * 00149 * Revision 1.1.1.1 2004/05/22 17:25:59 cvsadm 00150 * created new repository GT2004_WM 00151 * 00152 * Revision 1.6 2004/03/10 14:16:33 risler 00153 * body psd value added to PSDPercept and ObstaclesModel 00154 * 00155 * Revision 1.5 2004/01/19 14:53:46 dueffert 00156 * all frameNumbers (and not only some of them) are unsigned long now 00157 * 00158 * Revision 1.4 2003/11/17 15:15:08 dueffert 00159 * doxygen docu corrected 00160 * 00161 * Revision 1.3 2003/11/14 19:02:25 goehring 00162 * frameNumber added 00163 * 00164 * Revision 1.2 2003/11/13 14:18:56 goehring 00165 * frameNumber added 00166 * 00167 * Revision 1.1 2003/10/07 10:09:36 cvsadm 00168 * Created GT2004 (M.J.) 00169 * 00170 * Revision 1.1.1.1 2003/07/02 09:40:22 cvsadm 00171 * created new repository for the competitions in Padova from the 00172 * tamara CVS (Tuesday 2:00 pm) 00173 * 00174 * removed unused solutions 00175 * 00176 * Revision 1.4 2003/06/21 12:50:53 juengel 00177 * Added isValid. 00178 * 00179 * Revision 1.3 2003/05/14 19:54:42 risler 00180 * PSDPercept contains all points from one frame 00181 * 00182 * Revision 1.2 2003/04/06 17:14:37 jhoffman 00183 * added headTilt to PSDpercept and added debugging capabilities to microsectors 00184 * 00185 * Revision 1.1 2002/10/10 13:09:50 loetzsch 00186 * First experiments with the PSD Sensor 00187 * - SensorDataProcessor now calculates PSDPercept 00188 * - Added the PerceptBehaviorControl solution PSDTest 00189 * - Added the RadarViewer3D to RobotControl, which can display the Points3D structure 00190 * 00191 */