Visual Servoing Platform  version 3.6.1 under development (2023-10-20)
vpRobotBiclopsController.h
1 /*
2  * ViSP, open source Visual Servoing Platform software.
3  * Copyright (C) 2005 - 2023 by Inria. All rights reserved.
4  *
5  * This software is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
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 https://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 
34 #ifndef _vpRobotBiclopsController_h_
35 #define _vpRobotBiclopsController_h_
36 
37 #include <visp3/core/vpConfig.h>
38 
39 #ifndef DOXYGEN_SHOULD_SKIP_THIS
40 #ifdef VISP_HAVE_BICLOPS
41 
42 #include <iostream>
43 #include <stdio.h>
44 
45 #include <Biclops.h> // Contrib for Biclops sdk
46 #include <PMDUtils.h> // Contrib for Biclops sdk
47 
48 #if defined(_WIN32)
49 class VISP_EXPORT Biclops; // needed for dll creation
50 #endif
51 
52 /* ------------------------------------------------------------------------ */
53 /* --- CLASS ------------------------------------------------------------- */
54 /* ------------------------------------------------------------------------ */
55 
69 class VISP_EXPORT vpRobotBiclopsController
70 {
71 public:
75  typedef enum
76  {
77  STOP,
78  SPEED
79  } vpControllerStatusType;
80 
81 public:
82 #ifndef DOXYGEN_SHOULD_SKIP_THIS
86  typedef struct
87  {
88  vpControllerStatusType status[2];
89  double q_dot[2];
90  double actual_q[2];
91  double actual_q_dot[2];
92  bool jointLimit[2];
93  } shmType;
94 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
95 
96  // private:
97  //#ifndef DOXYGEN_SHOULD_SKIP_THIS
98  // vpRobotBiclopsController(const vpRobotBiclopsController &)
99  // : m_biclops(), m_axisMask(0), m_panAxis(NULL), m_tiltAxis(NULL),
100  // m_vergeAxis(NULL),
101  // m_panProfile(), m_tiltProfile(), m_vergeProfile(), m_shm(),
102  // m_stopControllerThread(false)
103  // {
104  // throw vpException(vpException::functionNotImplementedError, "Not
105  // implemented!");
106  // }
107  // vpRobotBiclopsController &operator=(const vpRobotBiclopsController &){
108  // throw vpException(vpException::functionNotImplementedError, "Not
109  // implemented!"); return *this;
110  // }
111  //#endif
112 
113 public:
117  vpRobotBiclopsController();
118 
122  virtual ~vpRobotBiclopsController();
123 
136  void init(const std::string &configfile);
137 
150  void setPosition(const vpColVector &q, double percentVelocity);
151 
159  void setVelocity(const vpColVector &q_dot);
160 
166  vpColVector getPosition();
167 
173  vpColVector getActualPosition();
174 
180  vpColVector getVelocity();
181 
187  vpColVector getActualVelocity();
188 
192  PMDAxisControl *getPanAxis() { return m_panAxis; };
193 
197  PMDAxisControl *getTiltAxis() { return m_tiltAxis; };
198 
202  PMDAxisControl *getVergeAxis() { return m_vergeAxis; };
203 
209  void writeShm(shmType &shm);
210 
216  shmType readShm();
217 
221  bool isStopRequested() { return m_stopControllerThread; }
222 
227  void stopRequest(bool stop) { m_stopControllerThread = stop; }
228 
229 private:
230  Biclops m_biclops; // THE interface to Biclops.
231  int m_axisMask;
232 
233  // Pointers to each axis (populated once controller is initialized).
234  PMDAxisControl *m_panAxis;
235  PMDAxisControl *m_tiltAxis;
236  PMDAxisControl *m_vergeAxis;
237 
238  PMDAxisControl::Profile m_panProfile;
239  PMDAxisControl::Profile m_tiltProfile;
240  PMDAxisControl::Profile m_vergeProfile;
241 
242  shmType m_shm;
243  bool m_stopControllerThread;
244 };
245 
246 #endif /* #ifndef _vpRobotBiclopsController_h_ */
247 
248 #endif // #ifndef DOXYGEN_SHOULD_SKIP_THIS
249 
250 #endif
Implementation of column vector and the associated operations.
Definition: vpColVector.h:167