globvelo.h
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef __FIREVISION_MODELS_VELOCITY_GLOBAL_H_
00025 #define __FIREVISION_MODELS_VELOCITY_GLOBAL_H_
00026
00027 #include <models/velocity/velocitymodel.h>
00028 #include <models/global_position/globalpositionmodel.h>
00029
00030 #include <sys/time.h>
00031 #include <vector>
00032
00033
00034
00035
00036 class VelocityFromGlobal : public VelocityModel
00037 {
00038 public:
00039 VelocityFromGlobal(GlobalPositionModel* model, unsigned int history_length, unsigned int calc_interval);
00040 virtual ~VelocityFromGlobal();
00041
00042 virtual const char * getName() const;
00043
00044 virtual void setRobotPosition(float x, float y, float ori, timeval t);
00045 virtual void setRobotVelocity(float vel_x, float vel_y, timeval t);
00046 virtual void setPanTilt(float pan, float tilt);
00047 virtual void setTime(timeval t);
00048 virtual void setTimeNow();
00049 virtual void getTime(long int *sec, long int *usec);
00050
00051 virtual void getVelocity(float *vel_x, float *vel_y);
00052
00053 virtual float getVelocityX();
00054 virtual float getVelocityY();
00055
00056 virtual void calc();
00057 virtual void reset();
00058
00059 virtual coordsys_type_t getCoordinateSystem();
00060
00061 private:
00062 GlobalPositionModel *global_pos_model;
00063
00064 float robot_pos_x;
00065 float robot_pos_y;
00066 float robot_pos_ori;
00067 float robot_pos_age;
00068
00069 timeval now;
00070 std::vector<timeval> last_time;
00071
00072 unsigned int history_length;
00073 unsigned int calc_interval;
00074
00075 int diff_sec;
00076 int diff_usec;
00077
00078 float f_diff_sec;
00079
00080
00081 std::vector<float> last_x;
00082 std::vector<float> last_y;
00083
00084 float current_x;
00085 float current_y;
00086
00087 float diff_x;
00088 float diff_y;
00089
00090 float velocity_total_x;
00091 float velocity_total_y;
00092 float velocity_num;
00093
00094 float velocity_x;
00095 float velocity_y;
00096
00097
00098
00099
00100
00101
00102
00103 };
00104
00105 #endif