ball_trigo.h

00001
00002 /****************************************************************************
00003  *  ball_trigo.h - Ball relpos for pan/tilt camera using basic trigonometry
00004  *
00005  *  Created: Mon Mar 23 09:39:26 2009
00006  *  Copyright  2009  Tim Niemueller [www.niemueller.de]
00007  *
00008  ****************************************************************************/
00009
00010 /*  This program is free software; you can redistribute it and/or modify
00011  *  it under the terms of the GNU General Public License as published by
00012  *  the Free Software Foundation; either version 2 of the License, or
00013  *  (at your option) any later version. A runtime exception applies to
00014  *  this software (see LICENSE.GPL_WRE file mentioned below for details).
00015  *
00016  *  This program is distributed in the hope that it will be useful,
00017  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00018  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00019  *  GNU Library General Public License for more details.
00020  *
00021  *  Read the full text in the LICENSE.GPL_WRE file in the doc directory.
00022  */
00023
00024 #ifndef __FIREVISION_MODELS_RELATIVE_POSITION_BALL_TRIGO_H_
00025 #define __FIREVISION_MODELS_RELATIVE_POSITION_BALL_TRIGO_H_
00026 
00027 #include <models/relative_position/relativepositionmodel.h>
00028
00029 class BallTrigoRelativePos : public RelativePositionModel
00030 {
00031  public:
00032   BallTrigoRelativePos(unsigned int image_width,
00033                        unsigned int image_height,
00034                        float camera_height,
00035                        float camera_offset_x,
00036                        float camera_offset_y,
00037                        float camera_base_pan,
00038                        float camera_base_tilt,
00039                        float horizontal_angle,
00040                        float vertical_angle,
00041                        float ball_circumference);
00042
00043   virtual const char *  get_name() const;
00044   virtual void          set_radius(float r);
00045   virtual void          set_center(float x, float y);
00046   virtual void          set_center(const center_in_roi_t& c);
00047
00048   virtual void          set_pan_tilt(float pan = 0.0f, float tilt = 0.0f);
00049   virtual void          get_pan_tilt(float *pan, float *tilt) const;
00050
00051   virtual float         get_distance() const;
00052   virtual float         get_x() const;
00053   virtual float         get_y() const;
00054   virtual float         get_bearing() const;
00055   virtual float         get_slope() const;
00056
00057   virtual void          calc();
00058   virtual void          calc_unfiltered() { calc(); }
00059   virtual void          reset();
00060
00061   virtual bool          is_pos_valid() const;
00062
00063 private:
00064   center_in_roi_t       __cirt_center;
00065   float                 __pan;
00066   float                 __tilt;
00067
00068   float                 __horizontal_angle;
00069   float                 __vertical_angle;
00070   float                 __pan_rad_per_pixel;
00071   float                 __tilt_rad_per_pixel;
00072
00073   unsigned int          __image_width;
00074   unsigned int          __image_width_2;  // image_width / 2
00075   unsigned int          __image_height;
00076   unsigned int          __image_height_2; // image_height / 2
00077
00078   float                 __camera_height;
00079   float                 __camera_offset_x;
00080   float                 __camera_offset_y;
00081   float                 __camera_base_pan;
00082   float                 __camera_base_tilt;
00083
00084   float                 __ball_circumference;
00085   float                 __ball_radius;
00086   float                 __ball_x;
00087   float                 __ball_y;
00088   float                 __bearing;
00089   float                 __slope;
00090   float                 __distance;
00091 };
00092
00093 #endif
00094