Visual Servoing Platform
version 3.6.1 under development (2024-12-10)
|
#include <visp3/sensor/vpComedi.h>
Public Member Functions | |
vpComedi () | |
virtual | ~vpComedi () |
Protected Attributes | |
Protected Member Functions Inherited from vpComedi | |
std::string | m_device |
comedi_t * | m_handler |
unsigned int | m_subdevice |
unsigned int | m_range |
unsigned int | m_aref |
unsigned int | m_nchannel |
std::vector< comedi_range * > | m_range_info |
std::vector< lsampl_t > | m_maxdata |
std::vector< unsigned int > | m_chanlist |
Inherited functionalities from vpComedi | |
void | close () |
comedi_t * | getHandler () const |
std::vector< lsampl_t > | getMaxData () const |
unsigned int | getNChannel () const |
vpColVector | getPhyData () const |
std::string | getPhyDataUnits () const |
std::vector< comedi_range * > | getRangeInfo () const |
unsigned int | getSubDevice () const |
void | open () |
void | setAnalogReference (const unsigned int &aref) |
void | setChannelNumbers (const unsigned int &nchannel) |
void | setDevice (const std::string &device) |
void | setRange (const unsigned int &range) |
void | setSubDevice (const unsigned int &subdevice) |
std::vector< lsampl_t > | getRawData () const |
Interface for data acquisition devices supported by Comedi. Comedi is a linux control and measurement device interface. For more information see http://www.comedi.org.
This class was tested with ATI Gamma 65-SI FT sensor connected to a National Instrument NI DAQmx PCI-6220 board.
The following example shows how to run an synchronous data acquisition at 500 Hz, calling getPhyData() each 2 ms:
Definition at line 111 of file vpComedi.h.
BEGIN_VISP_NAMESPACE vpComedi::vpComedi | ( | ) |
Default constructor.
Definition at line 49 of file vpComedi.cpp.
|
virtual |
Destructor that closes the connection to the device if it is not already done calling close().
Definition at line 58 of file vpComedi.cpp.
References close().
void vpComedi::close | ( | ) |
Close the connection to the device.
Definition at line 90 of file vpComedi.cpp.
References m_handler.
Referenced by vpForceTorqueAtiSensor::close(), and ~vpComedi().
|
inline |
Get native Comedi handler.
Definition at line 121 of file vpComedi.h.
|
inline |
Get max data per channel. The returned vector is of dimension the number of channels.
Definition at line 124 of file vpComedi.h.
|
inline |
vpColVector vpComedi::getPhyData | ( | ) | const |
Get physical data from device with units in Volts or mA. To know which unit is used, call getPhyDataUnits().
Definition at line 133 of file vpComedi.cpp.
References vpException::fatalError, getRawData(), vpMath::isNaN(), m_handler, m_maxdata, m_nchannel, and m_range_info.
Referenced by vpForceTorqueAtiSensor::bias(), vpForceTorqueAtiSensor::getForceTorque(), and vpForceTorqueAtiSensor::unbias().
std::string vpComedi::getPhyDataUnits | ( | ) | const |
Get units (V or mA) of the physical data acquired by getPhyData() or getPhyDataAsync().
Definition at line 155 of file vpComedi.cpp.
References vpException::fatalError, m_handler, and m_range_info.
|
inline |
Get data range information per channel. The returned vector is of dimension the number of channels.
Definition at line 133 of file vpComedi.h.
|
protected |
Get raw data from device. If you selected an analog input subdevice, the output is an unsigned number, for example between 0 and 65535 for a 16 bit analog input, with 0 representing the lowest voltage of the ADC, and a hardware-dependent maximum value representing the highest voltage.
Definition at line 105 of file vpComedi.cpp.
References vpException::fatalError, m_aref, m_device, m_handler, m_nchannel, m_range, and m_subdevice.
Referenced by getPhyData().
|
inline |
Get comedi subdevice.
Definition at line 135 of file vpComedi.h.
void vpComedi::open | ( | ) |
Open the connection to the device.
Definition at line 63 of file vpComedi.cpp.
References vpException::fatalError, m_aref, m_chanlist, m_device, m_handler, m_maxdata, m_nchannel, m_range, m_range_info, and m_subdevice.
Referenced by vpForceTorqueAtiSensor::open().
|
inline |
Set analog reference type.
aref | : The aref parameter specifies an analog reference to use: AREF_GROUND, AREF_COMMON, AREF_DIFF, or AREF_OTHER. |
Definition at line 144 of file vpComedi.h.
|
inline |
Number of channels to read from sensor. For a 6-dim force/torque sensor use 6.
Definition at line 150 of file vpComedi.h.
Referenced by vpForceTorqueAtiSensor::open().
|
inline |
Set comedi device name. Default value is /dev/comedi0.
Definition at line 153 of file vpComedi.h.
|
inline |
Set the range parameter that is the zero-based index of one of the gain ranges supported by the channel. This is a number from 0 to N-1 where N is the number of ranges supported by the channel.
Definition at line 160 of file vpComedi.h.
|
inline |
Set comedi analog input subdevice.
Definition at line 162 of file vpComedi.h.
|
protected |
|
protected |
|
protected |
Comedi device name (default: /dev/comedi0)
Definition at line 171 of file vpComedi.h.
Referenced by getRawData(), and open().
|
protected |
Comedi handler
Definition at line 172 of file vpComedi.h.
Referenced by close(), getPhyData(), getPhyDataUnits(), getRawData(), and open().
|
protected |
|
protected |
Number of channels
Definition at line 176 of file vpComedi.h.
Referenced by getPhyData(), getRawData(), and open().
|
protected |
Range of a channel
Definition at line 174 of file vpComedi.h.
Referenced by getRawData(), and open().
|
protected |
Range information
Definition at line 177 of file vpComedi.h.
Referenced by getPhyData(), getPhyDataUnits(), and open().
|
protected |