Fawkes API  Fawkes Development Version
omni_relative.h
00001 
00002 /***************************************************************************
00003  *  omni_ball_relative.h - A simple implementation of a relative omni
00004  *                         relative position model using a MirrorModel
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_POSITION_OMNI_RELATIVE_H_
00028 #define __FIREVISION_MODELS_RELATIVE_POSITION_OMNI_RELATIVE_H_
00029 
00030 #include <models/relative_position/relativepositionmodel.h>
00031 #include <models/mirror/mirrormodel.h>
00032 
00033 // include <utils/kalman_filter/ckalman_filter_2dim.h>
00034 
00035 namespace firevision {
00036 #if 0 /* just to make Emacs auto-indent happy */
00037 }
00038 #endif
00039 
00040 class OmniRelative : public RelativePositionModel
00041 {
00042  public:
00043   // constructor
00044   OmniRelative(MirrorModel *mirror_model);
00045 
00046   virtual const char *  get_name() const;
00047   virtual void          set_radius(float r);
00048   virtual void          set_center(float x, float y);
00049   virtual void          set_center(const center_in_roi_t& c);
00050 
00051   virtual void          set_pan_tilt(float pan = 0.0f, float tilt = 0.0f);
00052   virtual void          get_pan_tilt(float *pan, float *tilt) const;
00053 
00054   virtual float         get_distance() const;
00055   virtual float         get_x() const;
00056   virtual float         get_y() const;
00057   virtual float         get_bearing() const;
00058   virtual float         get_slope() const;
00059   virtual float         get_radius() const;
00060 
00061   virtual void          calc();
00062   virtual void          calc_unfiltered();
00063   virtual void          reset();
00064 
00065   virtual bool          is_pos_valid() const;
00066 
00067 private:
00068   float                 DEFAULT_X_VARIANCE;
00069   float                 DEFAULT_Y_VARIANCE;
00070 
00071   MirrorModel          *mirror_model;
00072 
00073   unsigned int          image_width;
00074   unsigned int          image_height;
00075 
00076   unsigned int          image_x;
00077   unsigned int          image_y;
00078 
00079   float                 last_x;
00080   float                 last_y;
00081   bool                  last_available;
00082   float                 ball_x;
00083   float                 ball_y;
00084   float                 bearing;
00085   float                 slope;
00086   float                 distance_ball_motor;
00087   float                 distance_ball_cam;
00088 
00089   float                 avg_x;
00090   float                 avg_y;
00091   float                 avg_x_sum;
00092   float                 avg_y_sum;
00093   unsigned int          avg_x_num;
00094   unsigned int          avg_y_num;
00095   float                 rx;
00096   float                 ry;
00097 
00098   //kalmanFilter2Dim     *kalman_filter;
00099 
00100   //void                  applyKalmanFilter();
00101 };
00102 
00103 } // end namespace firevision
00104 
00105 #endif