sot-talos-balance  2.0.5
Collection of dynamic-graph entities aimed at implementing balance control on talos.
simple-state-integrator.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_simple_state_integrator_H__
18 #define __sot_talos_balance_simple_state_integrator_H__
19 
20 /* --------------------------------------------------------------------- */
21 /* --- API ------------------------------------------------------------- */
22 /* --------------------------------------------------------------------- */
23 
24 #if defined(WIN32)
25 #if defined(simple_state_integrator_EXPORTS)
26 #define SIMPLE_STATE_INTEGRATOR_EXPORT __declspec(dllexport)
27 #else
28 #define SIMPLE_STATE_INTEGRATOR_EXPORT __declspec(dllimport)
29 #endif
30 #else
31 #define SIMPLE_STATE_INTEGRATOR_EXPORT
32 #endif
33 
34 /* --------------------------------------------------------------------- */
35 /* --- INCLUDE --------------------------------------------------------- */
36 /* --------------------------------------------------------------------- */
37 
38 #include <dynamic-graph/linear-algebra.h>
39 #include <dynamic-graph/signal-helper.h>
40 
41 #include <map>
42 #include <sot/core/matrix-geometry.hh>
43 
44 #include "boost/assign.hpp"
45 
46 namespace dynamicgraph {
47 namespace sot {
48 namespace talos_balance {
49 
50 /* --------------------------------------------------------------------- */
51 /* --- CLASS ----------------------------------------------------------- */
52 /* --------------------------------------------------------------------- */
53 
55  : public ::dynamicgraph::Entity {
56  DYNAMIC_GRAPH_ENTITY_DECL();
57 
58  protected:
60  double timestep_;
61 
65  Eigen::VectorXd state_;
67  Eigen::VectorXd velocity_;
69 
70  public:
71  EIGEN_MAKE_ALIGNED_OPERATOR_NEW
72 
73  /* --- CONSTRUCTOR ---- */
74  SimpleStateIntegrator(const std::string& name);
75 
76  void init(const double& step);
77 
78  /* --- SIGNALS --- */
79  DECLARE_SIGNAL_IN(control, ::dynamicgraph::Vector);
80 
81  DECLARE_SIGNAL_OUT(state, ::dynamicgraph::Vector);
82  DECLARE_SIGNAL_OUT(velocity, ::dynamicgraph::Vector);
83 
84  public:
85  void setState(const ::dynamicgraph::Vector& st);
86  void setVelocity(const ::dynamicgraph::Vector& vel);
87 
88  /* --- COMMANDS --- */
89  /* --- ENTITY INHERITANCE --- */
90  virtual void display(std::ostream& os) const;
91 
92  protected:
95  void integrateRollPitchYaw(::dynamicgraph::Vector& state,
96  const ::dynamicgraph::Vector& control, double dt);
97  // Computes Euler angles in good range : [-pi:pi]x[-pi/2:pi/2]x[-pi:pi]
98  void rotationMatrixToEuler(const Eigen::Matrix3d& rotationMatrix,
99  Eigen::Vector3d& rollPitchYaw);
100 
101 }; // class SimpleStateIntegrator
102 
103 } // namespace talos_balance
104 } // namespace sot
105 } // namespace dynamicgraph
106 
107 #endif // #ifndef __sot_talos_balance_simple_state_integrator_H__
sot_talos_balance.test.appli_admittance_end_effector.sot
sot
Definition: appli_admittance_end_effector.py:117
dynamicgraph
Definition: treeview.dox:24
dynamicgraph::sot::talos_balance::SimpleStateIntegrator::velocity_
Eigen::VectorXd velocity_
Velocity of the robot wrt pinocchio.
Definition: simple-state-integrator.hh:67
SIMPLE_STATE_INTEGRATOR_EXPORT
#define SIMPLE_STATE_INTEGRATOR_EXPORT
Definition: simple-state-integrator.hh:31
dynamicgraph::sot::talos_balance::SimpleStateIntegrator::state_
Eigen::VectorXd state_
Definition: simple-state-integrator.hh:65
dynamicgraph::sot::talos_balance::math::Vector
Eigen::Matrix< Scalar, Eigen::Dynamic, 1 > Vector
Definition: fwd.hh:36
sot_talos_balance.test.appli_admittance_single_joint.dt
dt
Definition: appli_admittance_single_joint.py:17
dynamicgraph::sot::talos_balance::SimpleStateIntegrator::timestep_
double timestep_
Current integration step.
Definition: simple-state-integrator.hh:60
dynamicgraph::sot::talos_balance::SimpleStateIntegrator
Definition: simple-state-integrator.hh:54
sot_talos_balance.test.appli_dcm_zmp_control.name
name
Definition: appli_dcm_zmp_control.py:298