Fawkes API  Fawkes Development Version
cornerhorizon.h
1 
2 /***************************************************************************
3  * cornerhorizon.h - Scanline model "shrinker", takes the corner in front
4  * of the robots and calculates a "fake horizon" from this
5  * and only returns the scanline points which are below
6  * that very horizon
7  *
8  * Created: Fri Apr 07 04:34:08 2006
9  * Copyright 2005-2006 Tim Niemueller [www.niemueller.de]
10  * 2006 Stefan Schiffer
11  * 2006 Christoph Mies
12  *
13  ****************************************************************************/
14 
15 /* This program is free software; you can redistribute it and/or modify
16  * it under the terms of the GNU General Public License as published by
17  * the Free Software Foundation; either version 2 of the License, or
18  * (at your option) any later version. A runtime exception applies to
19  * this software (see LICENSE.GPL_WRE file mentioned below for details).
20  *
21  * This program is distributed in the hope that it will be useful,
22  * but WITHOUT ANY WARRANTY; without even the implied warranty of
23  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24  * GNU Library General Public License for more details.
25  *
26  * Read the full text in the LICENSE.GPL_WRE file in the doc directory.
27  */
28 
29 #ifndef __FIREVISION_MODELS_SCANLINE_CORNERHORIZON_H_
30 #define __FIREVISION_MODELS_SCANLINE_CORNERHORIZON_H_
31 
32 #include <fvmodels/scanlines/scanlinemodel.h>
33 #include <fvutils/base/types.h>
34 
35 namespace firevision {
36 #if 0 /* just to make Emacs auto-indent happy */
37 }
38 #endif
39 
41 {
42 
43  public:
44 
46  float field_length, float field_width, float field_border,
47  unsigned int image_width, unsigned int image_height,
48  float camera_height, float camera_ori,
49  float horizontal_angle, float vertical_angle
50  );
51 
52  virtual ~CornerHorizon();
53 
58 
59  bool finished();
60  void reset();
61  const char * get_name();
62  unsigned int get_margin();
63 
64  void set_robot_pose(float x, float y, float ori);
65  void set_pan_tilt(float pan, float tilt);
66 
67  unsigned int getHorizon();
68 
69  protected:
70  void calculate();
71 
72  private:
73  ScanlineModel *model;
74 
75  bool calculated;
76 
77  float field_length;
78  float field_width;
79  float field_border;
80 
81  float pose_x;
82  float pose_y;
83  float pose_ori;
84 
85  float pan;
86  float tilt;
87 
88  unsigned int image_width;
89  unsigned int image_height;
90 
91  float camera_height;
92  float camera_ori;
93 
94  float horizontal_angle;
95  float vertical_angle;
96 
97  float pan_pixel_per_rad;
98  float tilt_pixel_per_rad;
99 
100  fawkes::upoint_t coord;
101  fawkes::upoint_t tmp_coord;
102 
103  unsigned int horizon;
104 
105  static const float M_PI_HALF;
106 
107 };
108 
109 } // end namespace firevision
110 
111 #endif
Cut of arbitrary scanline models at an artificial horizon.
Definition: cornerhorizon.h:40
fawkes::upoint_t operator*()
Get the current coordinate.
void set_pan_tilt(float pan, float tilt)
Set camera&#39;s pan/tilt values.
Scanline model interface.
Definition: scanlinemodel.h:55
CornerHorizon(ScanlineModel *model, float field_length, float field_width, float field_border, unsigned int image_width, unsigned int image_height, float camera_height, float camera_ori, float horizontal_angle, float vertical_angle)
Constructor.
void reset()
Reset model.
fawkes::upoint_t * operator++()
Postfix ++ operator.
unsigned int get_margin()
Get margin around points.
fawkes::upoint_t * operator->()
Get pointer to current point.
bool finished()
Check if all desired points have been processed.
Point with cartesian coordinates as unsigned integers.
Definition: types.h:34
virtual ~CornerHorizon()
Destructor.
unsigned int getHorizon()
Get the horizon point.
void calculate()
Calculate horizon point.
void set_robot_pose(float x, float y, float ori)
Set the robot&#39;s pose.
const char * get_name()
Get name of scanline model.