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 namespace firevision {
00035 #if 0 /* just to make Emacs auto-indent happy */
00036 }
00037 #endif
00038 
00039 class FrontBallRelativePos : public RelativePositionModel
00040 {
00041  public:
00042   FrontBallRelativePos(unsigned int image_width, unsigned int image_height,
00043                        float camera_height,
00044                        float camera_offset_x, float camera_offset_y,
00045                        float camera_ori,
00046                        float horizontal_angle, float vertical_angle,
00047                        float ball_circumference
00048                        );
00049 
00050   virtual const char *  get_name() const;
00051   virtual void          set_radius(float r);
00052   virtual void          set_center(float x, float y);
00053   virtual void          set_center(const center_in_roi_t& c);
00054 
00055   virtual void          set_pan_tilt(float pan = 0.0f, float tilt = 0.0f);
00056   virtual void          get_pan_tilt(float *pan, float *tilt) const;
00057 
00058   virtual void          set_horizontal_angle(float angle_deg);
00059   virtual void          set_vertical_angle(float angle_deg);
00060 
00061   virtual float         get_distance() const;
00062   virtual float         get_x() const;
00063   virtual float         get_y() const;
00064   virtual float         get_bearing() const;
00065   virtual float         get_slope() const;
00066   virtual float         get_radius() const;
00067 
00068   virtual void          calc();
00069   virtual void          calc_unfiltered();
00070   virtual void          reset();
00071 
00072   virtual bool          is_pos_valid() const;
00073 
00074 private:
00075   float                 DEFAULT_X_VARIANCE;
00076   float                 DEFAULT_Y_VARIANCE;
00077 
00078   float                 m_fPanRadPerPixel;
00079   float                 m_fTiltRadPerPixel;
00080   float                 m_fBallRadius;        // in meter
00081 
00082   float                 m_fRadius;
00083   center_in_roi_t       m_cirtCenter;
00084   float                 m_fPan;
00085   float                 m_fTilt;
00086 
00087   float                 horizontal_angle;
00088   float                 vertical_angle;
00089 
00090   unsigned int          image_width;
00091   unsigned int          image_height;
00092 
00093   float                 camera_height;
00094   float                 camera_offset_x;
00095   float                 camera_offset_y;
00096   float                 camera_orientation;
00097 
00098   float                 ball_circumference;
00099 
00100   float                 last_x;
00101   float                 last_y;
00102   bool                  last_available;
00103   float                 ball_x;
00104   float                 ball_y;
00105   float                 bearing;
00106   float                 slope;
00107   float                 distance_ball_motor;
00108   float                 distance_ball_cam;
00109 
00110   float                 avg_x;
00111   float                 avg_y;
00112   float                 avg_x_sum;
00113   float                 avg_y_sum;
00114   unsigned int          avg_x_num;
00115   unsigned int          avg_y_num;
00116   float                 rx;
00117   float                 ry;
00118 
00119   float                 var_proc_x;
00120   float                 var_proc_y;
00121   float                 var_meas_x;
00122   float                 var_meas_y;
00123   // kalmanFilter2Dim     *kalman_filter;
00124 
00125   // void                  applyKalmanFilter();
00126 };
00127 
00128 } // end namespace firevision
00129 
00130 #endif // __FIREVISION_MODELS_RELPOS_BALL_H_
00131 

Generated on Tue Feb 22 13:32:16 2011 for Fawkes API by  doxygen 1.4.7