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