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