Visual Servoing Platform
version 3.6.1 under development (2024-11-15)
|
#include <visp3/sensor/vpForceTorqueAtiNetFTSensor.h>
Public Member Functions | |
vpForceTorqueAtiNetFTSensor () | |
vpForceTorqueAtiNetFTSensor (const std::string &hostname, int port) | |
virtual | ~vpForceTorqueAtiNetFTSensor () VP_OVERRIDE |
void | bias (unsigned int n_counts=50) |
unsigned long | getCountsPerForce () const |
unsigned long | getCountsPerTorque () const |
unsigned long | getDataCounter () const |
unsigned long | getScalingFactor () const |
vpColVector | getForceTorque () const |
void | setCountsPerForce (unsigned long counts) |
void | setCountsPerTorque (unsigned long counts) |
void | setScalingFactor (unsigned long scaling_factor) |
bool | startStreaming () |
void | stopStreaming () |
void | unbias () |
bool | waitForNewData (unsigned int timeout=50) |
Protected Attributes | |
unsigned long | m_counts_per_force |
unsigned long | m_counts_per_torque |
unsigned long | m_scaling_factor |
vpColVector | m_ft_bias |
unsigned long | m_data_count |
unsigned long | m_data_count_prev |
vpColVector | m_ft |
bool | m_is_streaming_started |
Inherited functionalities from vpUDPClient | |
bool | m_is_init |
void | init (const std::string &hostname, int port) |
int | receive (std::string &msg, int timeoutMs=0) |
int | receive (void *msg, size_t len, int timeoutMs=0) |
int | send (const std::string &msg) |
int | send (const void *msg, size_t len) |
Interface for ATI force/torque sensor using Net F/T over UDP.
The Network Force/Torque (Net F/T) sensor system measures six components of force and torque (Fx, Fy, Fz, Tx, Ty, Tz). The Net F/T provides an EtherNet/IP communication interface and is compatible with standard Ethernet. The Net F/T system is available with any of ATI transducer models. The Net F/T's web browser interface allows for easy configuration and set up via the Ethernet connection present on all NetBox models.
This class was tested with ATI Nano 43 F/T sensor connected to a NetBox. To use this class, you don't need to install any specific third-party.
To use this class, connect an Ethernet cable to the NetBox. The default IP address of the Net F/T is: 192.168.1.1. The default Ethernet port is 49152. You can use your favorite web browser on http://192.168.1.1 to modify Net F/T sensor settings and select sensor calibration configuration.
The following example shows how to use this class to get F/T measurements.
It produces the following output:
where 3 first values are forces Fx, Fy, Fz in N and the 3 last are torques Tx, Ty, Tz in Nm.
Definition at line 101 of file vpForceTorqueAtiNetFTSensor.h.
BEGIN_VISP_NAMESPACE vpForceTorqueAtiNetFTSensor::vpForceTorqueAtiNetFTSensor | ( | ) |
Default constructor that set counts per force to 1000000, counts per torque to 1000000000 and scaling factor to 1. Note that counts per force, counts per torque and scaling factor are used to transform force / torque in user units (N and Nm). These default values could be changed using setCountsPerForce(), setCountsPerTorque() and setScalingFactor().
Definition at line 65 of file vpForceTorqueAtiNetFTSensor.cpp.
vpForceTorqueAtiNetFTSensor::vpForceTorqueAtiNetFTSensor | ( | const std::string & | hostname, |
int | port | ||
) |
Constructor that initializes an Eternet UDP connection to a given hostname and port.
hostname | : Device hostname or IP address. |
port | : Ethernet port. |
Definition at line 75 of file vpForceTorqueAtiNetFTSensor.cpp.
|
virtual |
Destructor that stops Net F/T streaming and closes the Ethernet connection with the device.
Definition at line 155 of file vpForceTorqueAtiNetFTSensor.cpp.
References m_is_streaming_started, and stopStreaming().
void vpForceTorqueAtiNetFTSensor::bias | ( | unsigned int | n_counts = 50 | ) |
Bias F/T sensor. Bias value is a mean over a given number of counts.
n_counts | : Number of counts used to bias. |
Definition at line 169 of file vpForceTorqueAtiNetFTSensor.cpp.
References getForceTorque(), m_ft_bias, vpUDPClient::m_is_init, m_is_streaming_started, vpException::notInitialized, and waitForNewData().
|
inline |
Definition at line 113 of file vpForceTorqueAtiNetFTSensor.h.
|
inline |
Definition at line 118 of file vpForceTorqueAtiNetFTSensor.h.
|
inline |
Definition at line 122 of file vpForceTorqueAtiNetFTSensor.h.
vpColVector vpForceTorqueAtiNetFTSensor::getForceTorque | ( | ) | const |
Return force / torque measurements in user units, respectively N and Nm.
To obtain the force and torque values in user units (N and Nm), each received force value is internally multiplied by the scaling factor and divided by the counts per force and each received torque value is internally multiplied by the scaling factor and divided by the counts per torque.
Definition at line 211 of file vpForceTorqueAtiNetFTSensor.cpp.
References m_data_count, m_data_count_prev, m_ft, vpUDPClient::m_is_init, m_is_streaming_started, and vpException::notInitialized.
Referenced by bias().
|
inline |
Definition at line 127 of file vpForceTorqueAtiNetFTSensor.h.
|
inherited |
Initialize a (IPv4) UDP client.
hostname | : Server hostname or IP address. |
port | : Server port number. |
Definition at line 118 of file vpUDPClient.cpp.
References vpException::fatalError, and vpUDPClient::m_is_init.
Referenced by vpUDPClient::vpUDPClient().
|
inherited |
Receive data sent by the server.
msg | : ASCII message or byte data. |
timeoutMs | : Timeout in millisecond (if zero, the call is blocking). |
Definition at line 195 of file vpUDPClient.cpp.
References vpUDPClient::m_is_init, and vpException::notInitialized.
Referenced by waitForNewData().
|
inherited |
Receive data sent by the server.
msg | : A message to send over the network. |
len | : Message length. |
timeoutMs | : Timeout in millisecond (if zero, the call is blocking). |
Definition at line 241 of file vpUDPClient.cpp.
References vpUDPClient::m_is_init, and vpException::notInitialized.
|
inherited |
Send data to the server.
msg | : ASCII message or byte data. |
Definition at line 301 of file vpUDPClient.cpp.
References vpUDPClient::m_is_init, and vpException::notInitialized.
Referenced by startStreaming(), and stopStreaming().
|
inherited |
Send data to the server.
msg | : Message to send. |
len | : Message length. |
Definition at line 330 of file vpUDPClient.cpp.
References vpUDPClient::m_is_init, and vpException::notInitialized.
|
inline |
Set counts per force value. Default value is 1000000.
counts | : Counts per force. |
Definition at line 134 of file vpForceTorqueAtiNetFTSensor.h.
|
inline |
Set counts per torque value. Default value is 1000000000.
counts | : Counts per torque. |
Definition at line 140 of file vpForceTorqueAtiNetFTSensor.h.
|
inline |
Set scaling factor. Default value is 1.
scaling_factor | : scaling factor. |
Definition at line 146 of file vpForceTorqueAtiNetFTSensor.h.
bool vpForceTorqueAtiNetFTSensor::startStreaming | ( | ) |
Start high-speed real-time Net F/T streaming.
Definition at line 84 of file vpForceTorqueAtiNetFTSensor.cpp.
References vpUDPClient::m_is_init, m_is_streaming_started, vpException::notInitialized, vpUDPClient::send(), and waitForNewData().
void vpForceTorqueAtiNetFTSensor::stopStreaming | ( | ) |
Stop high-speed real-time Net F/T streaming.
Definition at line 123 of file vpForceTorqueAtiNetFTSensor.cpp.
References vpUDPClient::m_is_init, m_is_streaming_started, vpException::notInitialized, and vpUDPClient::send().
Referenced by ~vpForceTorqueAtiNetFTSensor().
void vpForceTorqueAtiNetFTSensor::unbias | ( | ) |
Unbias F/T sensor.
Definition at line 199 of file vpForceTorqueAtiNetFTSensor.cpp.
References m_ft_bias.
bool vpForceTorqueAtiNetFTSensor::waitForNewData | ( | unsigned int | timeout = 50 | ) |
Wait for new data.
timeout | : Timeout in ms. |
Definition at line 233 of file vpForceTorqueAtiNetFTSensor.cpp.
References m_counts_per_force, m_counts_per_torque, m_data_count, m_data_count_prev, m_ft, m_ft_bias, vpUDPClient::m_is_init, m_is_streaming_started, m_scaling_factor, vpTime::measureTimeMs(), vpException::notInitialized, vpUDPClient::receive(), and vpTime::sleepMs().
Referenced by bias(), and startStreaming().
|
protected |
Definition at line 154 of file vpForceTorqueAtiNetFTSensor.h.
Referenced by waitForNewData().
|
protected |
Definition at line 155 of file vpForceTorqueAtiNetFTSensor.h.
Referenced by waitForNewData().
|
protected |
Definition at line 158 of file vpForceTorqueAtiNetFTSensor.h.
Referenced by getForceTorque(), and waitForNewData().
|
protected |
Definition at line 159 of file vpForceTorqueAtiNetFTSensor.h.
Referenced by getForceTorque(), and waitForNewData().
|
protected |
Definition at line 160 of file vpForceTorqueAtiNetFTSensor.h.
Referenced by getForceTorque(), and waitForNewData().
|
protected |
Definition at line 157 of file vpForceTorqueAtiNetFTSensor.h.
Referenced by bias(), unbias(), and waitForNewData().
|
protectedinherited |
Definition at line 191 of file vpUDPClient.h.
Referenced by bias(), getForceTorque(), vpUDPClient::init(), vpUDPClient::receive(), vpUDPClient::send(), startStreaming(), stopStreaming(), and waitForNewData().
|
protected |
Definition at line 161 of file vpForceTorqueAtiNetFTSensor.h.
Referenced by bias(), getForceTorque(), startStreaming(), stopStreaming(), waitForNewData(), and ~vpForceTorqueAtiNetFTSensor().
|
protected |
Definition at line 156 of file vpForceTorqueAtiNetFTSensor.h.
Referenced by waitForNewData().