Visual Servoing Platform  version 3.1.0
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 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  * ATI Force torque interface.
33  *
34  * Authors:
35  * Fabien Spindler
36  *
37  *****************************************************************************/
38 #ifndef __vpComedi_
39 #define __vpComedi_
40 
41 #include <visp3/core/vpConfig.h>
42 
43 #ifdef VISP_HAVE_COMEDI
44 
45 #include <string>
46 
47 #include <comedilib.h>
48 
49 #include <visp3/core/vpColVector.h>
50 
109 class VISP_EXPORT vpComedi
110 {
111 public:
112  vpComedi();
113  virtual ~vpComedi();
114 
116 
117  void close();
119  comedi_t *getHandler() const { return m_handler; }
122  std::vector<lsampl_t> getMaxData() const { return m_maxdata; }
124  unsigned int getNChannel() const { return m_nchannel; }
125 
126  vpColVector getPhyData() const;
127  std::string getPhyDataUnits() const;
128 
131  std::vector<comedi_range *> getRangeInfo() const { return m_range_info; }
133  unsigned int getSubDevice() const { return m_subdevice; }
134 
135  void open();
136 
142  void setAnalogReference(const unsigned int &aref) { m_aref = aref; }
143 
148  void setChannelNumbers(const unsigned int &nchannel) { m_nchannel = nchannel; }
149 
151  void setDevice(const std::string &device) { m_device = device; }
152 
158  void setRange(const unsigned int &range) { m_range = range; }
160  void setSubDevice(const unsigned int &subdevice) { m_subdevice = subdevice; }
162 
163 protected:
164  std::vector<lsampl_t> getRawData() const;
165 
166 protected:
168 
169  std::string m_device;
170  comedi_t *m_handler;
171  unsigned int m_subdevice;
172  unsigned int m_range;
173  unsigned int m_aref;
174  unsigned int m_nchannel;
175  std::vector<comedi_range *> m_range_info;
176  std::vector<lsampl_t> m_maxdata;
177  std::vector<unsigned int> m_chanlist;
179 };
180 
181 #endif
182 #endif
void setChannelNumbers(const unsigned int &nchannel)
Definition: vpComedi.h:148
void setSubDevice(const unsigned int &subdevice)
Set comedi analog input subdevice.
Definition: vpComedi.h:160
void setDevice(const std::string &device)
Set comedi device name. Default value is /dev/comedi0.
Definition: vpComedi.h:151
unsigned int m_aref
Definition: vpComedi.h:173
unsigned int m_range
Definition: vpComedi.h:172
unsigned int getNChannel() const
Get number of channels.
Definition: vpComedi.h:124
std::vector< comedi_range * > getRangeInfo() const
Definition: vpComedi.h:131
void setAnalogReference(const unsigned int &aref)
Definition: vpComedi.h:142
unsigned int m_subdevice
Definition: vpComedi.h:171
comedi_t * getHandler() const
Get native Comedi handler.
Definition: vpComedi.h:119
std::vector< lsampl_t > getMaxData() const
Definition: vpComedi.h:122
std::vector< unsigned int > m_chanlist
Definition: vpComedi.h:177
Implementation of column vector and the associated operations.
Definition: vpColVector.h:72
comedi_t * m_handler
Definition: vpComedi.h:170
std::vector< lsampl_t > m_maxdata
Definition: vpComedi.h:176
unsigned int getSubDevice() const
Get comedi subdevice.
Definition: vpComedi.h:133
std::string m_device
Definition: vpComedi.h:169
void setRange(const unsigned int &range)
Definition: vpComedi.h:158
unsigned int m_nchannel
Definition: vpComedi.h:174
std::vector< comedi_range * > m_range_info
Definition: vpComedi.h:175