Fawkes API  Fawkes Development Version
cornerhorizon.h
00001 
00002 /***************************************************************************
00003  *  cornerhorizon.h - Scanline model "shrinker", takes the corner in front
00004  *                    of the robots and calculates a "fake horizon" from this
00005  *                    and only returns the scanline points which are below
00006  *                    that very horizon
00007  *
00008  *  Created: Fri Apr 07 04:34:08 2006
00009  *  Copyright  2005-2006  Tim Niemueller [www.niemueller.de]
00010  *             2006       Stefan Schiffer
00011  *             2006       Christoph Mies
00012  *
00013  ****************************************************************************/
00014 
00015 /*  This program is free software; you can redistribute it and/or modify
00016  *  it under the terms of the GNU General Public License as published by
00017  *  the Free Software Foundation; either version 2 of the License, or
00018  *  (at your option) any later version. A runtime exception applies to
00019  *  this software (see LICENSE.GPL_WRE file mentioned below for details).
00020  *
00021  *  This program is distributed in the hope that it will be useful,
00022  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00023  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00024  *  GNU Library General Public License for more details.
00025  *
00026  *  Read the full text in the LICENSE.GPL_WRE file in the doc directory.
00027  */
00028 
00029 #ifndef __FIREVISION_MODELS_SCANLINE_CORNERHORIZON_H_
00030 #define __FIREVISION_MODELS_SCANLINE_CORNERHORIZON_H_
00031 
00032 #include <fvmodels/scanlines/scanlinemodel.h>
00033 #include <fvutils/base/types.h>
00034 
00035 namespace firevision {
00036 #if 0 /* just to make Emacs auto-indent happy */
00037 }
00038 #endif
00039 
00040 class CornerHorizon : public ScanlineModel
00041 {
00042 
00043  public:
00044 
00045   CornerHorizon( ScanlineModel *model,
00046                  float field_length, float field_width, float field_border,
00047                  unsigned int image_width, unsigned int image_height,
00048                  float camera_height, float camera_ori,
00049                  float horizontal_angle, float vertical_angle
00050                  );
00051 
00052   virtual ~CornerHorizon();
00053 
00054   fawkes::point_t    operator*();
00055   fawkes::point_t *  operator->();
00056   fawkes::point_t *  operator++();
00057   fawkes::point_t *  operator++(int); 
00058 
00059   bool          finished();
00060   void          reset();
00061   const char *  get_name();
00062   unsigned int  get_margin();
00063 
00064   void set_robot_pose(float x, float y, float ori);
00065   void set_pan_tilt(float pan, float tilt);
00066 
00067   unsigned int getHorizon();
00068 
00069  protected:
00070   void calculate();
00071 
00072  private:
00073   ScanlineModel *model;
00074 
00075   bool calculated;
00076 
00077   float field_length;
00078   float field_width;
00079   float field_border;
00080   
00081   float pose_x;
00082   float pose_y;
00083   float pose_ori;
00084 
00085   float pan;
00086   float tilt;
00087 
00088   unsigned int image_width;
00089   unsigned int image_height;
00090 
00091   float camera_height;
00092   float camera_ori;
00093 
00094   float horizontal_angle;
00095   float vertical_angle;
00096 
00097   float pan_pixel_per_rad;
00098   float tilt_pixel_per_rad;
00099 
00100   fawkes::point_t coord;
00101   fawkes::point_t tmp_coord;
00102 
00103   unsigned int horizon;
00104 
00105   static const float M_PI_HALF;
00106 
00107 };
00108 
00109 } // end namespace firevision
00110 
00111 #endif