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