ViSP  2.8.0
vpRobotBiclopsController.h
1 /****************************************************************************
2  *
3  * $Id: vpRobotBiclopsController.h 4056 2013-01-05 13:04:42Z fspindle $
4  *
5  * This file is part of the ViSP software.
6  * Copyright (C) 2005 - 2013 by INRIA. All rights reserved.
7  *
8  * This software is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU General Public License
10  * ("GPL") version 2 as published by the Free Software Foundation.
11  * See the file LICENSE.txt at the root directory of this source
12  * distribution for additional information about the GNU GPL.
13  *
14  * For using ViSP with software that can not be combined with the GNU
15  * GPL, please contact INRIA about acquiring a ViSP Professional
16  * Edition License.
17  *
18  * See http://www.irisa.fr/lagadic/visp/visp.html for more information.
19  *
20  * This software was developed at:
21  * INRIA Rennes - Bretagne Atlantique
22  * Campus Universitaire de Beaulieu
23  * 35042 Rennes Cedex
24  * France
25  * http://www.irisa.fr/lagadic
26  *
27  * If you have questions regarding the use of this file, please contact
28  * INRIA at visp@inria.fr
29  *
30  * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
31  * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
32  *
33  *
34  * Description:
35  * Interface for the Biclops robot.
36  *
37  * Authors:
38  * Fabien Spindler
39  *
40  *****************************************************************************/
41 
42 #include <visp/vpConfig.h>
43 
44 #ifdef VISP_HAVE_BICLOPS
45 
46 #ifndef __vpROBOT_BICLOPS_CONTROLLER_H
47 #define __vpROBOT_BICLOPS_CONTROLLER_H
48 
49 
50 /* ------------------------------------------------------------------------ */
51 /* --- INCLUDES ----------------------------------------------------------- */
52 /* ------------------------------------------------------------------------ */
53 
54 /* --- GENERAL --- */
55 #include <iostream> /* Classe std::ostream. */
56 #include <stdio.h> /* Classe std::ostream. */
57 #include <pthread.h> /* Classe std::ostream. */
58 
59 #include <visp/vpConfig.h>
60 
61 #include "Biclops.h" // Contrib for Biclops robot
62 #include "PMDUtils.h" // Contrib for Biclops robot
63 
64 #ifdef WIN32
65 class VISP_EXPORT Biclops; //needed for dll creation
66 #endif
67 
68 /* ------------------------------------------------------------------------ */
69 /* --- CLASS ------------------------------------------------------------- */
70 /* ------------------------------------------------------------------------ */
71 
87 class VISP_EXPORT vpRobotBiclopsController
88 {
89 public:
90  typedef enum {
91  STOP,
92  SPEED
93  } vpControllerStatusType;
94 
95 public:
96 #ifndef DOXYGEN_SHOULD_SKIP_THIS
97  // SHM
98  typedef struct /* ControllerShm_struct */ {
99  vpControllerStatusType status[2];
100  double q_dot[2];
101  double actual_q[2];
102  double actual_q_dot[2];
103  bool jointLimit[2];
104  } shmType;
105 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
106 
107 public:
109  virtual ~vpRobotBiclopsController();
110  void init(const char *configfile);
111  void setPosition(const vpColVector & q, const double percentVelocity);
112  void setVelocity(const vpColVector & q_dot);
113  vpColVector getPosition();
114  vpColVector getActualPosition();
115  vpColVector getVelocity();
116  vpColVector getActualVelocity();
117  PMDAxisControl * getPanAxis() { return panAxis; };
118  PMDAxisControl * getTiltAxis() { return tiltAxis; };
119  PMDAxisControl * getVergeAxis() { return vergeAxis; };
120  void writeShm(shmType &shm);
121  shmType readShm();
123  {
124  return stopControllerThread_;
125  }
126 
127  void stopRequest(bool stop)
128  {
129  stopControllerThread_ = stop;
130  }
131 
132 private:
133  Biclops biclops; // THE interface to Biclops.
134  int axisMask;
135 
136  // Pointers to each axis (populated once controller is initialized).
137  PMDAxisControl *panAxis;
138  PMDAxisControl *tiltAxis;
139  PMDAxisControl *vergeAxis;
140 
141  PMDAxisControl::Profile panProfile;
142  PMDAxisControl::Profile tiltProfile;
143  PMDAxisControl::Profile vergeProfile;
144 
145  shmType shm;
146  bool stopControllerThread_;
147 
148 };
149 
150 
151 #endif /* #ifndef __vpROBOT_BICLOPS_CONTROLLER_H */
152 
153 
154 /*
155  * Local variables:
156  * c-basic-offset: 2
157  * End:
158  */
159 
160 #endif
Class that provides a data structure for the column vectors as well as a set of operations on these v...
Definition: vpColVector.h:72
Interface to Biclops, pan, tilt, verge head for computer vision applications.