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 
31 class BallTrigoRelativePos : public RelativePositionModel
32 {
33 public:
34  BallTrigoRelativePos(unsigned int image_width,
35  unsigned int image_height,
36  float camera_height,
37  float camera_offset_x,
38  float camera_offset_y,
39  float camera_base_pan,
40  float camera_base_tilt,
41  float horizontal_angle,
42  float vertical_angle,
43  float ball_circumference);
44 
45  virtual const char *get_name() const;
46  virtual void set_radius(float r);
47  virtual void set_center(float x, float y);
48  virtual void set_center(const center_in_roi_t &c);
49 
50  virtual void set_pan_tilt(float pan = 0.0f, float tilt = 0.0f);
51  virtual void get_pan_tilt(float *pan, float *tilt) const;
52 
53  virtual float get_distance() const;
54  virtual float get_x() const;
55  virtual float get_y() const;
56  virtual float get_bearing() const;
57  virtual float get_slope() const;
58 
59  virtual void calc();
60  virtual void
62  {
63  calc();
64  }
65  virtual void reset();
66 
67  virtual bool is_pos_valid() const;
68 
69 private:
70  center_in_roi_t cirt_center_;
71  float pan_;
72  float tilt_;
73 
74  float horizontal_angle_;
75  float vertical_angle_;
76  float pan_rad_per_pixel_;
77  float tilt_rad_per_pixel_;
78 
79  unsigned int image_width_;
80  unsigned int image_width_2_; // image_width / 2
81  unsigned int image_height_;
82  unsigned int image_height_2_; // image_height / 2
83 
84  float camera_height_;
85  float camera_offset_x_;
86  float camera_offset_y_;
87  float camera_base_pan_;
88  float camera_base_tilt_;
89 
90  float ball_circumference_;
91  float ball_radius_;
92  float ball_x_;
93  float ball_y_;
94  float bearing_;
95  float slope_;
96  float distance_;
97 };
98 
99 } // end namespace firevision
100 
101 #endif
firevision::BallTrigoRelativePos::get_distance
virtual float get_distance() const
Definition: ball_trigo.cpp:90
firevision::BallTrigoRelativePos::is_pos_valid
virtual bool is_pos_valid() const
Definition: ball_trigo.cpp:187
firevision::BallTrigoRelativePos::reset
virtual void reset()
Definition: ball_trigo.cpp:159
firevision::BallTrigoRelativePos::get_pan_tilt
virtual void get_pan_tilt(float *pan, float *tilt) const
Definition: ball_trigo.cpp:146
firevision::BallTrigoRelativePos::calc_unfiltered
virtual void calc_unfiltered()
Definition: ball_trigo.h:70
firevision::BallTrigoRelativePos::set_center
virtual void set_center(float x, float y)
Definition: ball_trigo.cpp:120
firevision::BallTrigoRelativePos::get_x
virtual float get_x() const
Definition: ball_trigo.cpp:114
firevision::BallTrigoRelativePos::calc
virtual void calc()
Definition: ball_trigo.cpp:164
firevision::BallTrigoRelativePos::get_slope
virtual float get_slope() const
Definition: ball_trigo.cpp:102
firevision::BallTrigoRelativePos::set_pan_tilt
virtual void set_pan_tilt(float pan=0.0f, float tilt=0.0f)
Definition: ball_trigo.cpp:139
firevision::center_in_roi_t
Center in ROI.
Definition: types.h:42
firevision::BallTrigoRelativePos::get_name
virtual const char * get_name() const
Definition: ball_trigo.cpp:153
firevision::BallTrigoRelativePos::BallTrigoRelativePos
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:53
firevision::BallTrigoRelativePos::get_bearing
virtual float get_bearing() const
Definition: ball_trigo.cpp:96
firevision::BallTrigoRelativePos::get_y
virtual float get_y() const
Definition: ball_trigo.cpp:108
firevision::BallTrigoRelativePos::set_radius
virtual void set_radius(float r)
Definition: ball_trigo.cpp:134