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

# Representations/Perception/SpecialPercept.h

Go to the documentation of this file.

    00001 /**
    00002 * @file SpecialPercept.h
    00003 *
    00004 * Declaration of class SpecialPercept
    00005 *
    00006 * @author <A href=mailto:juengel@informatik.hu-berlin.de>Matthias Juengel</A>, <A href=mailto:brunn@sim.tu-darmstadt.de>Ronnie Brunn</A>
    00007 */
    00008
    00009 #ifndef __SpecialPercept_h_
    00010 #define __SpecialPercept_h_
    00011
    00012
    00013 #include "Tools/Streams/InOut.h"
    00014 #include "Tools/Math/Pose2D.h"
    00015 #include "Tools/Math/Vector2.h"
    00016 #include "Tools/Math/Geometry.h"
    00017 #include "Tools/ColorClasses.h"
    00018
    00019
    00020
    00021 class SpecialLandmark
    00022 {
    00023 public:
    00024   colorClass sectors[8];
    00025   Vector2<int> center;
    00026   Vector2<int> size;
    00027   Vector2<double> angles;
    00028 };
    00029
    00030 /** A class that contains a certain bitePoint at the open challenge bridge
    00031   * @author <A href=mailto:jochen@kerdels.de>Jochen Kerdels</A>
    00032   */
    00033 class BitePoint
    00034 {
    00035   public:
    00036     /** Constructor */
    00037     BitePoint();
    00038
    00039     /** The different bitePoints */
    00040     enum Position
    00041     {
    00042       none = -1,
    00043       frontleft = 0,
    00044       frontright,
    00045       behindleft,
    00046       behindright,
    00047       master,
    00048       numOfPositions
    00049     };
    00050
    00051     /** postion of the bitePoint at the oc bridge */
    00052     Position position;
    00053
    00054     /** relative angle to the bitePoint */
    00055     double angleTo;
    00056     /** relative  distance to the bitePoint */
    00057     double distanceTo;
    00058     /** the relative position of the bitePoint */
    00059     Vector2<double> relPos;
    00060     /** the preciseShift to either left or right
    00061       * while in front of the bytePoint
    00062       */
    00063     double preciseShift;
    00064
    00065     /** time when the bitePoint was last seen by the own camera */
    00066     unsigned long timeWhenLastSeen;
    00067
    00068     /** method to add a new percept */
    00069     void addPercept(double aAngleTo, double aDistanceTo, double aPreciseShift);
    00070
    00071     /** indicates fresh-data */
    00072     bool fresh;
    00073
    00074     /** last odometry-data */
    00075     Pose2D lastOdometry;
    00076
    00077 };
    00078
    00079 /**
    00080  * Streaming operator that reads a BitePoint from a stream.
    00081  * @param stream The stream from which is read.
    00082  * @param bitePoint The BitePoint object.
    00083  * @return The stream.
    00084  */
    00085 In& operator>>(In& stream,BitePoint& bitePoint);
    00086
    00087 /**
    00088  * Streaming operator that writes a BitePoint to a stream.
    00089  * @param stream The stream to write on.
    00090  * @param bitePoint The BitePoint object.
    00091  * @return The stream.
    00092 */
    00093 Out& operator<<(Out& stream, const BitePoint& bitePoint);
    00094
    00095
    00096
    00097
    00098 /** A class that contains data of the bridge for the openchallenge
    00099   * @author <A href=mailto:jochen@kerdels.de>Jochen Kerdels</A>
    00100   */
    00101 class OCBridge
    00102 {
    00103   public:
    00104     /** Constructor */
    00105     OCBridge();
    00106
    00107     /** The different Sides of the bridge */
    00108     enum Side
    00109     {
    00110       none = 0,
    00111       left,
    00112       right,
    00113       numOfSides
    00114     };
    00115
    00116     /** side of the bridge actually last seen by the camera */
    00117     Side lastSeenSide;
    00118
    00119     /** relative angle to the bridge (middle of the sidemark) */
    00120     double angleTo;
    00121     /** relative  distance to the bridge (middle of the sidemark) */
    00122     double distanceTo;
    00123     /** the relative position of the bridge (middle of the sidemark) */
    00124     Vector2<double> relPos;
    00125
    00126     /** time when the bridge was last seen by the own camera */
    00127     unsigned long timeWhenLastSeen;
    00128
    00129     /** the bitePoints of the bridge */
    00130     BitePoint bitePoint[BitePoint::numOfPositions];
    00131
    00132     /** method to add a new percept */
    00133     void addPercept(double aAngleTo, double aDistanceTo);
    00134
    00135     /** indicates fresh-data */
    00136     bool fresh;
    00137
    00138     /** last odometry-data */
    00139     Pose2D lastOdometry;
    00140 };
    00141
    00142 /**
    00143  * Streaming operator that reads a OCBridge from a stream.
    00144  * @param stream The stream from which is read.
    00145  * @param ocBridge The OCBridge object.
    00146  * @return The stream.
    00147  */
    00148 In& operator>>(In& stream,OCBridge& ocBridge);
    00149
    00150 /**
    00151  * Streaming operator that writes a OCBridge to a stream.
    00152  * @param stream The stream to write on.
    00153  * @param ocBridge The OCBridge object.
    00154  * @return The stream.
    00155 */
    00156 Out& operator<<(Out& stream, const OCBridge& ocBridge);
    00157
    00158
    00159 /** A class that contains data of the bridge's red line for the open challenge
    00160   */
    00161 class OCRedLine
    00162 {
    00163   public:
    00164     /** Constructor */
    00165     OCRedLine();
    00166
    00167   /** flag to know if red Line has been seen or not */
    00168   bool seen;
    00169
    00170     /** Startpoint and endpont of red line
    00171     The startpoint is nearer to the robot e.g. on the bottom of the image
    00172   */
    00173   Vector2<int> lineStart;
    00174   Vector2<int> lineEnd;
    00175   Vector2<int> pointStart;
    00176   Vector2<int> pointEnd;
    00177   int angleInImage; // angle of red line in image. 0 is exactly vertical.
    00178   unsigned long timeWhenLastSeen; /** time when the bridge was last seen by the own camera */
    00179
    00180
    00181     /** method to add a new percept */
    00182   void addPercept(Vector2<int> lineStart, Vector2<int> lineEnd, Vector2<int> pointStart,Vector2<int> pointEnd,int angleInImage);
    00183 };
    00184
    00185 /**
    00186  * Streaming operator that reads a red line from a stream.
    00187  * @param stream The stream from which is read.
    00188  * @param ocRedLine the ocRedLine object.
    00189  * @return The stream.
    00190  */
    00191 In& operator>>(In& stream,OCRedLine& ocRedLine);
    00192
    00193 /**
    00194  * Streaming operator that writes a red line to a stream.
    00195  * @param stream The stream to write on.
    00196  * @param ocRedLine The ocRedLine object.
    00197  * @return The stream.
    00198 */
    00199 Out& operator<<(Out& stream, const OCRedLine& ocRedLine);
    00200
    00201
    00202 /** A class that contains a certain specialPercept
    00203   * @author <A href=mailto:juengel@informatik.hu-berlin.de>Matthias Juengel</A>
    00204   * @author <A href=mailto:loetzsch@informatik.hu-berlin.de>Martin Lötzsch</A>
    00205   */
    00206 class SpecialPercept
    00207 {
    00208   public:
    00209     /** Constructor */
    00210     SpecialPercept();
    00211     ~SpecialPercept();
    00212
    00213     /** Reset special percept. */
    00214     void reset(unsigned long frameNum=0);
    00215
    00216     /** The different specialPercept types*/
    00217     enum Type
    00218     {
    00219       motionDetection,
    00220       none,
    00221       checkerboard,
    00222       barCode,
    00223       autoShutter,
    00224     challengeOrientation,
    00225     openChallengeBridge,
    00226     openChallengeRedLine,
    00227       imageBrightness
    00228     };
    00229
    00230     /** The type of the specialPercept.*/
    00231     Type type;
    00232
    00233     /** test values (motion detection) */
    00234     double pan, tilt;
    00235     Vector2<long> mostMovement, leastMovement;
    00236
    00237     /** values (checkerboard detection) */
    00238     Pose2D checkerPose;
    00239     unsigned long frameNumber;
    00240
    00241     /** An id filled by the barCodeReader */
    00242     int barCodeId;
    00243
    00244     /** Orientation of the robot in the "Almost-Slam-Challenge" **/
    00245     double orientation;
    00246     /** Some other stuff for the "Almost-Slam-Challenge" **/
    00247     void *slamData;
    00248     /** angle of pink Flags seen relative to robot **/
    00249 #define MAXSEENFLAGS 100
    00250 #define MAXLEARNFLAGS 100
    00251     double angleOfPinkFlags[MAXSEENFLAGS];
    00252     int    countAngleOfPinkFlags;
    00253
    00254     /** values for open challenge bridge detection */
    00255     OCBridge ocBridge;
    00256
    00257     /** for red line detection */
    00258     OCRedLine ocRedLine;
    00259
    00260     /** indicates if Shutter was selected */
    00261     bool shutterSelected;
    00262
    00263     SpecialLandmark specialLandmarks[6];
    00264     int numOfSpecialLandmarks;
    00265
    00266     /** estimated overall brightness of the image (for time sync with remote cam) */
    00267     unsigned char estimatedImageBrightness;
    00268 };
    00269
    00270 /**
    00271  * Streaming operator that reads a SpecialPercept from a stream.
    00272  * @param stream The stream from which is read.
    00273  * @param specialPercept The SpecialPercept object.
    00274  * @return The stream.
    00275  */
    00276 In& operator>>(In& stream,SpecialPercept& specialPercept);
    00277
    00278 /**
    00279  * Streaming operator that writes a SpecialPercept to a stream.
    00280  * @param stream The stream to write on.
    00281  * @param specialPercept The SpecialPercept object.
    00282  * @return The stream.
    00283 */
    00284 Out& operator<<(Out& stream, const SpecialPercept& specialPercept);
    00285
    00286 #endif //__SpecialPercept_h_