Visual Servoing Platform version 3.6.0
Loading...
Searching...
No Matches
vpRobotBiclopsController.h
1/****************************************************************************
2 *
3 * ViSP, open source Visual Servoing Platform software.
4 * Copyright (C) 2005 - 2023 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 https://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*****************************************************************************/
35
36#include <visp3/core/vpConfig.h>
37
38#ifndef DOXYGEN_SHOULD_SKIP_THIS
39#ifdef VISP_HAVE_BICLOPS
40
41#ifndef _vpRobotBiclopsController_h_
42#define _vpRobotBiclopsController_h_
43
44/* ------------------------------------------------------------------------ */
45/* --- INCLUDES ----------------------------------------------------------- */
46/* ------------------------------------------------------------------------ */
47
48/* --- GENERAL --- */
49#include <iostream> /* Classe std::ostream. */
50#include <pthread.h> /* Classe std::ostream. */
51#include <stdio.h> /* Classe std::ostream. */
52
53#include "Biclops.h" // Contrib for Biclops robot
54#include "PMDUtils.h" // Contrib for Biclops robot
55
56#if defined(_WIN32)
57class VISP_EXPORT Biclops; // needed for dll creation
58#endif
59
60/* ------------------------------------------------------------------------ */
61/* --- CLASS ------------------------------------------------------------- */
62/* ------------------------------------------------------------------------ */
63
79class VISP_EXPORT vpRobotBiclopsController
80{
81public:
82 typedef enum {
83 STOP,
84 SPEED
85 } vpControllerStatusType;
86
87public:
88#ifndef DOXYGEN_SHOULD_SKIP_THIS
89 // SHM
90 typedef struct /* ControllerShm_struct */ {
91 vpControllerStatusType status[2];
92 double q_dot[2];
93 double actual_q[2];
94 double actual_q_dot[2];
95 bool jointLimit[2];
96 } shmType;
97#endif /* DOXYGEN_SHOULD_SKIP_THIS */
98
99 // private:
100 //#ifndef DOXYGEN_SHOULD_SKIP_THIS
101 // vpRobotBiclopsController(const vpRobotBiclopsController &)
102 // : biclops(), axisMask(0), panAxis(NULL), tiltAxis(NULL),
103 // vergeAxis(NULL),
104 // panProfile(), tiltProfile(), vergeProfile(), shm(),
105 // stopControllerThread_(false)
106 // {
107 // throw vpException(vpException::functionNotImplementedError, "Not
108 // implemented!");
109 // }
110 // vpRobotBiclopsController &operator=(const vpRobotBiclopsController &){
111 // throw vpException(vpException::functionNotImplementedError, "Not
112 // implemented!"); return *this;
113 // }
114 //#endif
115
116public:
117 vpRobotBiclopsController();
118 virtual ~vpRobotBiclopsController();
119 void init(const std::string &configfile);
120 void setPosition(const vpColVector &q, double percentVelocity);
121 void setVelocity(const vpColVector &q_dot);
122 vpColVector getPosition();
123 vpColVector getActualPosition();
124 vpColVector getVelocity();
125 vpColVector getActualVelocity();
126 PMDAxisControl *getPanAxis() { return panAxis; };
127 PMDAxisControl *getTiltAxis() { return tiltAxis; };
128 PMDAxisControl *getVergeAxis() { return vergeAxis; };
129 void writeShm(shmType &shm);
130 shmType readShm();
131 bool isStopRequested() { return stopControllerThread_; }
132
133 void stopRequest(bool stop) { stopControllerThread_ = stop; }
134
135private:
136 Biclops biclops; // THE interface to Biclops.
137 int axisMask;
138
139 // Pointers to each axis (populated once controller is initialized).
140 PMDAxisControl *panAxis;
141 PMDAxisControl *tiltAxis;
142 PMDAxisControl *vergeAxis;
143
144 PMDAxisControl::Profile panProfile;
145 PMDAxisControl::Profile tiltProfile;
146 PMDAxisControl::Profile vergeProfile;
147
148 shmType shm;
149 bool stopControllerThread_;
150};
151
152#endif /* #ifndef _vpRobotBiclopsController_h_ */
153
154#endif // #ifndef DOXYGEN_SHOULD_SKIP_THIS
155
156#endif
Implementation of column vector and the associated operations.