Visual Servoing Platform  version 3.6.1 under development (2024-04-23)
vpForceTorqueAtiSensor Class Reference

#include <visp3/sensor/vpForceTorqueAtiSensor.h>

+ Inheritance diagram for vpForceTorqueAtiSensor:

Public Member Functions

 vpForceTorqueAtiSensor ()
 
virtual ~vpForceTorqueAtiSensor () vp_override
 
void bias ()
 
void close ()
 
std::string getCalibrationFile () const
 
vpColVector getForceTorque () const
 
std::string getForceUnits () const
 
std::string getTorqueUnits () const
 
void open ()
 
void setCalibrationFile (const std::string &calibfile, unsigned short index=1)
 
void unbias ()
 

Protected Attributes

std::string m_calibfile
 
unsigned short m_index
 
unsigned short m_num_axes
 
unsigned short m_num_channels
 
vpColVector m_sample_bias
 
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
 

Friends

VISP_EXPORT std::ostream & operator<< (std::ostream &os, const vpForceTorqueAtiSensor &ati)
 

Related Functions

(Note that these are not member functions.)

std::ostream & operator<< (std::ostream &os, const vpForceTorqueAtiSensor &ati)
 

Inherited functionalities from vpComedi

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 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
 

Detailed Description

Interface for ATI force/torque sensor. This class works only under linux-like OS. It requires Comedi 3rd party. Installation instructions are provided here https://visp.inria.fr/3rd_comedi.

Comedi is the 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.

Synchronous F/T data acquisition is performed using getForceTorque(). The call to the function blocks until the whole acquisition has finished.

The following example shows how to get single measures from an ATI F/T device each 10 ms (100 Hz).

#include <visp3/core/vpTime.h>
#include <visp3/sensor/vpForceTorqueAtiSensor.h>
int main(int argc, char** argv)
{
ati.setCalibrationFile("FT12345.cal");
ati.open();
ati.bias();
for(unsigned int i=0; i < 20; i++) {
std::cout << "F/T: " << ati.getForceTorque().t() << std::endl;
}
ati.close();
#endif
}
vpRowVector t() const
vpColVector getForceTorque() const
void setCalibrationFile(const std::string &calibfile, unsigned short index=1)
VISP_EXPORT int wait(double t0, double t)
Examples
testForceTorqueAti.cpp.

Definition at line 84 of file vpForceTorqueAtiSensor.h.

Constructor & Destructor Documentation

◆ vpForceTorqueAtiSensor()

vpForceTorqueAtiSensor::vpForceTorqueAtiSensor ( )

Default constructor.

Definition at line 50 of file vpForceTorqueAtiSensor.cpp.

◆ ~vpForceTorqueAtiSensor()

vpForceTorqueAtiSensor::~vpForceTorqueAtiSensor ( )
virtual

Destructor that closes the connection to the device.

Definition at line 187 of file vpForceTorqueAtiSensor.cpp.

References close().

Member Function Documentation

◆ bias()

void vpForceTorqueAtiSensor::bias ( )

Bias the sensor storing an unloaded measurement; this removes the effect of tooling weight.

See also
unbias()
Examples
testForceTorqueAti.cpp.

Definition at line 70 of file vpForceTorqueAtiSensor.cpp.

References vpException::fatalError, vpComedi::getPhyData(), m_num_channels, m_sample_bias, open(), and vpArray2D< Type >::size().

Referenced by vpRobotViper850::biasForceTorqueSensor().

◆ close()

void vpForceTorqueAtiSensor::close ( )

Close the calibration structure opened using setCalibrationFile() and close the connection to the device.

Examples
testForceTorqueAti.cpp.

Definition at line 121 of file vpForceTorqueAtiSensor.cpp.

References vpComedi::close().

Referenced by ~vpForceTorqueAtiSensor(), and vpRobotViper850::~vpRobotViper850().

◆ getCalibrationFile()

std::string vpForceTorqueAtiSensor::getCalibrationFile ( ) const
inline

Return the calibration file location specified using setCalibrationFile().

See also
setCalibrationFile()

Definition at line 97 of file vpForceTorqueAtiSensor.h.

◆ getForceTorque()

vpColVector vpForceTorqueAtiSensor::getForceTorque ( ) const

Get a 6-dimension force/torque vector from device. This function performs synchronously one single data acquisition. "Synchronous" means that the calling process blocks until the data acquisition has finished.

Returns
A sampled measure from device with forces and torques. Forces units are given by getForceUnits(), while torque units by getTorqueUnits().
Examples
testForceTorqueAti.cpp.

Definition at line 139 of file vpForceTorqueAtiSensor.cpp.

References vpException::fatalError, vpComedi::getPhyData(), m_num_axes, m_num_channels, and vpArray2D< Type >::size().

Referenced by vpRobotViper850::getForceTorque().

◆ getForceUnits()

std::string vpForceTorqueAtiSensor::getForceUnits ( ) const

Get force units.

Definition at line 170 of file vpForceTorqueAtiSensor.cpp.

◆ getHandler()

comedi_t* vpComedi::getHandler ( ) const
inlineinherited

Get native Comedi handler.

Definition at line 116 of file vpComedi.h.

◆ getMaxData()

std::vector<lsampl_t> vpComedi::getMaxData ( ) const
inlineinherited

Get max data per channel. The returned vector is of dimension the number of channels.

Definition at line 119 of file vpComedi.h.

◆ getNChannel()

unsigned int vpComedi::getNChannel ( ) const
inlineinherited

Get number of channels.

Examples
testComedi.cpp.

Definition at line 121 of file vpComedi.h.

◆ getPhyData()

vpColVector vpComedi::getPhyData ( ) const
inherited

Get physical data from device with units in Volts or mA. To know which unit is used, call getPhyDataUnits().

Examples
testComedi.cpp.

Definition at line 132 of file vpComedi.cpp.

References vpException::fatalError, vpComedi::getRawData(), vpMath::isNaN(), vpComedi::m_handler, vpComedi::m_maxdata, vpComedi::m_nchannel, and vpComedi::m_range_info.

Referenced by bias(), getForceTorque(), and unbias().

◆ getPhyDataUnits()

std::string vpComedi::getPhyDataUnits ( ) const
inherited

Get units (V or mA) of the physical data acquired by getPhyData() or getPhyDataAsync().

Examples
testComedi.cpp.

Definition at line 154 of file vpComedi.cpp.

References vpException::fatalError, vpComedi::m_handler, and vpComedi::m_range_info.

◆ getRangeInfo()

std::vector<comedi_range *> vpComedi::getRangeInfo ( ) const
inlineinherited

Get data range information per channel. The returned vector is of dimension the number of channels.

Definition at line 128 of file vpComedi.h.

◆ getRawData()

std::vector< lsampl_t > vpComedi::getRawData ( ) const
protectedinherited

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 104 of file vpComedi.cpp.

References vpException::fatalError, vpComedi::m_aref, vpComedi::m_device, vpComedi::m_handler, vpComedi::m_nchannel, vpComedi::m_range, and vpComedi::m_subdevice.

Referenced by vpComedi::getPhyData().

◆ getSubDevice()

unsigned int vpComedi::getSubDevice ( ) const
inlineinherited

Get comedi subdevice.

Definition at line 130 of file vpComedi.h.

◆ getTorqueUnits()

std::string vpForceTorqueAtiSensor::getTorqueUnits ( ) const

Get torque units.

Definition at line 178 of file vpForceTorqueAtiSensor.cpp.

◆ open()

void vpForceTorqueAtiSensor::open ( )

Open the connection to the device.

See also
close()
Examples
testForceTorqueAti.cpp.

Definition at line 59 of file vpForceTorqueAtiSensor.cpp.

References m_num_channels, vpComedi::open(), and vpComedi::setChannelNumbers().

Referenced by bias(), vpRobotViper850::init(), and unbias().

◆ setAnalogReference()

void vpComedi::setAnalogReference ( const unsigned int &  aref)
inlineinherited

Set analog reference type.

Parameters
aref: The aref parameter specifies an analog reference to use: AREF_GROUND, AREF_COMMON, AREF_DIFF, or AREF_OTHER.

Definition at line 139 of file vpComedi.h.

◆ setCalibrationFile()

void vpForceTorqueAtiSensor::setCalibrationFile ( const std::string &  calibfile,
unsigned short  index = 1 
)

Open ATI calibration file that should correspond to your F/T sensor.

Parameters
calibfile: ATI calibration file. This file has the following pattern: FT*.cal.
index: Index of calibration in file (default =1).
See also
getCalibrationFile(), close()
Examples
testForceTorqueAti.cpp.

Definition at line 195 of file vpForceTorqueAtiSensor.cpp.

References vpException::fatalError, m_calibfile, m_index, m_num_axes, and m_num_channels.

Referenced by vpRobotViper850::init().

◆ setChannelNumbers()

void vpComedi::setChannelNumbers ( const unsigned int &  nchannel)
inlineinherited

Number of channels to read from sensor. For a 6-dim force/torque sensor use 6.

Examples
testComedi.cpp.

Definition at line 145 of file vpComedi.h.

Referenced by open().

◆ setDevice()

void vpComedi::setDevice ( const std::string &  device)
inlineinherited

Set comedi device name. Default value is /dev/comedi0.

Examples
testComedi.cpp.

Definition at line 148 of file vpComedi.h.

◆ setRange()

void vpComedi::setRange ( const unsigned int &  range)
inlineinherited

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 155 of file vpComedi.h.

◆ setSubDevice()

void vpComedi::setSubDevice ( const unsigned int &  subdevice)
inlineinherited

Set comedi analog input subdevice.

Definition at line 157 of file vpComedi.h.

◆ unbias()

void vpForceTorqueAtiSensor::unbias ( )

Friends And Related Function Documentation

◆ operator<< [1/2]

std::ostream & operator<< ( std::ostream &  os,
const vpForceTorqueAtiSensor ati 
)
friend

Return information from calibration file.

Parameters
os: Input stream.
ati: ATI F/T sensor interface.

The following example shows how to use this method.

#include <visp3/sensor/vpForceTorqueAtiSensor.h>
int main()
{
ati.setCalibrationFile("FT12345.cal");
std::cout << "ATI F/T sensor characteristics: \n" << ati << std::endl;
}

Definition at line 232 of file vpForceTorqueAtiSensor.cpp.

◆ operator<<() [2/2]

std::ostream & operator<< ( std::ostream &  os,
const vpForceTorqueAtiSensor ati 
)
related

Return information from calibration file.

Parameters
os: Input stream.
ati: ATI F/T sensor interface.

The following example shows how to use this method.

#include <visp3/sensor/vpForceTorqueAtiSensor.h>
int main()
{
ati.setCalibrationFile("FT12345.cal");
std::cout << "ATI F/T sensor characteristics: \n" << ati << std::endl;
}

Definition at line 232 of file vpForceTorqueAtiSensor.cpp.

Member Data Documentation

◆ m_aref

unsigned int vpComedi::m_aref
protectedinherited

Analog reference

Definition at line 170 of file vpComedi.h.

Referenced by vpComedi::getRawData(), and vpComedi::open().

◆ m_calibfile

std::string vpForceTorqueAtiSensor::m_calibfile
protected

ATI calibration file FT*.cal.

Definition at line 110 of file vpForceTorqueAtiSensor.h.

Referenced by setCalibrationFile().

◆ m_chanlist

std::vector<unsigned int> vpComedi::m_chanlist
protectedinherited

Channel list

Definition at line 174 of file vpComedi.h.

Referenced by vpComedi::open().

◆ m_device

std::string vpComedi::m_device
protectedinherited

Comedi device name (default: /dev/comedi0)

Definition at line 166 of file vpComedi.h.

Referenced by vpComedi::getRawData(), and vpComedi::open().

◆ m_handler

comedi_t* vpComedi::m_handler
protectedinherited

◆ m_index

unsigned short vpForceTorqueAtiSensor::m_index
protected

Index of calibration in file (default: 1)

Definition at line 111 of file vpForceTorqueAtiSensor.h.

Referenced by setCalibrationFile().

◆ m_maxdata

std::vector<lsampl_t> vpComedi::m_maxdata
protectedinherited

Max data value

Definition at line 173 of file vpComedi.h.

Referenced by vpComedi::getPhyData(), and vpComedi::open().

◆ m_nchannel

unsigned int vpComedi::m_nchannel
protectedinherited

Number of channels

Definition at line 171 of file vpComedi.h.

Referenced by vpComedi::getPhyData(), vpComedi::getRawData(), and vpComedi::open().

◆ m_num_axes

unsigned short vpForceTorqueAtiSensor::m_num_axes
protected

Number of axis or gages available from the sensor.

Definition at line 112 of file vpForceTorqueAtiSensor.h.

Referenced by getForceTorque(), and setCalibrationFile().

◆ m_num_channels

unsigned short vpForceTorqueAtiSensor::m_num_channels
protected

Number of channels available from the sensor.

Definition at line 113 of file vpForceTorqueAtiSensor.h.

Referenced by bias(), getForceTorque(), open(), setCalibrationFile(), and unbias().

◆ m_range

unsigned int vpComedi::m_range
protectedinherited

Range of a channel

Definition at line 169 of file vpComedi.h.

Referenced by vpComedi::getRawData(), and vpComedi::open().

◆ m_range_info

std::vector<comedi_range *> vpComedi::m_range_info
protectedinherited

Range information

Definition at line 172 of file vpComedi.h.

Referenced by vpComedi::getPhyData(), vpComedi::getPhyDataUnits(), and vpComedi::open().

◆ m_sample_bias

vpColVector vpForceTorqueAtiSensor::m_sample_bias
protected

Sample value used for bias.

Definition at line 114 of file vpForceTorqueAtiSensor.h.

Referenced by bias(), and unbias().

◆ m_subdevice

unsigned int vpComedi::m_subdevice
protectedinherited

Input subdevice

Definition at line 168 of file vpComedi.h.

Referenced by vpComedi::getRawData(), and vpComedi::open().