Fawkes API  Fawkes Development Version
box_relative.h
1 
2 /***************************************************************************
3  * box_relative.h - A simple implementation of a relative position model
4  * for boxes
5  *
6  * Created: Thu Jun 08 19:21:35 2006
7  * Copyright 2005-2006 Tim Niemueller [www.niemueller.de]
8  *
9  ****************************************************************************/
10 
11 /* This program is free software; you can redistribute it and/or modify
12  * it under the terms of the GNU General Public License as published by
13  * the Free Software Foundation; either version 2 of the License, or
14  * (at your option) any later version. A runtime exception applies to
15  * this software (see LICENSE.GPL_WRE file mentioned below for details).
16  *
17  * This program is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20  * GNU Library General Public License for more details.
21  *
22  * Read the full text in the LICENSE.GPL_WRE file in the doc directory.
23  */
24 
25 #ifndef _FIREVISION_MODELS_RELPOS_BOX_H_
26 #define _FIREVISION_MODELS_RELPOS_BOX_H_
27 
28 #include <fvmodels/relative_position/relativepositionmodel.h>
29 
30 // include <utils/kalman_filter/ckalman_filter_2dim.h>
31 
32 namespace firevision {
33 
35 {
36 public:
37  BoxRelative(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_ori,
43  float horizontal_angle,
44  float vertical_angle);
45 
46  virtual const char *get_name() const;
47  virtual void set_center(float x, float y);
48  virtual void set_center(const center_in_roi_t &c);
49  virtual void set_radius(float r);
50 
51  virtual void set_pan_tilt(float pan = 0.0f, float tilt = 0.0f);
52  virtual void get_pan_tilt(float *pan, float *tilt) const;
53 
54  virtual void set_horizontal_angle(float angle_deg);
55  virtual void set_vertical_angle(float angle_deg);
56 
57  virtual float get_distance() const;
58 
59  virtual float get_x() const;
60  virtual float get_y() const;
61 
62  virtual float get_bearing() const;
63  virtual float get_slope() const;
64 
65  virtual void calc();
66  virtual void calc_unfiltered();
67  virtual void reset();
68 
69  virtual bool is_pos_valid() const;
70 
71 private:
72  float DEFAULT_X_VARIANCE;
73  float DEFAULT_Y_VARIANCE;
74 
75  float pan_rad_per_pixel;
76  float tilt_rad_per_pixel;
77 
78  center_in_roi_t center;
79  float pan;
80  float tilt;
81 
82  float horizontal_angle;
83  float vertical_angle;
84 
85  unsigned int image_width;
86  unsigned int image_height;
87 
88  float camera_height;
89  float camera_offset_x;
90  float camera_offset_y;
91  float camera_orientation;
92 
93  bool last_available;
94  float box_x;
95  float box_y;
96  float bearing;
97  float slope;
98  float distance_box_motor;
99  float distance_box_cam;
100 
101  /*
102  float var_proc_x;
103  float var_proc_y;
104  float var_meas_x;
105  float var_meas_y;
106  kalmanFilter2Dim *kalman_filter;
107 
108  void applyKalmanFilter();
109  */
110 };
111 
112 } // end namespace firevision
113 
114 #endif // FIREVISION_MODELS_RELPOS_BOX_H__
firevision::BoxRelative::reset
virtual void reset()
Reset all data.
Definition: box_relative.cpp:203
firevision::BoxRelative::set_horizontal_angle
virtual void set_horizontal_angle(float angle_deg)
Set the horizontal viewing angle.
Definition: box_relative.cpp:188
firevision::RelativePositionModel
Relative Position Model Interface.
Definition: relativepositionmodel.h:33
firevision::BoxRelative::calc
virtual void calc()
Calculate position data.
Definition: box_relative.cpp:210
firevision::BoxRelative::set_vertical_angle
virtual void set_vertical_angle(float angle_deg)
Set the vertical viewing angle.
Definition: box_relative.cpp:197
firevision::BoxRelative::get_pan_tilt
virtual void get_pan_tilt(float *pan, float *tilt) const
Get camera pan tilt.
Definition: box_relative.cpp:172
firevision::BoxRelative::calc_unfiltered
virtual void calc_unfiltered()
Calculate data unfiltered.
Definition: box_relative.cpp:238
firevision::BoxRelative::get_bearing
virtual float get_bearing() const
Get bearing (horizontal angle) to object.
Definition: box_relative.cpp:114
firevision::BoxRelative::get_slope
virtual float get_slope() const
Get slope (vertical angle) to object.
Definition: box_relative.cpp:120
firevision::BoxRelative::get_name
virtual const char * get_name() const
Get name of relative position model.
Definition: box_relative.cpp:179
firevision::BoxRelative::set_radius
virtual void set_radius(float r)
Set radius of a found circle.
Definition: box_relative.cpp:146
firevision::BoxRelative::is_pos_valid
virtual bool is_pos_valid() const
Check if position is valid.
Definition: box_relative.cpp:232
firevision::BoxRelative::BoxRelative
BoxRelative(unsigned int image_width, unsigned int image_height, float camera_height, float camera_offset_x, float camera_offset_y, float camera_ori, float horizontal_angle, float vertical_angle)
Constructor.
Definition: box_relative.cpp:52
firevision::BoxRelative::set_pan_tilt
virtual void set_pan_tilt(float pan=0.0f, float tilt=0.0f)
Set camera pan and tilt.
Definition: box_relative.cpp:165
firevision::BoxRelative::get_x
virtual float get_x() const
Get relative X coordinate of object.
Definition: box_relative.cpp:140
firevision::center_in_roi_t
Center in ROI.
Definition: types.h:38
firevision::BoxRelative::set_center
virtual void set_center(float x, float y)
Set center of a found circle.
Definition: box_relative.cpp:151
firevision::BoxRelative
Relative (beer) box position model.
Definition: box_relative.h:35
firevision::BoxRelative::get_y
virtual float get_y() const
Get relative Y coordinate of object.
Definition: box_relative.cpp:130
firevision::BoxRelative::get_distance
virtual float get_distance() const
Get distance to object.
Definition: box_relative.cpp:108