ocra-recipes
Doxygen documentation for the ocra-recipes repository
RobotState.h
Go to the documentation of this file.
1 #ifndef ROBOT_STATE_H
2 #define ROBOT_STATE_H
3 
4 #include <yarp/os/Portable.h>
5 #include <yarp/os/ConnectionWriter.h>
6 #include <yarp/os/ConnectionReader.h>
7 #include <yarp/os/PortReader.h>
8 
9 #include <Eigen/Dense>
10 #include <Eigen/Lgsm>
11 
12 #include <ocra/control/Model.h>
13 #include <ocra/util/Macros.h>
14 #include <ocra/util/ErrorsHelper.h>
15 #include <yarp/os/Bottle.h>
16 
17 
18 namespace ocra_recipes
19 {
20 
26 class RobotState : public yarp::os::Portable
27 {
29 public:
30  RobotState ();
31  RobotState (const int numberOfDoF);
32  virtual ~RobotState ();
33 
34  virtual bool write(yarp::os::ConnectionWriter& connection);
35  virtual bool read(yarp::os::ConnectionReader& connection);
36 
37  // friend std::ostream& operator<<(std::ostream &out, const RobotState& state);
38 
39 
40 public:
41  Eigen::VectorXd q;
42  Eigen::VectorXd qd;
43  Eigen::Displacementd H_root;
44  Eigen::Twistd T_root;
45 
46 private:
47  int nDoF;
48 };
49 
50 
51 
57 class StateListener : public yarp::os::PortReader {
58 private:
59  std::shared_ptr<ocra::Model> model;
60 
61 public:
62  StateListener();
63  StateListener (std::shared_ptr<ocra::Model> modelPtr);
64  virtual ~StateListener ();
65 
66  bool read(yarp::os::ConnectionReader& connection);
67 };
68 
69 } /* ocra_recipes */
70 #endif
Eigen::VectorXd qd
Definition: RobotState.h:42
Eigen::Displacementd H_root
Definition: RobotState.h:43
Declaration file of the Model class.
#define DEFINE_CLASS_POINTER_TYPEDEFS(Class)
Definition: Macros.h:8
virtual bool write(yarp::os::ConnectionWriter &connection)
Definition: RobotState.cpp:50
A callback for a port listing to robot states.
Definition: RobotState.h:57
Eigen::VectorXd q
Definition: RobotState.h:41
Eigen::Twistd T_root
Definition: RobotState.h:44
A portable class for sending robot state information over yarp.
Definition: RobotState.h:26
virtual bool read(yarp::os::ConnectionReader &connection)
Definition: RobotState.cpp:87