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
29namespace firevision {
30
32{
33public:
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
69private:
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
Relative ball position model for pan/tilt camera.
Definition: ball_trigo.h:32
virtual void calc_unfiltered()
Calculate data unfiltered.
Definition: ball_trigo.h:61
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:54
virtual void reset()
Reset all data.
Definition: ball_trigo.cpp:160
virtual void set_center(float x, float y)
Set center of a found circle.
Definition: ball_trigo.cpp:121
virtual const char * get_name() const
Get name of relative position model.
Definition: ball_trigo.cpp:154
virtual float get_x() const
Get relative X coordinate of object.
Definition: ball_trigo.cpp:115
virtual void set_pan_tilt(float pan=0.0f, float tilt=0.0f)
Set camera pan and tilt.
Definition: ball_trigo.cpp:140
virtual float get_distance() const
Get distance to object.
Definition: ball_trigo.cpp:91
virtual void set_radius(float r)
Set radius of a found circle.
Definition: ball_trigo.cpp:135
virtual float get_slope() const
Get slope (vertical angle) to object.
Definition: ball_trigo.cpp:103
virtual float get_bearing() const
Get bearing (horizontal angle) to object.
Definition: ball_trigo.cpp:97
virtual float get_y() const
Get relative Y coordinate of object.
Definition: ball_trigo.cpp:109
virtual void get_pan_tilt(float *pan, float *tilt) const
Get camera pan tilt.
Definition: ball_trigo.cpp:147
virtual void calc()
Calculate position data.
Definition: ball_trigo.cpp:165
virtual bool is_pos_valid() const
Check if position is valid.
Definition: ball_trigo.cpp:188
Relative Position Model Interface.
Center in ROI.
Definition: types.h:38