openrave-yarp-plugins
OpenraveYarpPluginLoader.hpp
1 // -*- mode:C++; tab-width:4; c-basic-offset:4; indent-tabs-mode:nil -*-
2 
3 #ifndef __OPENRAVE_YARP_PLUGIN_LOADER_HPP__
4 #define __OPENRAVE_YARP_PLUGIN_LOADER_HPP__
5 
6 #include <yarp/os/Network.h>
7 #include <yarp/os/RpcServer.h>
8 
9 #include <yarp/dev/PolyDriver.h>
10 
11 #include <openrave/openrave.h>
12 #include <openrave/plugin.h>
13 
14 #include "OyplPortReader.hpp"
15 #include "OyplPeriodicWrite.hpp"
16 
17 namespace roboticslab
18 {
19 
30 class OpenraveYarpPluginLoader : public OpenRAVE::ModuleBase
31 {
32 public:
33  OpenraveYarpPluginLoader(OpenRAVE::EnvironmentBasePtr penv);
34  ~OpenraveYarpPluginLoader() override;
35  virtual void Destroy() override;
36 
37  bool addYarpPluginsLists(yarp::os::Bottle & info);
38  int main(const std::string& cmd) override;
39 
40  bool Open(std::ostream& sout, std::istream & sinput);
41  bool GetPenv(std::ostream & sout, std::istream & sinput);
42  bool close(const int i);
43 
44 private:
45  yarp::os::Network yarp;
46  std::vector<yarp::dev::PolyDriver *> yarpPlugins;
47  std::vector<yarp::os::Property> yarpPluginsProperties;
48 
49  OyplPortReader oyplPortReader;
50  yarp::os::RpcServer oyplRpcServer;
51 
52  OyplPeriodicWrite oyplPeriodicWrite;
53 };
54 
59 class OpenraveYarpPluginLoaderPlugin : public RavePlugin
60 {
61 public:
62  OpenRAVE::InterfaceBasePtr CreateInterface(OpenRAVE::InterfaceType type,
63  const std::string & interfacename,
64  std::istream & sinput,
65  OpenRAVE::EnvironmentBasePtr penv) override;
66 
67  const InterfaceMap & GetInterfaces() const override;
68  const std::string & GetPluginName() const override;
69 };
70 
71 } // namespace roboticslab
72 
73 #endif // __OPENRAVE_YARP_PLUGIN_LOADER_HPP__
OpenraveYarpPluginLoader plugin.
Definition: OpenraveYarpPluginLoader.hpp:60
Loads one or several YARP Plugin, passing environment pointer.
Definition: OpenraveYarpPluginLoader.hpp:31
Publishes open YARP plugin list.
Definition: OyplPeriodicWrite.hpp:19
Processes RPC requests for OpenraveYarpPluginLoader.
Definition: OyplPortReader.hpp:18
The main, catch-all namespace for Robotics Lab UC3M.
Definition: groups.dox:5