Fawkes API Fawkes Development Version
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/global_position/globalpositionmodel.h>
28#include <fvmodels/velocity/velocitymodel.h>
29#include <sys/time.h>
30
31#include <vector>
32
33// include <utils/kalman_filter/ckalman_filter_2dim.h>
34
35namespace firevision {
36
38{
39public:
41 unsigned int history_length,
42 unsigned int calc_interval);
43 virtual ~VelocityFromGlobal();
44
45 virtual const char *getName() const;
46
47 virtual void setRobotPosition(float x, float y, float ori, timeval t);
48 virtual void setRobotVelocity(float vel_x, float vel_y, timeval t);
49 virtual void setPanTilt(float pan, float tilt);
50 virtual void setTime(timeval t);
51 virtual void setTimeNow();
52 virtual void getTime(long int *sec, long int *usec);
53
54 virtual void getVelocity(float *vel_x, float *vel_y);
55
56 virtual float getVelocityX();
57 virtual float getVelocityY();
58
59 virtual void calc();
60 virtual void reset();
61
62 virtual coordsys_type_t getCoordinateSystem();
63
64private:
65 GlobalPositionModel *global_pos_model;
66
67 float robot_pos_x;
68 float robot_pos_y;
69 float robot_pos_ori;
70 float robot_pos_age;
71
72 timeval now;
73 std::vector<timeval> last_time;
74
75 unsigned int history_length;
76 unsigned int calc_interval;
77
78 int diff_sec;
79 int diff_usec;
80
81 float f_diff_sec;
82
83 std::vector<float> last_x;
84 std::vector<float> last_y;
85
86 float current_x;
87 float current_y;
88
89 float diff_x;
90 float diff_y;
91
92 float velocity_total_x;
93 float velocity_total_y;
94 float velocity_num;
95
96 float velocity_x;
97 float velocity_y;
98
99 /*
100 kalmanFilter2Dim *kalman_filter;
101
102 void applyKalmanFilter();
103 */
104};
105
106} // end namespace firevision
107
108#endif
Global Position Model Interface.
Velocity from global positions.
Definition: globvelo.h:38
virtual void getTime(long int *sec, long int *usec)
Get time from velocity.
Definition: globvelo.cpp:115
virtual void calc()
Calculate velocity values from given data This method must be called after all relevent data (set*) h...
Definition: globvelo.cpp:145
virtual void setTimeNow()
Get current time from system.
Definition: globvelo.cpp:109
virtual coordsys_type_t getCoordinateSystem()
Returns the used coordinate system, must be either COORDSYS_ROBOT_CART or COORDSYS_ROBOT_WORLD.
Definition: globvelo.cpp:207
virtual void getVelocity(float *vel_x, float *vel_y)
Method to retrieve velocity information.
Definition: globvelo.cpp:122
virtual void setPanTilt(float pan, float tilt)
Set pan and tilt.
Definition: globvelo.cpp:81
virtual const char * getName() const
Get name of velocity model.
Definition: globvelo.cpp:201
virtual float getVelocityX()
Get velocity of tracked object in X direction.
Definition: globvelo.cpp:133
virtual void setRobotPosition(float x, float y, float ori, timeval t)
Set robot position.
Definition: globvelo.cpp:86
virtual void setTime(timeval t)
Set current time.
Definition: globvelo.cpp:102
virtual float getVelocityY()
Get velocity of tracked object in X direction.
Definition: globvelo.cpp:139
VelocityFromGlobal(GlobalPositionModel *model, unsigned int history_length, unsigned int calc_interval)
Constructor.
Definition: globvelo.cpp:41
virtual ~VelocityFromGlobal()
Destructor.
Definition: globvelo.cpp:76
virtual void setRobotVelocity(float vel_x, float vel_y, timeval t)
Set robot velocity.
Definition: globvelo.cpp:97
virtual void reset()
Reset velocity model Must be called if ball is not visible at any time.
Definition: globvelo.cpp:195
Velocity model interface.
Definition: velocitymodel.h:33