sot-core  4.11.6
Hierarchical task solver plug-in for dynamic-graph.
filter-differentiator.hh
Go to the documentation of this file.
1 /*
2  * Copyright 2017-, Rohan Budhirja, LAAS-CNRS
3  *
4  * This file is part of sot-torque-control.
5  * sot-torque-control is free software: you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public License
7  * as published by the Free Software Foundation, either version 3 of
8  * the License, or (at your option) any later version.
9  * sot-torque-control is distributed in the hope that it will be
10  * useful, but WITHOUT ANY WARRANTY; without even the implied warranty
11  * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU Lesser General Public License for more details. You should
13  * have received a copy of the GNU Lesser General Public License along
14  * with sot-torque-control. If not, see <http://www.gnu.org/licenses/>.
15  */
16 
17 #ifndef __sot_torque_control_FilterDifferentiator_H__
18 #define __sot_torque_control_FilterDifferentiator_H__
19 /* --------------------------------------------------------------------- */
20 /* --- API ------------------------------------------------------------- */
21 /* --------------------------------------------------------------------- */
22 
23 #if defined(WIN32)
24 #if defined(low_pass_filter_EXPORTS)
25 #define SOTFILTERDIFFERENTIATOR_EXPORT __declspec(dllexport)
26 #else
27 #define SOTFILTERDIFFERENTIATOR_EXPORT __declspec(dllimport)
28 #endif
29 #else
30 #define SOTFILTERDIFFERENTIATOR_EXPORT
31 #endif
32 
33 //#define VP_DEBUG 1 /// enable debug output
34 //#define VP_DEBUG_MODE 20
35 
36 /* --------------------------------------------------------------------- */
37 /* --- INCLUDE --------------------------------------------------------- */
38 /* --------------------------------------------------------------------- */
39 
40 /* HELPER */
41 #include <dynamic-graph/signal-helper.h>
43 #include <sot/core/stop-watch.hh>
44 
45 namespace dynamicgraph {
46 namespace sot {
58  : public ::dynamicgraph::Entity {
59  DYNAMIC_GRAPH_ENTITY_DECL();
60 
61 public: /* --- SIGNALS --- */
63  DECLARE_SIGNAL_IN(x, dynamicgraph::Vector);
65  DECLARE_SIGNAL_OUT(x_filtered, dynamicgraph::Vector);
66  DECLARE_SIGNAL_OUT(dx, dynamicgraph::Vector);
67  DECLARE_SIGNAL_OUT(ddx, dynamicgraph::Vector);
68 
79 
82  DECLARE_SIGNAL_INNER(x_dx_ddx, dynamicgraph::Vector);
83 
84 protected:
85  double m_dt;
86  int m_x_size;
87 
90 
91 public:
92  EIGEN_MAKE_ALIGNED_OPERATOR_NEW
93 
95  FilterDifferentiator(const std::string &name);
96 
108  void init(const double &timestep, const int &xSize,
109  const Eigen::VectorXd &filter_numerator,
110  const Eigen::VectorXd &filter_denominator);
111 
112  void switch_filter(const Eigen::VectorXd &filter_numerator,
113  const Eigen::VectorXd &filter_denominator);
114 
115 protected:
116 public: /* --- ENTITY INHERITANCE --- */
117  virtual void display(std::ostream &os) const;
118 
119 }; // class FilterDifferentiator
120 
121 } // namespace sot
122 } // namespace dynamicgraph
123 
124 #endif // #ifndef __sot_torque_control_FilterDifferentiator_H__
CausalFilter * m_filter
polynomial-fitting filters
Definition: filter-differentiator.hh:89
Definition: causal-filter.hh:45
#define SOTFILTERDIFFERENTIATOR_EXPORT
Definition: filter-differentiator.hh:30
int m_x_size
sampling timestep of the input signal
Definition: filter-differentiator.hh:86
double m_dt
Definition: filter-differentiator.hh:85
Definition: filter-differentiator.hh:57
Definition: abstract-sot-external-interface.hh:17