sot-talos-balance  2.0.5
Collection of dynamic-graph entities aimed at implementing balance control on talos.
simple-distribute-wrench.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_distribute_wrench_H__
18 #define __sot_talos_balance_simple_distribute_wrench_H__
19 
20 /* --------------------------------------------------------------------- */
21 /* --- API ------------------------------------------------------------- */
22 /* --------------------------------------------------------------------- */
23 
24 #if defined(WIN32)
25 #if defined(position_controller_EXPORTS)
26 #define SIMPLE_DISTRIBUTE_WRENCH_EXPORT __declspec(dllexport)
27 #else
28 #define SIMPLE_DISTRIBUTE_WRENCH_EXPORT __declspec(dllimport)
29 #endif
30 #else
31 #define SIMPLE_DISTRIBUTE_WRENCH_EXPORT
32 #endif
33 
34 /* --------------------------------------------------------------------- */
35 /* --- INCLUDE --------------------------------------------------------- */
36 /* --------------------------------------------------------------------- */
37 
38 #include <pinocchio/fwd.hpp>
39 // include pinocchio first
40 #include <dynamic-graph/signal-helper.h>
41 
42 #include <map>
43 #include <pinocchio/multibody/data.hpp>
44 #include <pinocchio/multibody/model.hpp>
45 #include <sot/core/robot-utils.hh>
46 
47 #include "boost/assign.hpp"
48 
49 namespace dynamicgraph {
50 namespace sot {
51 namespace talos_balance {
52 
53 /* --------------------------------------------------------------------- */
54 /* --- CLASS ----------------------------------------------------------- */
55 /* --------------------------------------------------------------------- */
56 
58  : public ::dynamicgraph::Entity {
59  DYNAMIC_GRAPH_ENTITY_DECL();
60 
61  public:
62  EIGEN_MAKE_ALIGNED_OPERATOR_NEW
63 
64  /* --- CONSTRUCTOR ---- */
65  SimpleDistributeWrench(const std::string& name);
66 
67  void init(const std::string& robotName);
68 
69  /* --- SIGNALS --- */
70  DECLARE_SIGNAL_IN(wrenchDes, dynamicgraph::Vector);
71  DECLARE_SIGNAL_IN(q, dynamicgraph::Vector);
72  DECLARE_SIGNAL_IN(rho, double);
73  DECLARE_SIGNAL_IN(phase, int);
74 
75  DECLARE_SIGNAL_INNER(kinematics_computations, int);
76  DECLARE_SIGNAL_INNER(wrenches, int);
77 
78  DECLARE_SIGNAL_OUT(wrenchLeft, dynamicgraph::Vector);
79  DECLARE_SIGNAL_OUT(ankleWrenchLeft, dynamicgraph::Vector);
80  DECLARE_SIGNAL_OUT(surfaceWrenchLeft, dynamicgraph::Vector);
81  DECLARE_SIGNAL_OUT(copLeft, dynamicgraph::Vector);
82  DECLARE_SIGNAL_OUT(wrenchRight, dynamicgraph::Vector);
83  DECLARE_SIGNAL_OUT(ankleWrenchRight, dynamicgraph::Vector);
84  DECLARE_SIGNAL_OUT(surfaceWrenchRight, dynamicgraph::Vector);
85  DECLARE_SIGNAL_OUT(copRight, dynamicgraph::Vector);
86 
87  DECLARE_SIGNAL_OUT(wrenchRef, dynamicgraph::Vector);
88  DECLARE_SIGNAL_OUT(zmpRef, dynamicgraph::Vector);
89  DECLARE_SIGNAL_OUT(emergencyStop, bool);
90 
91  public:
92  /* --- COMMANDS --- */
93  /* --- ENTITY INHERITANCE --- */
94  virtual void display(std::ostream& os) const;
95 
96  Eigen::Vector3d computeCoP(const dynamicgraph::Vector& wrench,
97  const pinocchio::SE3& pose) const;
98 
99  protected:
100  bool
102  pinocchio::Model m_model;
103  pinocchio::Data m_data;
104  RobotUtilShrPtr m_robot_util;
105 
106  // pinocchio::SE3 m_ankle_M_ftSens; /// ankle to F/T sensor
107  // transformation
108  pinocchio::SE3 m_ankle_M_sole;
109 
110  pinocchio::FrameIndex m_left_foot_id;
111  pinocchio::FrameIndex m_right_foot_id;
112 
113  pinocchio::SE3 m_contactLeft;
114  pinocchio::SE3 m_contactRight;
115 
116  Eigen::Matrix<double, 6, 1> m_wrenchLeft;
117  Eigen::Matrix<double, 6, 1> m_wrenchRight;
118 
119  void distributeWrench(const Eigen::VectorXd& wrenchDes, const double rho);
120  void saturateWrench(const Eigen::VectorXd& wrenchDes, const int phase);
121 
123 }; // class SimpleDistributeWrench
124 
125 } // namespace talos_balance
126 } // namespace sot
127 } // namespace dynamicgraph
128 
129 #endif // #ifndef __sot_talos_balance_simple_distribute_wrench_H__
sot_talos_balance.test.appli_admittance_end_effector.q
list q
Definition: appli_admittance_end_effector.py:30
dynamicgraph::sot::talos_balance::SimpleDistributeWrench::m_right_foot_id
pinocchio::FrameIndex m_right_foot_id
Definition: simple-distribute-wrench.hh:111
sot_talos_balance.test.appli_admittance_end_effector.sot
sot
Definition: appli_admittance_end_effector.py:117
sot_talos_balance.test.appli_ankle_admittance.robotName
string robotName
Definition: appli_ankle_admittance.py:33
dynamicgraph::sot::talos_balance::SimpleDistributeWrench::m_contactLeft
pinocchio::SE3 m_contactLeft
Definition: simple-distribute-wrench.hh:113
dynamicgraph
Definition: treeview.dox:24
dynamicgraph::sot::talos_balance::SimpleDistributeWrench::m_contactRight
pinocchio::SE3 m_contactRight
Definition: simple-distribute-wrench.hh:114
dynamicgraph::sot::talos_balance::SimpleDistributeWrench::m_ankle_M_sole
pinocchio::SE3 m_ankle_M_sole
Definition: simple-distribute-wrench.hh:108
dynamicgraph::sot::talos_balance::SimpleDistributeWrench::m_wrenchRight
Eigen::Matrix< double, 6, 1 > m_wrenchRight
Definition: simple-distribute-wrench.hh:117
dynamicgraph::sot::talos_balance::SimpleDistributeWrench
Definition: simple-distribute-wrench.hh:57
dynamicgraph::sot::talos_balance::SimpleDistributeWrench::m_robot_util
RobotUtilShrPtr m_robot_util
Pinocchio robot data.
Definition: simple-distribute-wrench.hh:104
dynamicgraph::sot::talos_balance::math::Vector
Eigen::Matrix< Scalar, Eigen::Dynamic, 1 > Vector
Definition: fwd.hh:36
sot_talos_balance.test.script_test_end_effector.wrench
wrench
Definition: script_test_end_effector.py:9
dynamicgraph::sot::talos_balance::SimpleDistributeWrench::m_data
pinocchio::Data m_data
Pinocchio robot model.
Definition: simple-distribute-wrench.hh:103
dynamicgraph::sot::talos_balance::SimpleDistributeWrench::m_model
pinocchio::Model m_model
true if the entity has been successfully initialized
Definition: simple-distribute-wrench.hh:102
SIMPLE_DISTRIBUTE_WRENCH_EXPORT
#define SIMPLE_DISTRIBUTE_WRENCH_EXPORT
Definition: simple-distribute-wrench.hh:31
dynamicgraph::sot::talos_balance::SimpleDistributeWrench::m_wrenchLeft
Eigen::Matrix< double, 6, 1 > m_wrenchLeft
Definition: simple-distribute-wrench.hh:116
dynamicgraph::sot::talos_balance::SimpleDistributeWrench::m_emergency_stop_triggered
bool m_emergency_stop_triggered
Definition: simple-distribute-wrench.hh:122
sot_talos_balance.test.appli_dcm_zmp_control.name
name
Definition: appli_dcm_zmp_control.py:298
dynamicgraph::sot::talos_balance::SimpleDistributeWrench::m_left_foot_id
pinocchio::FrameIndex m_left_foot_id
ankle to sole transformation
Definition: simple-distribute-wrench.hh:110
dynamicgraph::sot::talos_balance::SimpleDistributeWrench::m_initSucceeded
bool m_initSucceeded
Definition: simple-distribute-wrench.hh:101