sot-talos-balance  2.0.5
Collection of dynamic-graph entities aimed at implementing balance control on talos.
qualisys-client.hh
Go to the documentation of this file.
1 /*
2  * Copyright 2018, Gepetto team, LAAS-CNRS
3  *
4  * This file is part of sot-talos-balance.
5  * sot-talos-balance is free software: you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public License
7  * as published by the Free Software Foundation, either version 3 of
8  * the License, or (at your option) any later version.
9  * sot-talos-balance is distributed in the hope that it will be
10  * useful, but WITHOUT ANY WARRANTY; without even the implied warranty
11  * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU Lesser General Public License for more details. You should
13  * have received a copy of the GNU Lesser General Public License along
14  * with sot-talos-balance. If not, see <http://www.gnu.org/licenses/>.
15  */
16 
17 #ifndef __sot_talos_balance_qualisys_client_H__
18 #define __sot_talos_balance_qualisys_client_H__
19 
20 /* --------------------------------------------------------------------- */
21 /* --- API ------------------------------------------------------------- */
22 /* --------------------------------------------------------------------- */
23 
24 #if defined(WIN32)
25 #if defined(position_controller_EXPORTS)
26 #define QUALISYS_CLIENT_EXPORT __declspec(dllexport)
27 #else
28 #define QUALISYS_CLIENT_EXPORT __declspec(dllimport)
29 #endif
30 #else
31 #define QUALISYS_CLIENT_EXPORT
32 #endif
33 
34 /* --------------------------------------------------------------------- */
35 /* --- INCLUDE --------------------------------------------------------- */
36 /* --------------------------------------------------------------------- */
37 #include <pinocchio/fwd.hpp>
38 
39 // include pinocchio first
40 
41 #include <dynamic-graph/signal-helper.h>
42 
43 #include <boost/chrono.hpp>
44 #include <boost/thread.hpp>
45 #include <map>
46 #include <sot/core/robot-utils.hh>
47 
48 #include "boost/assign.hpp"
53 
54 namespace dynamicgraph {
55 namespace sot {
56 namespace dg = dynamicgraph;
57 namespace talos_balance {
58 
59 /* --------------------------------------------------------------------- */
60 /* --- CLASS ----------------------------------------------------------- */
61 /* --------------------------------------------------------------------- */
62 
63 class QUALISYS_CLIENT_EXPORT QualisysClient : public ::dynamicgraph::Entity {
64  DYNAMIC_GRAPH_ENTITY_DECL();
65 
66  public:
67  EIGEN_MAKE_ALIGNED_OPERATOR_NEW
68 
69  /* --- CONSTRUCTOR ---- */
70  QualisysClient(const std::string& name);
71 
72  void init();
73 
74  /* --- SIGNALS --- */
75  DECLARE_SIGNAL_IN(dummy, double);
76 
77  /* --- COMMANDS --- */
78  void registerRigidBody(const std::string& RBname);
79  void setMocapIPAdress(const std::string& ipAdress);
80  void getRigidBodyList();
81 
83  /* --- ENTITY INHERITANCE --- */
84  virtual void display(std::ostream& os) const;
85 
86  protected:
87  bool m_initSucceeded; // true if the entity has been successfully initialized
88  bool m_printRigidBodyList = false;
89  std::vector<std::string>
90  m_RBnames; // vector of names of registered rigid bodies
91  std::vector<dg::Vector> m_RBpositions; // vector of rigid bodies positions
92  void manageNetworkFrame();
93  boost::thread m_thread{&QualisysClient::manageNetworkFrame, this};
94  boost::mutex m_mutex;
95  std::string m_serverAddr = "127.0.0.1";
96  dg::Vector& readGenericRigidBody(const int RBidx, dg::Vector& res,
97  const int& time);
98 }; // class QualisysClient
99 
100 } // namespace talos_balance
101 } // namespace sot
102 } // namespace dynamicgraph
103 
104 #endif // #ifndef __sot_talos_balance_qualisys_client_H__
Network.h
sot_talos_balance.test.appli_admittance_end_effector.sot
sot
Definition: appli_admittance_end_effector.py:117
dynamicgraph::sot::talos_balance::QualisysClient::m_mutex
boost::mutex m_mutex
Definition: qualisys-client.hh:94
QUALISYS_CLIENT_EXPORT
#define QUALISYS_CLIENT_EXPORT
Definition: qualisys-client.hh:31
dynamicgraph::sot::talos_balance::QualisysClient::m_RBnames
std::vector< std::string > m_RBnames
Definition: qualisys-client.hh:90
dynamicgraph
Definition: treeview.dox:24
dynamicgraph::sot::talos_balance::QualisysClient::m_initSucceeded
bool m_initSucceeded
Definition: qualisys-client.hh:87
RTPacket.h
RTProtocol.h
dynamicgraph::sot::talos_balance::QualisysClient::manageNetworkFrame
void manageNetworkFrame()
Definition: qualisys-client.cpp:123
Markup.h
dynamicgraph::sot::talos_balance::QualisysClient
Definition: qualisys-client.hh:63
dynamicgraph::sot::talos_balance::QualisysClient::m_RBpositions
std::vector< dg::Vector > m_RBpositions
Definition: qualisys-client.hh:91
dynamicgraph::sot::talos_balance::math::Vector
Eigen::Matrix< Scalar, Eigen::Dynamic, 1 > Vector
Definition: fwd.hh:36
sot_talos_balance.test.appli_dcm_zmp_control.name
name
Definition: appli_dcm_zmp_control.py:298