00001
00014 #ifndef FIELD_PROVIDER_HWF1NX72
00015 #define FIELD_PROVIDER_HWF1NX72
00016
00017 #include <Eigen/Core>
00018 #include <opencv/cv.h>
00019 #include <pcl_visualization/pcl_visualizer.h>
00020
00021 namespace ground_truth {
00022
00023
00024
00025 const float FIELD_Y = 3.950;
00026 const float FIELD_X = 5.950;
00027
00028 const float GRASS_Y = 4.725;
00029 const float GRASS_X = 6.725;
00030
00031 const float PENALTY_Y = 2.150;
00032 const float PENALTY_X = 0.550;
00033 const float CIRCLE_RADIUS = 0.650;
00034
00035 const float PENALTY_CROSS_X = 1.200;
00036
00037 const float GOAL_HEIGHT = 0.8;
00038 const float GOAL_Y = 1.5;
00039
00040
00041
00042
00043
00044 enum GroundPoints {
00045 YELLOW_BASE_TOP = 0,
00046 YELLOW_BASE_PENALTY_TOP = 1,
00047 YELLOW_GOALPOST_TOP = 2,
00048 YELLOW_GOALPOST_BOTTOM = 3,
00049 YELLOW_BASE_PENALTY_BOTTOM = 4,
00050 YELLOW_BASE_BOTTOM = 5,
00051 YELLOW_PENALTY_TOP = 6,
00052 YELLOW_PENALTY_BOTTOM = 7,
00053 YELLOW_PENALTY_CROSS = 8,
00054 MID_TOP = 9,
00055 MID_CIRCLE_TOP = 10,
00056 MID_CIRCLE_BOTTOM = 11,
00057 MID_BOTTOM = 12,
00058 BLUE_BASE_TOP = 13,
00059 BLUE_BASE_PENALTY_TOP = 14,
00060 BLUE_GOALPOST_TOP = 15,
00061 BLUE_GOALPOST_BOTTOM = 16,
00062 BLUE_BASE_PENALTY_BOTTOM = 17,
00063 BLUE_BASE_BOTTOM = 18,
00064 BLUE_PENALTY_TOP = 19,
00065 BLUE_PENALTY_BOTTOM = 20,
00066 BLUE_PENALTY_CROSS = 21,
00067 NUM_GROUND_PLANE_POINTS = 22
00068 };
00069
00070
00071
00072 enum HighPoints {
00073 YELLOW_GOALPOST_TOP_HIGH = 0,
00074 YELLOW_GOALPOST_BOTTOM_HIGH = 1,
00075 BLUE_GOALPOST_TOP_HIGH = 2,
00076 BLUE_GOALPOST_BOTTOM_HIGH = 3,
00077 NUM_HIGH_POINTS = 4
00078 };
00079
00084 class FieldProvider {
00085
00086 private:
00087
00088 Eigen::Vector3f centerField;
00089 Eigen::Vector3f groundPoints[NUM_GROUND_PLANE_POINTS];
00090 Eigen::Vector3f highPoints[NUM_HIGH_POINTS];
00091
00092
00093
00097 void draw2dLine(IplImage* image, const Eigen::Vector3f &ep1, const Eigen::Vector3f &ep2, const CvScalar &color, int width);
00098
00102 void draw2dCircle(IplImage * image, const Eigen::Vector3f &pt, int radius, const CvScalar &color, int width);
00103
00107 void draw2dCenterCircle(IplImage *image, const Eigen::Vector3f ¢erPt, const Eigen::Vector3f &circlePt, const CvScalar &color, int width);
00108
00112 void convertCoordinates(cv::Point2d &pos2d, int height, int width, const Eigen::Vector3f &pos3d);
00113
00114
00115
00121 void draw3dLine(pcl_visualization::PCLVisualizer &visualizer, const Eigen::Vector3f &ep1, const Eigen::Vector3f &ep2, double r, double g, double b, const std::string &name);
00122
00131 void draw3dCenterCircle(pcl_visualization::PCLVisualizer &visualizer, const Eigen::Vector3f ¢erPt, const Eigen::Vector3f &circlePt, double r, double g, double b, const std::string &name);
00132
00133 public:
00134
00140 FieldProvider (float x = 0.0, float y = 0.0, float z = 0.0);
00141
00142
00148 void get2dField(IplImage* image, int highlightPoint = -1);
00149
00154 void get3dField(pcl_visualization::PCLVisualizer &visualizer);
00155
00161 inline Eigen::Vector3f getGroundPoint(int index) {
00162 return groundPoints[index];
00163 }
00164
00165 };
00166 }
00167
00168 #endif