ForceTorqueAtiNetFTSensor

class ForceTorqueAtiNetFTSensor(*args, **kwargs)

Bases: UDPClient

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.

#include <iostream>

#include <visp3/sensor/vpForceTorqueAtiNetFTSensor.h>

int main(int argc, char **argv)
{
  vpForceTorqueAtiNetFTSensor ati_net_ft("192.168.1.1", 49152);

  ati_net_ft.startStreaming();
  ati_net_ft.bias();

  while (1) {
    double t = vpTime::measureTimeMs();
    if (ati_net_ft.waitForNewData()) {
      vpColVector ft = ati_net_ft.getForceTorque();
      std::cout << "F/T: " << ft.t() << std::endl;
    }
    std::cout << "Loop time: " << vpTime::measureTimeMs() - t << " ms" << std::endl;
  }
}

It produces the following output:

F/T: -0.00150018  0.0030764  -0.00791356  -8.22294e-06  4.18799e-05  1.078288e-05
Loop time: 0.03393554688 ms
...

where 3 first values are forces Fx, Fy, Fz in N and the 3 last are torques Tx, Ty, Tz in Nm.

Overloaded function.

  1. __init__(self: visp._visp.sensor.ForceTorqueAtiNetFTSensor) -> None

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() .

  1. __init__(self: visp._visp.sensor.ForceTorqueAtiNetFTSensor, hostname: str, port: int) -> None

Constructor that initializes an Eternet UDP connection to a given hostname and port.

Parameters:
hostname

Device hostname or IP address.

port

Ethernet port.

Methods

__init__

Overloaded function.

bias

Bias F/T sensor.

getCountsPerForce

Note

See getCountsPerTorque() , getForceTorque()

getCountsPerTorque

Note

See getCountsPerForce() , getForceTorque()

getDataCounter

return:

Data counter. Each call to waitForNewData() will increment data counter when a new data is received.

getForceTorque

Return force / torque measurements in user units, respectively N and Nm.

getScalingFactor

Note

See getCountsPerForce() , getCountsPerTorque() , getForceTorque()

setCountsPerForce

Set counts per force value.

setCountsPerTorque

Set counts per torque value.

setScalingFactor

Set scaling factor.

startStreaming

return:

True if streaming was started, false otherwise.

stopStreaming

Stop high-speed real-time Net F/T streaming.

unbias

Unbias F/T sensor.

waitForNewData

param timeout:

Timeout in ms.

Inherited Methods

receive

Receive data sent by the server.

init

Initialize a (IPv4) UDP client.

send

Send data to the server.

Operators

__doc__

__init__

Overloaded function.

__module__

Attributes

__annotations__

__init__(*args, **kwargs)

Overloaded function.

  1. __init__(self: visp._visp.sensor.ForceTorqueAtiNetFTSensor) -> None

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() .

  1. __init__(self: visp._visp.sensor.ForceTorqueAtiNetFTSensor, hostname: str, port: int) -> None

Constructor that initializes an Eternet UDP connection to a given hostname and port.

Parameters:
hostname

Device hostname or IP address.

port

Ethernet port.

bias(self, n_counts: int = 50) None

Bias F/T sensor. Bias value is a mean over a given number of counts.

Warning

This function is blocking. Between 2 successive counts we wait for 5 ms.

Note

See unbias()

Parameters:
n_counts: int = 50

Number of counts used to bias.

getCountsPerForce(self) int

Note

See getCountsPerTorque() , getForceTorque()

Returns:

Counts per force used to tranform measured data in N.

getCountsPerTorque(self) int

Note

See getCountsPerForce() , getForceTorque()

Returns:

Counts per torque used to tranform measured data in Nm.

getDataCounter(self) int
Returns:

Data counter. Each call to waitForNewData() will increment data counter when a new data is received.

getForceTorque(self) visp._visp.core.ColVector

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.

Returns:

A 6-dim vector that contains the 3 forces and 3 torques [Fx, Fy, Fz, Tx, Ty, Tz] with forces in N and torques in Nm.

getScalingFactor(self) int

Note

See getCountsPerForce() , getCountsPerTorque() , getForceTorque()

Returns:

Scaling factor to transform measured data in user units (N and Nm).

init(self, hostname: str, port: int) None

Initialize a (IPv4) UDP client.

Parameters:
hostname: str

Server hostname or IP address.

port: int

Server port number.

receive(self, timeoutMs: int = 0) tuple[int, str]

Receive data sent by the server.

Note

To transform the ASCII representation of an integer:

int val = atoi(msg.c_str());
//or
std::istringstream ss(msg);
ss >> val;

To convert from a byte array to an integer:

int val = *reinterpret_cast<const int *>(msg.c_str());
Parameters:
timeoutMs: int = 0

Timeout in millisecond (if zero, the call is blocking).

Returns:

A tuple containing:

  • The message length / size of the byte array sent received, or -1 if there is an error, or 0 if there is a timeout.

  • msg: ASCII message or byte data.

send(self, msg: str) int

Send data to the server.

Note

To send the ASCII representation of an integer:

int val = 1024;
std::ostringstream os;
os << val;
server.send(os.str(), hostname, port);

To send directly the byte data (assuming the same integer representation on the server and the client):

int val = 1024;
char data[sizeof(val)];
memcpy(data, &val, sizeof(val));
std::string msg(data, sizeof(val)); //required to avoid the string being splitted with the first \0 character
server.send(msg, hostname, port);
Parameters:
msg: str

ASCII message or byte data.

Returns:

The message length / size of the byte array sent.

setCountsPerForce(self, counts: int) None

Set counts per force value. Default value is 1000000.

Note

See setCountsPerTorque() , setScalingFactor()

Parameters:
counts: int

Counts per force.

setCountsPerTorque(self, counts: int) None

Set counts per torque value. Default value is 1000000000.

Note

See setCountsPerForce() , setScalingFactor()

Parameters:
counts: int

Counts per torque.

setScalingFactor(self, scaling_factor: int) None

Set scaling factor. Default value is 1.

Note

See setCountsPerForce() , setCountsPerTorque()

Parameters:
scaling_factor: int

scaling factor.

startStreaming(self) bool
Returns:

True if streaming was started, false otherwise.

stopStreaming(self) None

Stop high-speed real-time Net F/T streaming.

unbias(self) None

Unbias F/T sensor.

Note

See bias()

waitForNewData(self, timeout: int = 50) bool
Parameters:
timeout: int = 50

Timeout in ms.

Returns:

True if a new data was received, false otherwise.