00001
00002
00003
00004
00005
00006
00007
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
00020 #define DISTANCE_INFINITY 3000
00021
00022 #define BRENNWEITE 2.18
00023 #define IMAGEBUFFERSIZE 2
00024
00025
00026
00027
00028
00029
00030
00031
00032 class MotionRecognition : public SensorBehaviorControl
00033 {
00034 public:
00035
00036
00037
00038
00039 MotionRecognition(const SensorBehaviorControlInterfaces& interfaces);
00040
00041
00042
00043
00044
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
00053
00054
00055
00056 Vector2<int> getCenteredCoor(Vector2<int> p);
00057
00058
00059
00060
00061
00062
00063 Vector2<double> getCoorInmm(Vector2<int> p);
00064
00065
00066
00067
00068
00069
00070 Vector2<int> getCoorInPixel(Vector2<double> p);
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080 Vector2<int> getPixelFlow(Vector2<double> pCentered, double z, Vector3<double> cameraMovement, Vector3<double> cameraRotation);
00081
00082
00083
00084
00085
00086
00087
00088
00089 Vector2<int> getNewPixelPos(Vector2<int> p, Vector3<double> cameraMovement, Vector3<double> cameraRotation);
00090
00091
00092
00093
00094
00095
00096 double getCameraZ(Vector2<double> angleYZ);
00097
00098
00099
00100
00101
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
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
00141 Image motionRecognitionImage, processorGradientsImage;
00142 };
00143 #endif// __MotionRecognition_h_
00144
00145
00146
00147
00148
00149
00150
00151
00152
00153
00154
00155
00156
00157
00158
00159
00160
00161
00162
00163
00164
00165
00166
00167
00168
00169
00170