openrave-yarp-plugins
OpenraveYarpPluginLoaderClient.hpp
1 // -*- mode:C++; tab-width:4; c-basic-offset:4; indent-tabs-mode:nil -*-
2 
3 #ifndef __OPENRAVE_YARP_PLUGIN_LOADER_CLIENT__
4 #define __OPENRAVE_YARP_PLUGIN_LOADER_CLIENT__
5 
6 #include <mutex>
7 #include <vector>
8 
9 #include <yarp/os/BufferedPort.h>
10 #include <yarp/os/ResourceFinder.h>
11 #include <yarp/os/RFModule.h>
12 #include <yarp/os/RpcClient.h>
13 
14 namespace roboticslab
15 {
16 
20 class OyplCallbackPort : public yarp::os::BufferedPort<yarp::os::Bottle>
21 {
22 public:
24  std::vector<int> availableIds;
25  std::mutex availableIdsMutex;
26  double lastTime;
27 private:
28  void onRead(yarp::os::Bottle& b) override;
29 };
30 
34 class OpenraveYarpPluginLoaderClient : public yarp::os::RFModule
35 {
36 public:
38  bool configure(yarp::os::ResourceFinder &rf) override;
39 
40 private:
41  yarp::os::RpcClient rpcClient;
42  OyplCallbackPort callbackPort;
43  std::vector<int> openedIds;
44 
45  bool openedInAvailable();
46  bool detectedFirst;
47 
48  double getPeriod() override;
49  bool updateModule() override;
50  bool close() override;
51 };
52 
53 } // namespace roboticslab
54 
55 #endif // __OPENRAVE_YARP_PLUGIN_LOADER_CLIENT__
Definition: OpenraveYarpPluginLoaderClient.hpp:35
Definition: OpenraveYarpPluginLoaderClient.hpp:21
The main, catch-all namespace for Robotics Lab UC3M.
Definition: groups.dox:5