Basic Image AlgorithmS Library  2.8.0
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
PanTiltSoftMotion.hh
1 /*
2 This file is part of the BIAS library (Basic ImageAlgorithmS).
3 
4 Copyright (C) 2003-2009 (see file CONTACT for details)
5  Multimediale Systeme der Informationsverarbeitung
6  Institut fuer Informatik
7  Christian-Albrechts-Universitaet Kiel
8 
9 
10 BIAS is free software; you can redistribute it and/or modify
11 it under the terms of the GNU Lesser General Public License as published by
12 the Free Software Foundation; either version 2.1 of the License, or
13 (at your option) any later version.
14 
15 BIAS is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU Lesser General Public License for more details.
19 
20 You should have received a copy of the GNU Lesser General Public License
21 along with BIAS; if not, write to the Free Software
22 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 */
24 
25 
26 #ifndef PANTILT_SOFT_MOTION_HH
27 #define PANTILT_SOFT_MOTION_HH
28 
29 namespace BIAS{
30 
31  /** \class PanTiltSoftMotion
32  * \brief
33  * \author fkellner
34  */
35  class BIASPanTilt_EXPORT PanTiltSoftMotion {
36 public:
39 
40  void setLimits(int _min_pan, int _max_pan, int _min_pan_speed, int _max_pan_speed, int _min_tilt_speed, int _max_tilt_speed);
41 
42  void assert_pan(int &pan);
43  void assert_tilt(int &tilt);
44 
45  int getPanSpeed(int start_pan, int end_pan, int cur_pan, int damp);
46  int getTiltSpeed(int start_pan, int end_pan, int start_tilt, int end_tilt, int cur_pan, int cur_tilt, int damp);
47 
48 private:
49  int calcSpeed(int start_val, int end_val, int cur_val, int damp);
50  bool tilt_active;
51  int min_pan, max_pan, min_tilt, max_tilt, min_pan_speed, min_tilt_speed, max_pan_speed, max_tilt_speed;
52  int min(int val1, int val2) {
53  return (val1 < val2) ? val1 : val2;
54  }
55  int max(int val1, int val2) {
56  return (val1 < val2) ? val2 : val1;
57  }
58 };
59 
61 }
62 #endif //PANTILT_SOFT_MOTION_HH
PanTiltSoftMotion t_SoftMotion