front_ball.h

00001
00002 /***************************************************************************
00003  *  front_ball.h - A simple implementation of the relative position model
00004  *                 for the ball in the front vision
00005  *
00006  *  Created: Fri Jun 03 22:56:22 2005
00007  *  Copyright  2005  Hu Yuxiao      <Yuxiao.Hu@rwth-aachen.de>
00008  *                   Tim Niemueller [www.niemueller.de]
00009  *                   Martin Heracles <Martin.Heracles@rwth-aachen.de>
00010  *
00011  ****************************************************************************/
00012
00013 /*  This program is free software; you can redistribute it and/or modify
00014  *  it under the terms of the GNU General Public License as published by
00015  *  the Free Software Foundation; either version 2 of the License, or
00016  *  (at your option) any later version. A runtime exception applies to
00017  *  this software (see LICENSE.GPL_WRE file mentioned below for details).
00018  *
00019  *  This program is distributed in the hope that it will be useful,
00020  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00021  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00022  *  GNU Library General Public License for more details.
00023  *
00024  *  Read the full text in the LICENSE.GPL_WRE file in the doc directory.
00025  */
00026
00027 #ifndef __FIREVISION_MODELS_RELATIVE_FRONT_BALL_H_
00028 #define __FIREVISION_MODELS_RELATIVE_FRONT_BALL_H_
00029 
00030 #include <models/relative_position/relativepositionmodel.h>
00031
00032 // include <utils/kalman_filter/ckalman_filter_2dim.h>
00033
00034 class FrontBallRelativePos : public RelativePositionModel
00035 {
00036  public:
00037   FrontBallRelativePos(unsigned int image_width, unsigned int image_height,
00038                        float camera_height,
00039                        float camera_offset_x, float camera_offset_y,
00040                        float camera_ori,
00041                        float horizontal_angle, float vertical_angle,
00042                        float ball_circumference
00043                        );
00044
00045   virtual const char *  get_name() const;
00046   virtual void          set_radius(float r);
00047   virtual void          set_center(float x, float y);
00048   virtual void          set_center(const center_in_roi_t& c);
00049
00050   virtual void          set_pan_tilt(float pan = 0.0f, float tilt = 0.0f);
00051   virtual void          get_pan_tilt(float *pan, float *tilt) const;
00052
00053   virtual void          set_horizontal_angle(float angle_deg);
00054   virtual void          set_vertical_angle(float angle_deg);
00055
00056   virtual float         get_distance() const;
00057   virtual float         get_x() const;
00058   virtual float         get_y() const;
00059   virtual float         get_bearing() const;
00060   virtual float         get_slope() const;
00061   virtual float         get_radius() const;
00062
00063   virtual void          calc();
00064   virtual void          calc_unfiltered();
00065   virtual void          reset();
00066
00067   virtual bool          is_pos_valid() const;
00068
00069 private:
00070   float                 DEFAULT_X_VARIANCE;
00071   float                 DEFAULT_Y_VARIANCE;
00072
00073   float                 m_fPanRadPerPixel;
00074   float                 m_fTiltRadPerPixel;
00075   float                 m_fBallRadius;        // in meter
00076
00077   float                 m_fRadius;
00078   center_in_roi_t       m_cirtCenter;
00079   float                 m_fPan;
00080   float                 m_fTilt;
00081
00082   float                 horizontal_angle;
00083   float                 vertical_angle;
00084
00085   unsigned int          image_width;
00086   unsigned int          image_height;
00087
00088   float                 camera_height;
00089   float                 camera_offset_x;
00090   float                 camera_offset_y;
00091   float                 camera_orientation;
00092
00093   float                 ball_circumference;
00094
00095   float                 last_x;
00096   float                 last_y;
00097   bool                  last_available;
00098   float                 ball_x;
00099   float                 ball_y;
00100   float                 bearing;
00101   float                 slope;
00102   float                 distance_ball_motor;
00103   float                 distance_ball_cam;
00104
00105   float                 avg_x;
00106   float                 avg_y;
00107   float                 avg_x_sum;
00108   float                 avg_y_sum;
00109   unsigned int          avg_x_num;
00110   unsigned int          avg_y_num;
00111   float                 rx;
00112   float                 ry;
00113
00114   float                 var_proc_x;
00115   float                 var_proc_y;
00116   float                 var_meas_x;
00117   float                 var_meas_y;
00118   // kalmanFilter2Dim     *kalman_filter;
00119
00120   // void                  applyKalmanFilter();
00121 };
00122
00123 #endif // __FIREVISION_MODELS_RELPOS_BALL_H_
00124