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

Modules/SensorBehaviorControl/MotionRecognition.h

Go to the documentation of this file.
00001 /**
00002 * @file MotionRecognition.h
00003 *
00004 * Definition of class MotionRecognition
00005 *
00006 * @author <a href="mailto:ordyniak@informatik.hu-berlin.de">Sebastian Ordyniak</a>
00007 * @author <a href="mailto:richert@informatik.hu-berlin.de">Marten Richert</a>
00008 */
00009 
00010 #ifndef __MotionRecognition_h_
00011 #define __MotionRecognition_h_
00012 
00013 #include "Modules/SensorBehaviorControl/SensorBehaviorControl.h"
00014 #include "Tools/Debugging/DebugDrawings.h"
00015 #include "Tools/Math/Geometry.h"
00016 #include "Tools/Debugging/DebugImages.h"
00017 #include "Tools/Actorics/RobotDimensions.h"
00018 
00019 /** distance of infinty in mm */
00020 #define DISTANCE_INFINITY 3000
00021 /** mm*/
00022 #define BRENNWEITE 2.18
00023 #define IMAGEBUFFERSIZE 2
00024 
00025 /**
00026 * @class MotionRecognition
00027 *
00028 * @author <a href="mailto:ordyniak@informatik.hu-berlin.de">Sebastian Ordyniak</a>
00029 * @author <a href="mailto:richert@informatik.hu-berlin.de">Marten Richert</a>
00030 */ 
00031 
00032 class MotionRecognition : public SensorBehaviorControl
00033 {
00034 public:
00035   /** 
00036   * Constructor.
00037   * @param interfaces The paramters of the MotionRecognition module.
00038   */
00039   MotionRecognition(const SensorBehaviorControlInterfaces& interfaces);
00040 
00041   /**
00042   * transforms pixelcoordinates to grad
00043   * @param pCentered - centered xy-pixelcoordinates
00044   * @return centered angle coors in grad
00045   */
00046   Vector2<double> getAngleYZ(Vector2<int> pCentered);
00047 
00048 
00049   int isDiff(Image& image1, Image& image2, Vector2<int> p1, Vector2<int> p2);
00050 
00051   /**
00052   * shifts coordinatesource from top-left to center of image
00053   * @param p top-left coordinates
00054   * @return centered imagecoordinates
00055   */
00056   Vector2<int> getCenteredCoor(Vector2<int> p);
00057 
00058   /**
00059   * transforms pixelcoordinates to mm
00060   * @param p pixel coordinates
00061   * @return coordinates in mm
00062   */
00063   Vector2<double> getCoorInmm(Vector2<int> p);
00064   
00065   /**
00066   * transforms pixelcoordinates to mm
00067   * @param p pixel coordinates
00068   * @return coordinates in mm
00069   */
00070   Vector2<int> getCoorInPixel(Vector2<double> p);
00071 
00072   /**
00073   * calculates xy-shift of a pixel
00074   * @param pCentered centered pixelcoordinates
00075   * @param z distance from the object belonging to pixel to camera
00076   * @param cameraMovement movement of the camera (in mm)
00077   * @param cameraRotation rotation of the camera (in grad)
00078   * @return xy-shift of pixel
00079   */
00080   Vector2<int> getPixelFlow(Vector2<double> pCentered, double z, Vector3<double> cameraMovement, Vector3<double> cameraRotation);
00081 
00082   /**
00083   * calculates newPixelposition after movement and rotation of the camera
00084   * @param p pixelcoordinates (coordinatesource = top-left
00085   * @param cameraMovement movement of the camera (in mm)
00086   * @param cameraRotation rotation of the camera (in grad)
00087   * @return new pixelposition
00088   */
00089   Vector2<int> getNewPixelPos(Vector2<int> p, Vector3<double> cameraMovement, Vector3<double> cameraRotation);
00090 
00091   /**
00092   * calculates distance from camera to object (xy-plain)
00093   * @param angleYZ angle of cameraray
00094   * @return istance from camera to object (xy-plain)
00095   */
00096   double getCameraZ(Vector2<double> angleYZ);
00097   
00098   /**
00099   * calculates cameratranslation
00100   * @param robotTranslation
00101   * @return cameraTranslation
00102   */
00103   Vector3<double> getCameraTranslation(Vector3<double> robotTranslation);
00104 
00105   Vector3<double> getCameraTranslation(double bounce);
00106   Vector3<double> getCameraRotation(double bounce);
00107 
00108   Vector3<double> getRobotTranslationFromOdometry();
00109 
00110   Vector3<double> getRobotTranslationFromBounce(double bounce);
00111   
00112   Vector3<double> getRobotRotationFromOdometry();
00113 
00114   Vector3<double> getRobotRotationFromBounce(double bounce);
00115 
00116 
00117   Vector3<double> getRobotTranslationForRotation(double robotRotationZ);
00118   int pixelInImage(Vector2<int> p);
00119 
00120 
00121   double getPixelDiff(Vector2<int> raster, double bounce, Image& image1, Image& image2, int draw);
00122   double getPixelDiff(Vector2<int> raster, double bounce, Image& image1, Image& image2);
00123   void drawPixelFlow(Vector3<double> cameraTranslation, Vector3<double> cameraRotation);
00124   void drawDynamicDiff(Image& image1, Image& image2, double timeDiff);
00125 
00126   /** Executes the module */
00127   virtual void execute();
00128   virtual bool handleMessage(InMessage& message);
00129 
00130   DECLARE_DEBUG_IMAGE(imageMotionRecognition);
00131   DECLARE_DEBUG_IMAGE(imageProcessorGradients);
00132 
00133 private:
00134   OdometryData previousOdometry;
00135   Vector2<double> pixelDimensions;
00136   Image imageBuffer[IMAGEBUFFERSIZE];
00137   unsigned long imageTimes[IMAGEBUFFERSIZE];
00138   int start, currentImage, imagesLeft;
00139 
00140   // images for debugging
00141   Image motionRecognitionImage, processorGradientsImage;
00142 };
00143 #endif// __MotionRecognition_h_
00144 
00145 /*
00146 * Change log :
00147 * 
00148 * $Log: MotionRecognition.h,v $
00149 * Revision 1.1.1.1  2004/05/22 17:20:52  cvsadm
00150 * created new repository GT2004_WM
00151 *
00152 * Revision 1.9  2004/03/08 02:11:49  roefer
00153 * Interfaces should be const
00154 *
00155 * Revision 1.8  2004/01/29 17:03:54  dueffert
00156 * doxygen bug fixed
00157 *
00158 * Revision 1.7  2004/01/07 17:16:00  ordyniak
00159 * debugimages angepasst
00160 *
00161 * Revision 1.6  2004/01/07 16:53:42  ordyniak
00162 * umgestellt auf odometrydata für logfiles
00163 *
00164 * Revision 1.5  2004/01/04 10:10:27  juengel
00165 * Errors and warnings removed.
00166 *
00167 * Revision 1.4  2004/01/03 23:12:51  ordyniak
00168 * new concept
00169 *
00170 */

Generated on Thu Sep 23 19:57:32 2004 for GT2004 by doxygen 1.3.6