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