Fawkes API  Fawkes Development Version
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
globvelo.h
1 
2 /***************************************************************************
3  * globvelo.h - A simple velocity model using the global coordinates
4  *
5  * Created: Mon Sep 05 17:06:54 2005
6  * Copyright 2005 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_VELOCITY_GLOBAL_H_
25 #define __FIREVISION_MODELS_VELOCITY_GLOBAL_H_
26 
27 #include <fvmodels/velocity/velocitymodel.h>
28 #include <fvmodels/global_position/globalpositionmodel.h>
29 
30 #include <sys/time.h>
31 #include <vector>
32 
33 // include <utils/kalman_filter/ckalman_filter_2dim.h>
34 
35 namespace firevision {
36 #if 0 /* just to make Emacs auto-indent happy */
37 }
38 #endif
39 
41 {
42  public:
43  VelocityFromGlobal(GlobalPositionModel* model, unsigned int history_length, unsigned int calc_interval);
44  virtual ~VelocityFromGlobal();
45 
46  virtual const char * getName() const;
47 
48  virtual void setRobotPosition(float x, float y, float ori, timeval t);
49  virtual void setRobotVelocity(float vel_x, float vel_y, timeval t);
50  virtual void setPanTilt(float pan, float tilt);
51  virtual void setTime(timeval t);
52  virtual void setTimeNow();
53  virtual void getTime(long int *sec, long int *usec);
54 
55  virtual void getVelocity(float *vel_x, float *vel_y);
56 
57  virtual float getVelocityX();
58  virtual float getVelocityY();
59 
60  virtual void calc();
61  virtual void reset();
62 
63  virtual coordsys_type_t getCoordinateSystem();
64 
65  private:
66  GlobalPositionModel *global_pos_model;
67 
68  float robot_pos_x;
69  float robot_pos_y;
70  float robot_pos_ori;
71  float robot_pos_age;
72 
73  timeval now;
74  std::vector<timeval> last_time;
75 
76  unsigned int history_length;
77  unsigned int calc_interval;
78 
79  int diff_sec;
80  int diff_usec;
81 
82  float f_diff_sec;
83 
84 
85  std::vector<float> last_x;
86  std::vector<float> last_y;
87 
88  float current_x;
89  float current_y;
90 
91  float diff_x;
92  float diff_y;
93 
94  float velocity_total_x;
95  float velocity_total_y;
96  float velocity_num;
97 
98  float velocity_x;
99  float velocity_y;
100 
101  /*
102  kalmanFilter2Dim *kalman_filter;
103 
104  void applyKalmanFilter();
105  */
106 
107 };
108 
109 } // end namespace firevision
110 
111 #endif