Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

# Representations/Perception/PSDPercept.h

Go to the documentation of this file.

    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_