Visual Servoing Platform  version 3.0.1
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
vpComedi.h
1 /****************************************************************************
2  *
3  * This file is part of the ViSP software.
4  * Copyright (C) 2005 - 2017 by Inria. All rights reserved.
5  *
6  * This software is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * ("GPL") version 2 as published by the Free Software Foundation.
9  * See the file LICENSE.txt at the root directory of this source
10  * distribution for additional information about the GNU GPL.
11  *
12  * For using ViSP with software that can not be combined with the GNU
13  * GPL, please contact Inria about acquiring a ViSP Professional
14  * Edition License.
15  *
16  * See http://visp.inria.fr for more information.
17  *
18  * This software was developed at:
19  * Inria Rennes - Bretagne Atlantique
20  * Campus Universitaire de Beaulieu
21  * 35042 Rennes Cedex
22  * France
23  *
24  * If you have questions regarding the use of this file, please contact
25  * Inria at visp@inria.fr
26  *
27  * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
28  * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
29  *
30  * Description:
31  * ATI Force torque interface.
32  *
33  * Authors:
34  * Fabien Spindler
35  *
36  *****************************************************************************/
37 #ifndef __vpComedi_
38 #define __vpComedi_
39 
40 #include <visp3/core/vpConfig.h>
41 
42 #ifdef VISP_HAVE_COMEDI
43 
44 #include <string>
45 
46 #include <comedilib.h>
47 
48 #include <visp3/core/vpColVector.h>
49 
104 class VISP_EXPORT vpComedi
105 {
106 public:
107  vpComedi();
108  virtual ~vpComedi();
109 
111 
112  void close();
114  comedi_t * getHandler() const
115  {
116  return m_handler;
117  }
119  std::vector<lsampl_t> getMaxData() const
120  {
121  return m_maxdata;
122  }
124  unsigned int getNChannel() const
125  {
126  return m_nchannel;
127  }
128 
129  vpColVector getPhyData() const;
130  std::string getPhyDataUnits() const;
131 
133  std::vector<comedi_range *> getRangeInfo() const
134  {
135  return m_range_info;
136  }
138  unsigned int getSubDevice() const {
139  return m_subdevice;
140  }
141 
142  void open();
143 
149  void setAnalogReference(const unsigned int &aref) {
150  m_aref = aref;
151  }
152 
156  void setChannelNumbers(const unsigned int &nchannel) {
157  m_nchannel = nchannel;
158  }
159 
161  void setDevice(const std::string &device) {
162  m_device = device;
163  }
164 
169  void setRange(const unsigned int &range) {
170  m_range = range;
171  }
173  void setSubDevice(const unsigned int &subdevice) {
174  m_subdevice = subdevice;
175  }
177 
178 protected:
179  std::vector<lsampl_t> getRawData() const;
180 
181 protected:
183 
184  std::string m_device;
185  comedi_t *m_handler;
186  unsigned int m_subdevice;
187  unsigned int m_range;
188  unsigned int m_aref;
189  unsigned int m_nchannel;
190  std::vector<comedi_range *>m_range_info;
191  std::vector<lsampl_t> m_maxdata;
192  std::vector<unsigned int> m_chanlist;
194 };
195 
196 #endif
197 #endif
void setChannelNumbers(const unsigned int &nchannel)
Definition: vpComedi.h:156
std::vector< lsampl_t > getMaxData() const
Get max data per channel. The returned vector is of dimension the number of channels.
Definition: vpComedi.h:119
void setSubDevice(const unsigned int &subdevice)
Set comedi analog input subdevice.
Definition: vpComedi.h:173
unsigned int getSubDevice() const
Get comedi subdevice.
Definition: vpComedi.h:138
unsigned int getNChannel() const
Get number of channels.
Definition: vpComedi.h:124
void setDevice(const std::string &device)
Set comedi device name. Default value is /dev/comedi0.
Definition: vpComedi.h:161
unsigned int m_aref
Definition: vpComedi.h:188
unsigned int m_range
Definition: vpComedi.h:187
void setAnalogReference(const unsigned int &aref)
Definition: vpComedi.h:149
unsigned int m_subdevice
Definition: vpComedi.h:186
std::vector< comedi_range * > getRangeInfo() const
Get data range information per channel. The returned vector is of dimension the number of channels...
Definition: vpComedi.h:133
std::vector< unsigned int > m_chanlist
Definition: vpComedi.h:192
Implementation of column vector and the associated operations.
Definition: vpColVector.h:72
comedi_t * m_handler
Definition: vpComedi.h:185
std::vector< lsampl_t > m_maxdata
Definition: vpComedi.h:191
comedi_t * getHandler() const
Get native Comedi handler.
Definition: vpComedi.h:114
std::string m_device
Definition: vpComedi.h:184
void setRange(const unsigned int &range)
Definition: vpComedi.h:169
unsigned int m_nchannel
Definition: vpComedi.h:189
std::vector< comedi_range * > m_range_info
Definition: vpComedi.h:190