Fawkes API  Fawkes Development Version
ball_trigo.h
1 
2 /****************************************************************************
3  * ball_trigo.h - Ball relpos for pan/tilt camera using basic trigonometry
4  *
5  * Created: Mon Mar 23 09:39:26 2009
6  * Copyright 2009 Tim Niemueller [www.niemueller.de]
7  *
8  ****************************************************************************/
9 
10 /* This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 2 of the License, or
13  * (at your option) any later version. A runtime exception applies to
14  * this software (see LICENSE.GPL_WRE file mentioned below for details).
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  * GNU Library General Public License for more details.
20  *
21  * Read the full text in the LICENSE.GPL_WRE file in the doc directory.
22  */
23 
24 #ifndef __FIREVISION_MODELS_RELATIVE_POSITION_BALL_TRIGO_H_
25 #define __FIREVISION_MODELS_RELATIVE_POSITION_BALL_TRIGO_H_
26 
27 #include <fvmodels/relative_position/relativepositionmodel.h>
28 
29 namespace firevision {
30 #if 0 /* just to make Emacs auto-indent happy */
31 }
32 #endif
33 
35 {
36  public:
37  BallTrigoRelativePos(unsigned int image_width,
38  unsigned int image_height,
39  float camera_height,
40  float camera_offset_x,
41  float camera_offset_y,
42  float camera_base_pan,
43  float camera_base_tilt,
44  float horizontal_angle,
45  float vertical_angle,
46  float ball_circumference);
47 
48  virtual const char * get_name() const;
49  virtual void set_radius(float r);
50  virtual void set_center(float x, float y);
51  virtual void set_center(const center_in_roi_t& c);
52 
53  virtual void set_pan_tilt(float pan = 0.0f, float tilt = 0.0f);
54  virtual void get_pan_tilt(float *pan, float *tilt) const;
55 
56  virtual float get_distance() const;
57  virtual float get_x() const;
58  virtual float get_y() const;
59  virtual float get_bearing() const;
60  virtual float get_slope() const;
61 
62  virtual void calc();
63  virtual void calc_unfiltered() { calc(); }
64  virtual void reset();
65 
66  virtual bool is_pos_valid() const;
67 
68 private:
69  center_in_roi_t __cirt_center;
70  float __pan;
71  float __tilt;
72 
73  float __horizontal_angle;
74  float __vertical_angle;
75  float __pan_rad_per_pixel;
76  float __tilt_rad_per_pixel;
77 
78  unsigned int __image_width;
79  unsigned int __image_width_2; // image_width / 2
80  unsigned int __image_height;
81  unsigned int __image_height_2; // image_height / 2
82 
83  float __camera_height;
84  float __camera_offset_x;
85  float __camera_offset_y;
86  float __camera_base_pan;
87  float __camera_base_tilt;
88 
89  float __ball_circumference;
90  float __ball_radius;
91  float __ball_x;
92  float __ball_y;
93  float __bearing;
94  float __slope;
95  float __distance;
96 };
97 
98 } // end namespace firevision
99 
100 #endif
virtual const char * get_name() const
Get name of relative position model.
Definition: ball_trigo.cpp:168
virtual bool is_pos_valid() const
Check if position is valid.
Definition: ball_trigo.cpp:207
virtual void reset()
Reset all data.
Definition: ball_trigo.cpp:175
virtual void calc_unfiltered()
Calculate data unfiltered.
Definition: ball_trigo.h:63
virtual void set_radius(float r)
Set radius of a found circle.
Definition: ball_trigo.cpp:146
virtual void calc()
Calculate position data.
Definition: ball_trigo.cpp:180
virtual float get_x() const
Get relative X coordinate of object.
Definition: ball_trigo.cpp:123
virtual void get_pan_tilt(float *pan, float *tilt) const
Get camera pan tilt.
Definition: ball_trigo.cpp:160
virtual void set_center(float x, float y)
Set center of a found circle.
Definition: ball_trigo.cpp:130
Relative Position Model Interface.
virtual float get_bearing() const
Get bearing (horizontal angle) to object.
Definition: ball_trigo.cpp:102
virtual void set_pan_tilt(float pan=0.0f, float tilt=0.0f)
Set camera pan and tilt.
Definition: ball_trigo.cpp:152
virtual float get_distance() const
Get distance to object.
Definition: ball_trigo.cpp:95
Relative ball position model for pan/tilt camera.
Definition: ball_trigo.h:34
BallTrigoRelativePos(unsigned int image_width, unsigned int image_height, float camera_height, float camera_offset_x, float camera_offset_y, float camera_base_pan, float camera_base_tilt, float horizontal_angle, float vertical_angle, float ball_circumference)
Constructor.
Definition: ball_trigo.cpp:57
virtual float get_slope() const
Get slope (vertical angle) to object.
Definition: ball_trigo.cpp:109
Center in ROI.
Definition: types.h:39
virtual float get_y() const
Get relative Y coordinate of object.
Definition: ball_trigo.cpp:116