Visual Servoing Platform  version 3.6.1 under development (2024-11-15)
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 
48 BEGIN_VISP_NAMESPACE
101 class VISP_EXPORT vpForceTorqueAtiNetFTSensor : public vpUDPClient
102 {
103 public:
105  vpForceTorqueAtiNetFTSensor(const std::string &hostname, int port);
106  virtual ~vpForceTorqueAtiNetFTSensor() VP_OVERRIDE;
107 
108  void bias(unsigned int n_counts = 50);
113  inline unsigned long getCountsPerForce() const { return m_counts_per_force; }
118  inline unsigned long getCountsPerTorque() const { return m_counts_per_torque; }
122  inline unsigned long getDataCounter() const { return m_data_count; }
127  inline unsigned long getScalingFactor() const { return m_scaling_factor; }
128  vpColVector getForceTorque() const;
134  inline void setCountsPerForce(unsigned long counts) { m_counts_per_force = counts; }
140  inline void setCountsPerTorque(unsigned long counts) { m_counts_per_torque = counts; }
146  inline void setScalingFactor(unsigned long scaling_factor) { m_scaling_factor = scaling_factor; }
147  bool startStreaming();
148  void stopStreaming();
149 
150  void unbias();
151  bool waitForNewData(unsigned int timeout = 50);
152 
153 protected:
154  unsigned long m_counts_per_force;
155  unsigned long m_counts_per_torque;
156  unsigned long m_scaling_factor;
158  unsigned long m_data_count;
159  unsigned long m_data_count_prev;
162 };
163 END_VISP_NAMESPACE
164 #endif
165 #endif
Implementation of column vector and the associated operations.
Definition: vpColVector.h:191
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:174