box_relative.h

00001
00002 /***************************************************************************
00003  *  box_relative.h - A simple implementation of a relative position model
00004  *                   for boxes
00005  *
00006  *  Generated: Thu Jun 08 19:21:35 2006
00007  *  Copyright  2005-2006  Tim Niemueller [www.niemueller.de]
00008  *
00009  ****************************************************************************/
00010
00011 /*  This program is free software; you can redistribute it and/or modify
00012  *  it under the terms of the GNU General Public License as published by
00013  *  the Free Software Foundation; either version 2 of the License, or
00014  *  (at your option) any later version. A runtime exception applies to
00015  *  this software (see LICENSE.GPL_WRE file mentioned below for details).
00016  *
00017  *  This program is distributed in the hope that it will be useful,
00018  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00019  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00020  *  GNU Library General Public License for more details.
00021  *
00022  *  Read the full text in the LICENSE.GPL_WRE file in the doc directory.
00023  */
00024
00025 #ifndef __FIREVISION_MODELS_RELPOS_BOX_H_
00026 #define __FIREVISION_MODELS_RELPOS_BOX_H_
00027 
00028 #include <models/relative_position/relativepositionmodel.h>
00029
00030 // include <utils/kalman_filter/ckalman_filter_2dim.h>
00031
00032 class BoxRelative : public RelativePositionModel
00033 {
00034  public:
00035   BoxRelative(unsigned int image_width, unsigned int image_height,
00036               float camera_height,
00037               float camera_offset_x, float camera_offset_y,
00038               float camera_ori,
00039               float horizontal_angle, float vertical_angle
00040               );
00041
00042   virtual const char *  get_name() const;
00043   virtual void          set_center(float x, float y);
00044   virtual void          set_center(const center_in_roi_t& c);
00045   virtual void          set_radius(float r);
00046
00047   virtual void          set_pan_tilt(float pan = 0.0f, float tilt = 0.0f);
00048   virtual void          get_pan_tilt(float *pan, float *tilt) const;
00049
00050   virtual void          set_horizontal_angle(float angle_deg);
00051   virtual void          set_vertical_angle(float angle_deg);
00052
00053   virtual float         get_distance() const;
00054
00055   virtual float         get_x() const;
00056   virtual float         get_y() const;
00057
00058   virtual float         get_bearing() const;
00059   virtual float         get_slope() 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   float                 pan_rad_per_pixel;
00072   float                 tilt_rad_per_pixel;
00073
00074   center_in_roi_t       center;
00075   float                 pan;
00076   float                 tilt;
00077
00078   float                 horizontal_angle;
00079   float                 vertical_angle;
00080
00081   unsigned int          image_width;
00082   unsigned int          image_height;
00083
00084   float                 camera_height;
00085   float                 camera_offset_x;
00086   float                 camera_offset_y;
00087   float                 camera_orientation;
00088
00089   float                 last_x;
00090   float                 last_y;
00091   bool                  last_available;
00092   float                 box_x;
00093   float                 box_y;
00094   float                 bearing;
00095   float                 slope;
00096   float                 distance_box_motor;
00097   float                 distance_box_cam;
00098
00099   /*
00100   float                 var_proc_x;
00101   float                 var_proc_y;
00102   float                 var_meas_x;
00103   float                 var_meas_y;
00104   kalmanFilter2Dim     *kalman_filter;
00105 
00106   void                  applyKalmanFilter();
00107   */
00108 };
00109
00110 #endif // __FIREVISION_MODELS_RELPOS_BOX_H_
00111