Visual Servoing Platform  version 3.4.1 under development (2021-04-20)
vpQbDevice.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 qb robotics devices.
33  *
34  * Authors:
35  * Fabien Spindler
36  *
37  *****************************************************************************/
38 
39 #ifndef _vpQbDevice_h_
40 #define _vpQbDevice_h_
41 
42 #include <visp3/core/vpConfig.h>
43 #ifdef VISP_HAVE_QBDEVICE
44 
45 #include <vector>
46 #include <map>
47 #include <mutex>
48 #include <memory>
49 
63 class VISP_EXPORT vpQbDevice
64 {
65 public:
66  vpQbDevice();
67  virtual ~vpQbDevice();
68 
70  double getCurrentMax() const;
71  std::vector<short int> getPositionLimits() const;
72  void setMaxRepeats(const int &max_repeats);
74 
75 protected:
78  virtual int activate(const int &id, const bool &command, const int &max_repeats);
79  virtual int activate(const int &id, const int &max_repeats);
80  virtual bool close(const std::string &serial_port);
81  virtual int deactivate(const int &id, const int &max_repeats);
82 
83  virtual int getCurrents(const int &id, const int &max_repeats, std::vector<short int> &currents);
84 
85  virtual int getInfo(const int &id, const int &max_repeats, std::string &info);
86  virtual int getMeasurements(const int &id, const int &max_repeats, std::vector<short int> &currents, std::vector<short int> &positions);
87 
88  virtual int getParameters(const int &id, std::vector<int> &limits, std::vector<int> &resolutions);
89  virtual int getPositions(const int &id, const int &max_repeats, std::vector<short int> &positions);
90  virtual int getSerialPortsAndDevices(const int &max_repeats);
91 
92  virtual bool init(const int &id);
93 
94  virtual int isActive(const int &id, const int &max_repeats, bool &status);
95  int isConnected(const int &id, const int &max_repeats);
96  virtual bool isInConnectedSet(const int &id);
97  virtual bool isInOpenMap(const std::string &serial_port);
98  bool isReliable(int const &failures, int const &max_repeats);
99  virtual int open(const std::string &serial_port);
100 
101  virtual int setCommandsAndWait(const int &id, const int &max_repeats, std::vector<short int> &commands);
102  virtual int setCommandsAsync(const int &id, std::vector<short int> &commands);
104 
105 private:
106  vpQbDevice(const vpQbDevice &); // noncopyable
107  vpQbDevice &operator=(const vpQbDevice &); //
108 
109  // Implementation
110  class Impl;
111  Impl *m_impl;
112 
113 protected:
115  bool m_init_done;
116 };
117 
118 
119 #endif
120 #endif
bool m_init_done
Flag used to indicate if the device is initialized.
Definition: vpQbDevice.h:115
int m_max_repeats
Max number of trials to send a command.
Definition: vpQbDevice.h:114