icub-client
homeostasisManagerIcub.h
Go to the documentation of this file.
1 #ifndef HOMEO_MANAGER_ICUB
2 #define HOMEO_MANAGER_ICUB
3 
4 #include <string>
5 #include <iostream>
6 #include <iomanip>
7 #include <yarp/os/all.h>
8 #include <yarp/sig/all.h>
9 #include <yarp/math/SVD.h>
10 #include <map>
11 #include <vector>
12 
13 #include "homeostasisManager.h"
14 
18 class HomeostaticModule: public yarp::os::RFModule
19 {
20 private:
21 
22  std::string moduleName;
23  double period;
24 
25  std::vector< yarp::os::BufferedPort<yarp::os::Bottle> * > input_ports;
26  std::vector< yarp::os::BufferedPort<yarp::os::Bottle> * > outputM_ports;
27  std::vector< yarp::os::BufferedPort<yarp::os::Bottle> * > outputm_ports;
28  HomeostasisManager* manager;
29  yarp::os::BufferedPort<yarp::os::Bottle> input_port;
30  yarp::os::Port rpc;
31 
37  bool addNewDrive(std::string driveName);
38 
44  bool addNewDrive(std::string driveName, yarp::os::Bottle& grpHomeostatic);
45 
51  bool removeDrive(int d);
52  bool verbose;
53 
54 public:
55 
61  Drive bDrive(yarp::os::Bottle* b)
62  {
63  return Drive(b->get(0).asString(),b->get(1).asDouble(),b->get(2).asString(),b->get(3).asDouble(),b->get(4).asDouble(),b->get(5).asDouble(),b->get(6).asBool());
64  }
65 
71  int openPorts(std::string driveName);
72 
73  bool configure(yarp::os::ResourceFinder &rf);
74 
76  {
77  return true;
78  }
79 
80  bool close();
81 
82  double getPeriod()
83  {
84  return period;
85  }
86  bool updateModule();
87 
88  //RPC & scenarios
89  bool respond(const yarp::os::Bottle& cmd, yarp::os::Bottle& reply);
90 };
91 
92 #endif
Drive bDrive(yarp::os::Bottle *b)
bDrive Create Drive from Bottle
bool configure(yarp::os::ResourceFinder &rf)
int openPorts(std::string driveName)
openPorts opens default ports for external communication
bool respond(const yarp::os::Bottle &cmd, yarp::os::Bottle &reply)