sot-torque-control  1.6.5
Collection of dynamic-graph entities aimed at implementing torque control on different robots.
numerical-difference.hh
Go to the documentation of this file.
1 /*
2  * Copyright 2014, Andrea Del Prete, LAAS-CNRS
3  *
4  */
5 
6 #ifndef __sot_torque_control_NumericalDifference_H__
7 #define __sot_torque_control_NumericalDifference_H__
8 /* --------------------------------------------------------------------- */
9 /* --- API ------------------------------------------------------------- */
10 /* --------------------------------------------------------------------- */
11 
12 #if defined(WIN32)
13 #if defined(numerical_difference_EXPORTS)
14 #define SOTNUMERICALDIFFERENCE_EXPORT __declspec(dllexport)
15 #else
16 #define SOTNUMERICALDIFFERENCE_EXPORT __declspec(dllimport)
17 #endif
18 #else
19 #define SOTNUMERICALDIFFERENCE_EXPORT
20 #endif
21 
22 // #define VP_DEBUG 1 /// enable debug output
23 // #define VP_DEBUG_MODE 20
24 
25 /* --------------------------------------------------------------------- */
26 /* --- INCLUDE --------------------------------------------------------- */
27 /* --------------------------------------------------------------------- */
28 
29 /* HELPER */
30 #include <dynamic-graph/signal-helper.h>
31 
32 #include <boost/circular_buffer.hpp>
33 #include <sot/core/matrix-geometry.hh>
34 #include <sot/core/stop-watch.hh>
36 
37 /* Polynomial estimators */
40 
41 namespace dynamicgraph {
42 namespace sot {
43 namespace torque_control {
44 
50  : public ::dynamicgraph::Entity {
51  DYNAMIC_GRAPH_ENTITY_DECL();
52 
53  public: /* --- SIGNALS --- */
54  DECLARE_SIGNAL_IN(x, dynamicgraph::Vector);
55  DECLARE_SIGNAL_OUT(x_filtered, dynamicgraph::Vector);
56  DECLARE_SIGNAL_OUT(dx, dynamicgraph::Vector);
57  DECLARE_SIGNAL_OUT(ddx, dynamicgraph::Vector);
58 
66 
69  DECLARE_SIGNAL_INNER(x_dx_ddx, dynamicgraph::Vector);
70 
71  protected:
72  double m_dt;
73  double m_delay;
74  int x_size;
77  std::vector<double> m_ddx_filter_std;
78  std::vector<double> m_dx_filter_std;
79  std::vector<double> m_x_filter_std;
80  std::vector<double> m_x_std;
81 
84 
85  public:
86  EIGEN_MAKE_ALIGNED_OPERATOR_NEW
87 
89  NumericalDifference(const std::string& name);
90 
101  void init(const double& timestep, const int& sigSize, const double& delay,
102  const int& polyOrder);
103 
104  protected:
105  void sendMsg(const std::string& msg, MsgType t = MSG_TYPE_INFO,
106  const char* = "", int = 0) {
107  logger_.stream(t) << ("[" + name + "] " + msg) << '\n';
108  }
109 
110  public: /* --- ENTITY INHERITANCE --- */
111  virtual void display(std::ostream& os) const;
112 
113 }; // class NumericalDifference
114 
115 } // namespace torque_control
116 } // namespace sot
117 } // namespace dynamicgraph
118 
119 #endif // #ifndef __sot_torque_control_NumericalDifference_H__
void sendMsg(const std::string &msg, MsgType t=MSG_TYPE_INFO, const char *="", int=0)
DECLARE_SIGNAL_INNER(x_dx_ddx, dynamicgraph::Vector)
DECLARE_SIGNAL_OUT(x_filtered, dynamicgraph::Vector)
double m_delay
sampling timestep of the input signal
to read text file
Definition: treeview.dox:22
#define SOTNUMERICALDIFFERENCE_EXPORT