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 
38 {
39 public:
41  float field_length,
42  float field_width,
43  float field_border,
44  unsigned int image_width,
45  unsigned int image_height,
46  float camera_height,
47  float camera_ori,
48  float horizontal_angle,
49  float vertical_angle);
50 
51  virtual ~CornerHorizon();
52 
57 
58  bool finished();
59  void reset();
60  const char * get_name();
61  unsigned int get_margin();
62 
63  void set_robot_pose(float x, float y, float ori);
64  void set_pan_tilt(float pan, float tilt);
65 
66  unsigned int getHorizon();
67 
68 protected:
69  void calculate();
70 
71 private:
72  ScanlineModel *model;
73 
74  bool calculated;
75 
76  float field_length;
77  float field_width;
78  float field_border;
79 
80  float pose_x;
81  float pose_y;
82  float pose_ori;
83 
84  float pan;
85  float tilt;
86 
87  unsigned int image_width;
88  unsigned int image_height;
89 
90  float camera_height;
91  float camera_ori;
92 
93  float horizontal_angle;
94  float vertical_angle;
95 
96  float pan_pixel_per_rad;
97  float tilt_pixel_per_rad;
98 
99  fawkes::upoint_t coord;
100  fawkes::upoint_t tmp_coord;
101 
102  unsigned int horizon;
103 
104  static const float M_PI_HALF;
105 };
106 
107 } // end namespace firevision
108 
109 #endif
firevision::CornerHorizon::getHorizon
unsigned int getHorizon()
Get the horizon point.
Definition: cornerhorizon.cpp:258
firevision::CornerHorizon::operator++
fawkes::upoint_t * operator++()
Postfix ++ operator.
Definition: cornerhorizon.cpp:180
firevision::CornerHorizon::get_name
const char * get_name()
Get name of scanline model.
Definition: cornerhorizon.cpp:243
firevision::CornerHorizon
Cut of arbitrary scanline models at an artificial horizon.
Definition: cornerhorizon.h:38
fawkes::upoint_t
Point with cartesian coordinates as unsigned integers.
Definition: types.h:35
firevision::CornerHorizon::finished
bool finished()
Check if all desired points have been processed.
Definition: cornerhorizon.cpp:229
firevision::CornerHorizon::operator->
fawkes::upoint_t * operator->()
Get pointer to current point.
Definition: cornerhorizon.cpp:115
firevision::ScanlineModel
Scanline model interface.
Definition: scanlinemodel.h:53
firevision::CornerHorizon::reset
void reset()
Reset model.
Definition: cornerhorizon.cpp:235
firevision::CornerHorizon::set_robot_pose
void set_robot_pose(float x, float y, float ori)
Set the robot's pose.
Definition: cornerhorizon.cpp:264
firevision::CornerHorizon::~CornerHorizon
virtual ~CornerHorizon()
Destructor.
Definition: cornerhorizon.cpp:103
firevision::CornerHorizon::CornerHorizon
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.
Definition: cornerhorizon.cpp:68
firevision::CornerHorizon::get_margin
unsigned int get_margin()
Get margin around points.
Definition: cornerhorizon.cpp:249
firevision::CornerHorizon::calculate
void calculate()
Calculate horizon point.
Definition: cornerhorizon.cpp:122
firevision::CornerHorizon::set_pan_tilt
void set_pan_tilt(float pan, float tilt)
Set camera's pan/tilt values.
Definition: cornerhorizon.cpp:272
firevision::CornerHorizon::operator*
fawkes::upoint_t operator*()
Get the current coordinate.
Definition: cornerhorizon.cpp:109