Visual Servoing Platform  version 3.6.0 under development (2023-10-01)
vpForceTorqueAtiNetFTSensor.h
1 /****************************************************************************
2  *
3  * ViSP, open source Visual Servoing Platform software.
4  * Copyright (C) 2005 - 2023 by Inria. All rights reserved.
5  *
6  * This software is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  * See the file LICENSE.txt at the root directory of this source
11  * distribution for additional information about the GNU GPL.
12  *
13  * For using ViSP with software that can not be combined with the GNU
14  * GPL, please contact Inria about acquiring a ViSP Professional
15  * Edition License.
16  *
17  * See https://visp.inria.fr for more information.
18  *
19  * This software was developed at:
20  * Inria Rennes - Bretagne Atlantique
21  * Campus Universitaire de Beaulieu
22  * 35042 Rennes Cedex
23  * France
24  *
25  * If you have questions regarding the use of this file, please contact
26  * Inria at visp@inria.fr
27  *
28  * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
29  * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
30  *
31  * Description:
32  * ATI Force torque interface.
33  *
34 *****************************************************************************/
35 #ifndef _vpForceTorqueAtiNetFTSensor_h_
36 #define _vpForceTorqueAtiNetFTSensor_h_
37 
38 #include <visp3/core/vpConfig.h>
39 
40 #include <ostream>
41 
42 #include <visp3/core/vpColVector.h>
43 #include <visp3/core/vpUDPClient.h>
44 
45 // Make vpForceTorqueAtiNetFTSensor available only if inet_ntop() used to
46 // communicate by UDP with the sensor through vpUDPClient is available; inet_ntop()
47 // is not supported on win XP
48 #ifdef VISP_HAVE_FUNC_INET_NTOP
49 
103 class VISP_EXPORT vpForceTorqueAtiNetFTSensor : public vpUDPClient
104 {
105 public:
107  vpForceTorqueAtiNetFTSensor(const std::string &hostname, int port);
108  virtual ~vpForceTorqueAtiNetFTSensor();
109 
110  void bias(unsigned int n_counts = 50);
115  inline unsigned long getCountsPerForce() const { return m_counts_per_force; }
120  inline unsigned long getCountsPerTorque() const { return m_counts_per_torque; }
124  inline unsigned long getDataCounter() const { return m_data_count; }
129  inline unsigned long getScalingFactor() const { return m_scaling_factor; }
130  vpColVector getForceTorque() const;
136  inline void setCountsPerForce(unsigned long counts) { m_counts_per_force = counts; }
142  inline void setCountsPerTorque(unsigned long counts) { m_counts_per_torque = counts; }
148  inline void setScalingFactor(unsigned long scaling_factor) { m_scaling_factor = scaling_factor; }
149  bool startStreaming();
150  void stopStreaming();
151 
152  void unbias();
153  bool waitForNewData(unsigned int timeout = 50);
154 
155 protected:
156  unsigned long m_counts_per_force;
157  unsigned long m_counts_per_torque;
158  unsigned long m_scaling_factor;
160  unsigned long m_data_count;
161  unsigned long m_data_count_prev;
164 };
165 
166 #endif
167 #endif
Implementation of column vector and the associated operations.
Definition: vpColVector.h:167
void setCountsPerTorque(unsigned long counts)
void setCountsPerForce(unsigned long counts)
void setScalingFactor(unsigned long scaling_factor)
This class implements a basic (IPv4) User Datagram Protocol (UDP) client.
Definition: vpUDPClient.h:167