Visual Servoing Platform  version 3.6.1 under development (2024-04-26)
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 
60 class VISP_EXPORT vpQbDevice
61 {
62 public:
63  vpQbDevice();
64  virtual ~vpQbDevice();
65 
67  double getCurrentMax() const;
68  std::vector<short int> getPositionLimits() const;
69  void setMaxRepeats(const int &max_repeats);
71 
72 protected:
75  virtual int activate(const int &id, const bool &command, const int &max_repeats);
76  virtual int activate(const int &id, const int &max_repeats);
77  virtual bool close(const std::string &serial_port);
78  virtual int deactivate(const int &id, const int &max_repeats);
79 
80  virtual int getCurrents(const int &id, const int &max_repeats, std::vector<short int> &currents);
81 
82  virtual int getInfo(const int &id, const int &max_repeats, std::string &info);
83  virtual int getMeasurements(const int &id, const int &max_repeats, std::vector<short int> &currents,
84  std::vector<short int> &positions);
85 
86  virtual int getParameters(const int &id, std::vector<int> &limits, std::vector<int> &resolutions);
87  virtual int getPositions(const int &id, const int &max_repeats, std::vector<short int> &positions);
88  virtual int getSerialPortsAndDevices(const int &max_repeats);
89 
90  virtual bool init(const int &id);
91 
92  virtual int isActive(const int &id, const int &max_repeats, bool &status);
93  int isConnected(const int &id, const int &max_repeats);
94  virtual bool isInConnectedSet(const int &id);
95  virtual bool isInOpenMap(const std::string &serial_port);
96  bool isReliable(int const &failures, int const &max_repeats);
97  virtual int open(const std::string &serial_port);
98 
99  virtual int setCommandsAndWait(const int &id, const int &max_repeats, std::vector<short int> &commands);
100  virtual int setCommandsAsync(const int &id, std::vector<short int> &commands);
102 
103 private:
104  vpQbDevice(const vpQbDevice &); // noncopyable
105  vpQbDevice &operator=(const vpQbDevice &); //
106 
107  // Implementation
108  class Impl;
109  Impl *m_impl;
110 
111 protected:
113  bool m_init_done;
114 };
115 
116 #endif
117 #endif
int m_max_repeats
Max number of trials to send a command.
Definition: vpQbDevice.h:112
bool m_init_done
Flag used to indicate if the device is initialized.
Definition: vpQbDevice.h:113