00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #ifndef __BallPercept_h_
00013 #define __BallPercept_h_
00014
00015 #include "Tools/Streams/InOut.h"
00016 #include "Tools/Math/Vector2.h"
00017 #include "Tools/Math/Vector3.h"
00018 #include "Tools/Math/Common.h"
00019 #include "Tools/FieldDimensions.h"
00020 #include "Tools/RobotConfiguration.h"
00021 #include "MultipleBallPerceptElement.h"
00022 #include "MultipleBallPerceptList.h"
00023
00024
00025
00026
00027 class BallPercept;
00028
00029 class BallPercept : public Streamable
00030 {
00031 void serialize(In* in, Out* out)
00032 {
00033 STREAM_REGISTER_BEGIN();
00034 STREAM(ballWasSeen);
00035 STREAM(offsetOnField);
00036 STREAM(bearingBasedOffsetOnField);
00037 STREAM(sizeBasedOffsetOnField);
00038 STREAM(centerInImage);
00039 STREAM(radiusInImage);
00040 STREAM(reliability);
00041 STREAM(isCameraMatrixValid);
00042 STREAM(multiplePercepts);
00043 STREAM(frameNumber);
00044 STREAM_REGISTER_FINISH();
00045 }
00046
00047 public:
00048
00049
00050
00051 BallPercept();
00052
00053
00054 void reset(unsigned long frameNumber) {this->frameNumber = frameNumber; ballWasSeen = false;}
00055
00056
00057 void add(const Vector2<double>& offsetOnField,
00058 const Vector2<double>& bearingBasedOffsetOnField,
00059 const Vector2<double>& sizeBasedOffsetOnField,
00060 const Vector2<double>& centerInImage,
00061 double radiusInImage,
00062 double reliability,
00063 bool isCameraMatrixValid);
00064
00065
00066 void addHighRes(const Vector2<int>& centerInPixel,
00067 const Vector2<double>& centerAsAngles,
00068 double radiusInPixel,
00069 double radiusAsAngle,
00070 const Vector3<double>& translationOfCamera,
00071 bool isCameraMatrixValid,
00072 double reliability);
00073
00074 bool ballWasSeen;
00075 Vector2<double> offsetOnField;
00076 Vector2<double> bearingBasedOffsetOnField;
00077 Vector2<double> sizeBasedOffsetOnField;
00078 Vector2<double> centerInImage;
00079 double radiusInImage;
00080 double reliability;
00081 bool isCameraMatrixValid;
00082 MultipleBallPerceptList multiplePercepts;
00083 unsigned long frameNumber;
00084
00085 private:
00086 void checkOffset(Vector2<double>& offset) const;
00087
00088
00089
00090 };
00091
00092 #endif //__BallPercept_h_