Visual Servoing Platform version 3.6.0
Loading...
Searching...
No Matches
vpComedi.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 * ATI Force torque interface.
33 *
34*****************************************************************************/
35#ifndef _vpComedi_h_
36#define _vpComedi_h_
37
38#include <visp3/core/vpConfig.h>
39
40#ifdef VISP_HAVE_COMEDI
41
42#include <string>
43
44#include <comedilib.h>
45
46#include <visp3/core/vpColVector.h>
47
106class VISP_EXPORT vpComedi
107{
108public:
109 vpComedi();
110 virtual ~vpComedi();
111
113
114 void close();
116 comedi_t *getHandler() const { return m_handler; }
119 std::vector<lsampl_t> getMaxData() const { return m_maxdata; }
121 unsigned int getNChannel() const { return m_nchannel; }
122
123 vpColVector getPhyData() const;
124 std::string getPhyDataUnits() const;
125
128 std::vector<comedi_range *> getRangeInfo() const { return m_range_info; }
130 unsigned int getSubDevice() const { return m_subdevice; }
131
132 void open();
133
139 void setAnalogReference(const unsigned int &aref) { m_aref = aref; }
140
145 void setChannelNumbers(const unsigned int &nchannel) { m_nchannel = nchannel; }
146
148 void setDevice(const std::string &device) { m_device = device; }
149
155 void setRange(const unsigned int &range) { m_range = range; }
157 void setSubDevice(const unsigned int &subdevice) { m_subdevice = subdevice; }
159
160protected:
161 std::vector<lsampl_t> getRawData() const;
162
163protected:
165
166 std::string m_device;
167 comedi_t *m_handler;
168 unsigned int m_subdevice;
169 unsigned int m_range;
170 unsigned int m_aref;
171 unsigned int m_nchannel;
172 std::vector<comedi_range *> m_range_info;
173 std::vector<lsampl_t> m_maxdata;
174 std::vector<unsigned int> m_chanlist;
176};
177
178#endif
179#endif
Implementation of column vector and the associated operations.
void setChannelNumbers(const unsigned int &nchannel)
Definition vpComedi.h:145
unsigned int m_aref
Definition vpComedi.h:170
std::vector< lsampl_t > m_maxdata
Definition vpComedi.h:173
void setDevice(const std::string &device)
Set comedi device name. Default value is /dev/comedi0.
Definition vpComedi.h:148
void setSubDevice(const unsigned int &subdevice)
Set comedi analog input subdevice.
Definition vpComedi.h:157
std::string m_device
Definition vpComedi.h:166
unsigned int getNChannel() const
Get number of channels.
Definition vpComedi.h:121
unsigned int m_range
Definition vpComedi.h:169
std::vector< comedi_range * > m_range_info
Definition vpComedi.h:172
unsigned int getSubDevice() const
Get comedi subdevice.
Definition vpComedi.h:130
std::vector< comedi_range * > getRangeInfo() const
Definition vpComedi.h:128
unsigned int m_subdevice
Definition vpComedi.h:168
comedi_t * m_handler
Definition vpComedi.h:167
void setAnalogReference(const unsigned int &aref)
Definition vpComedi.h:139
void setRange(const unsigned int &range)
Definition vpComedi.h:155
unsigned int m_nchannel
Definition vpComedi.h:171
std::vector< unsigned int > m_chanlist
Definition vpComedi.h:174
comedi_t * getHandler() const
Get native Comedi handler.
Definition vpComedi.h:116
std::vector< lsampl_t > getMaxData() const
Definition vpComedi.h:119