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.
__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() .
__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
Overloaded function.
Bias F/T sensor.
Note
See getCountsPerTorque() , getForceTorque()
Note
See getCountsPerForce() , getForceTorque()
- return:
Data counter. Each call to waitForNewData() will increment data counter when a new data is received.
Return force / torque measurements in user units, respectively N and Nm.
Note
See getCountsPerForce() , getCountsPerTorque() , getForceTorque()
Set counts per force value.
Set counts per torque value.
Set scaling factor.
- return:
True if streaming was started, false otherwise.
Stop high-speed real-time Net F/T streaming.
Unbias F/T sensor.
- param timeout:
Timeout in ms.
Inherited Methods
Receive data sent by the server.
Initialize a (IPv4) UDP client.
Send data to the server.
Operators
__doc__
Overloaded function.
__module__
Attributes
__annotations__
- __init__(*args, **kwargs)¶
Overloaded function.
__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() .
__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()
- 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).
- 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());
- 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);
- setCountsPerForce(self, counts: int) None ¶
Set counts per force value. Default value is 1000000.
Note
See setCountsPerTorque() , setScalingFactor()
- setCountsPerTorque(self, counts: int) None ¶
Set counts per torque value. Default value is 1000000000.
Note
See setCountsPerForce() , setScalingFactor()
- setScalingFactor(self, scaling_factor: int) None ¶
Set scaling factor. Default value is 1.
Note
See setCountsPerForce() , setCountsPerTorque()