sot-talos-balance  1.7.0
hip-flexibility-compensation.hh
Go to the documentation of this file.
1 /*
2  * Copyright 2018, Gepetto team, LAAS-CNRS
3  *
4  * This file is part of sot-talos-balance.
5  * sot-talos-balance 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-talos-balance 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-talos-balance. If not, see <http://www.gnu.org/licenses/>.
15  */
16 
17 #ifndef __sot_talos_balance_hip_flexibility_compensation_H__
18 #define __sot_talos_balance_hip_flexibility_compensation_H__
19 
20 /* --------------------------------------------------------------------- */
21 /* --- API ------------------------------------------------------------- */
22 /* --------------------------------------------------------------------- */
23 
24 #if defined(WIN32)
25 #if defined(hip_flexibility_compensation_EXPORTS)
26 #define HIPFLEXIBILITYCOMPENSATION_EXPORT __declspec(dllexport)
27 #else
28 #define HIPFLEXIBILITYCOMPENSATION_EXPORT __declspec(dllimport)
29 #endif
30 #else
31 #define HIPFLEXIBILITYCOMPENSATION_EXPORT
32 #endif
33 
34 /* --------------------------------------------------------------------- */
35 /* --- INCLUDE --------------------------------------------------------- */
36 /* --------------------------------------------------------------------- */
37 
38 #include <dynamic-graph/signal-helper.h>
39 
40 #include <map>
41 #include <sot/core/robot-utils.hh>
42 #include "boost/assign.hpp"
43 
44 namespace dynamicgraph {
45 namespace sot {
46 namespace talos_balance {
47 
48 /* --------------------------------------------------------------------- */
49 /* --- CLASS ----------------------------------------------------------- */
50 /* --------------------------------------------------------------------- */
51 
53  : public ::dynamicgraph::Entity {
54  DYNAMIC_GRAPH_ENTITY_DECL();
55 
56  public:
57  EIGEN_MAKE_ALIGNED_OPERATOR_NEW
58 
59  /* --- CONSTRUCTOR ---- */
60  HipFlexibilityCompensation(const std::string& name);
61 
62  /* --- SIGNALS --- */
64  DECLARE_SIGNAL_IN(q_des, dynamicgraph::Vector);
66  DECLARE_SIGNAL_IN(tau, dynamicgraph::Vector);
68  DECLARE_SIGNAL_IN(K_l, double);
70  DECLARE_SIGNAL_IN(K_r, double);
72  // DECLARE_SIGNAL_IN(K_d, double);
73 
75  DECLARE_SIGNAL_OUT(tau_filt, dynamicgraph::Vector);
77  DECLARE_SIGNAL_OUT(delta_q, dynamicgraph::Vector);
80  DECLARE_SIGNAL_OUT(q_cmd, dynamicgraph::Vector);
81 
82  /* --- COMMANDS --- */
83  /* --- ENTITY INHERITANCE --- */
84  virtual void display(std::ostream& os) const;
85 
87  void init(const double &dt, const std::string& robotName);
89  void setTorqueLowPassFilterFrequency(const double& frequency);
91  void setAngularSaturation(const double& saturation);
93  void setRateLimiter(const double& rate);
95  dynamicgraph::Vector lowPassFilter(const double& frequency, const dynamicgraph::Vector& signal, dynamicgraph::Vector& previous_signal);
97  void rateLimiter(const dynamicgraph::Vector& signal, dynamicgraph::Vector& previous_signal, dynamicgraph::Vector& output);
98 
99 
100  protected:
102  // time step of the robot
103  double m_dt;
109 
110  RobotUtilShrPtr m_robot_util;
111 
112 }; // class HipFlexibilityCompensation
113 
114 } // namespace talos_balance
115 } // namespace sot
116 } // namespace dynamicgraph
117 
118 #endif // #ifndef __sot_talos_balance_hip_flexibility_compensation_H__
Eigen::Matrix< Scalar, Eigen::Dynamic, 1 > Vector
Definition: math/fwd.hh:40
double m_dt
true if the entity has been successfully initialized
#define HIPFLEXIBILITYCOMPENSATION_EXPORT