Fawkes API  Fawkes Development Version
velocitymodel.h
00001 
00002 /***************************************************************************
00003  *  velocitymodel.h - Abstract class defining a velocity model
00004  *
00005  *  Created: Mon Sep 05 16:59:58 2005
00006  *  Copyright  2005  Tim Niemueller [www.niemueller.de]
00007  *
00008  ****************************************************************************/
00009 
00010 /*  This program is free software; you can redistribute it and/or modify
00011  *  it under the terms of the GNU General Public License as published by
00012  *  the Free Software Foundation; either version 2 of the License, or
00013  *  (at your option) any later version. A runtime exception applies to
00014  *  this software (see LICENSE.GPL_WRE file mentioned below for details).
00015  *
00016  *  This program is distributed in the hope that it will be useful,
00017  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00018  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00019  *  GNU Library General Public License for more details.
00020  *
00021  *  Read the full text in the LICENSE.GPL_WRE file in the doc directory.
00022  */
00023 
00024 #ifndef __FIREVISION_VELOCITYMODEL_H_
00025 #define __FIREVISION_VELOCITYMODEL_H_
00026 
00027 #include <sys/time.h>
00028 #include <fvutils/base/types.h>
00029 
00030 namespace firevision {
00031 #if 0 /* just to make Emacs auto-indent happy */
00032 }
00033 #endif
00034 
00035 class VelocityModel
00036 {
00037 
00038  public:
00039   virtual ~VelocityModel();
00040 
00041   virtual const char *  getName() const                                = 0;
00042 
00043   virtual void  setPanTilt(float pan, float tilt)                          = 0;
00044   virtual void  setRobotPosition(float x, float y, float ori, timeval t)   = 0;
00045   virtual void  setRobotVelocity(float vel_x, float vel_y, timeval t)      = 0;
00046   virtual void  setTime(timeval t)                                         = 0;
00047   virtual void  setTimeNow()                                               = 0;
00048   virtual void  getTime(long int *sec, long int *usec)                     = 0;
00049 
00050   /* Method to retrieve velocity information
00051    * @param vel_x If not NULL contains velocity in X direction after call
00052    * @param vel_y If not NULL contains velocity in Y direction after call
00053    */
00054   virtual void  getVelocity(float *vel_x, float *vel_y)              = 0;
00055 
00056   virtual float getVelocityX()                                       = 0;
00057   virtual float getVelocityY()                                       = 0;
00058 
00059 
00060   /** Calculate velocity values from given data
00061    * This method must be called after all relevent data (set*) has been
00062    * set. After calc() the velocity values can be retrieved
00063    */
00064   virtual void calc()                                               = 0;
00065 
00066   /** Reset velocity model
00067    * Must be called if ball is not visible at any time
00068    */
00069   virtual void reset()                                              = 0;
00070 
00071   /** Returns the used coordinate system, must be either COORDSYS_ROBOT_CART or
00072    * COORDSYS_ROBOT_WORLD. ROBOT denotes velocities relative to the robot
00073    * (which can be tramsformed to global velocities by:
00074    * glob_vel_x = rel_vel_x * cos( robot_ori ) - rel_vel_y * sin( robot_ori )
00075    * WORLD denotes velocities in the robot coordinate system
00076    * glob_vel_y = rel_vel_x * sin( robot_ori ) + rel_vel_y * cos( robot_ori )
00077    * @return coordinate system type
00078    */
00079   virtual coordsys_type_t getCoordinateSystem()                     = 0;
00080 
00081 };
00082 
00083 } // end namespace firevision
00084 
00085 #endif