sot-torque-control  1.6.5
Collection of dynamic-graph entities aimed at implementing torque control on different robots.
ddp_pyrene_actuator_solver.hh
Go to the documentation of this file.
1 /*
2  * Copyright 2019
3  *
4  * LAAS-CNRS
5  *
6  * Noelie RAMUZAT
7  * This file is part of sot-torque-control.
8  * See license file.
9  */
10 
11 #ifndef _SOT_DDP_PYRENE_ACTUATOR_SOLVER_H
12 #define _SOT_DDP_PYRENE_ACTUATOR_SOLVER_H
13 /* --------------------------------------------------------------------- */
14 /* --- API ------------------------------------------------------------- */
15 /* --------------------------------------------------------------------- */
16 
17 #if defined(WIN32)
18 #if defined(sot_ddp_pyrene_actuator_EXPORTS)
19 #define SOTDDPPYRENEACTUATORSOLVER_EXPORT __declspec(dllexport)
20 #else
21 #define SOTDDPPYRENEACTUATORSOLVER_EXPORT __declspec(dllimport)
22 #endif
23 #else
24 #define SOTDDPPYRENEACTUATORSOLVER_EXPORT
25 #endif
26 
27 /* --------------------------------------------------------------------- */
28 /* --- INCLUDE --------------------------------------------------------- */
29 /* --------------------------------------------------------------------- */
30 
31 #include <dynamic-graph/signal-helper.h>
32 
33 #include <ddp-actuator-solver/ddpsolver.hh>
34 #include <ddp-actuator-solver/pyrene_actuator/pyreneActuator.hh>
35 #include <ddp-actuator-solver/pyrene_actuator/pyreneCostFunction.hh>
36 #include <sot/core/causal-filter.hh>
37 #include <sot/core/matrix-geometry.hh>
38 #include <sot/core/robot-utils.hh>
39 #include <tsid/utils/stop-watch.hpp>
40 #include <vector>
41 
42 namespace dynamicgraph {
43 namespace sot {
44 namespace torque_control {
45 
47  : public ::dynamicgraph::Entity {
48  DYNAMIC_GRAPH_ENTITY_DECL();
49 
50  public:
51  EIGEN_MAKE_ALIGNED_OPERATOR_NEW
52 
54  DdpPyreneActuatorSolver(const std::string& name);
55 
56  /* --- SIGNALS --- */
57  DECLARE_SIGNAL_IN(pos_des, dynamicgraph::Vector);
58  DECLARE_SIGNAL_IN(pos_joint_measure, dynamicgraph::Vector);
59  DECLARE_SIGNAL_IN(dx_joint_measure, dynamicgraph::Vector);
60  DECLARE_SIGNAL_IN(tau_des, dynamicgraph::Vector);
61  DECLARE_SIGNAL_OUT(tau, dynamicgraph::Vector);
62 
63  /* --- ENTITY INHERITANCE --- */
64  virtual void display(std::ostream& os) const;
65 
66  protected:
67  dynamicgraph::Vector m_previous_tau;
68  double m_dt;
70  DDPSolver<double, 2, 1>::stateVec_t m_zeroState;
71  DDPSolver<double, 2, 1>::commandVec_t m_u;
72  unsigned int m_T;
73  double m_stopCrit;
74  unsigned int m_iterMax;
75  pyreneActuator m_model;
76  CostFunctionPyreneActuator m_cost;
77  DDPSolver<double, 2, 1> m_solver;
78 
85  void param_init(const double& timestep, const int& T, const int& nbItMax,
86  const double& stopCriteria);
87 
88  // /* --- SETTER LIM --- */
89  void setTorqueLimit(const double& tau);
90  void setJointLimit(const double& upperLim, const double& lowerLim);
91  void setJointVelLimit(const double& upperLim, const double& lowerLim);
92 
93  // /* --- SETTER LOAD --- */
94  void setLoadParam(const double& mass, const double& coordX,
95  const double& coordY);
96  void setLoadMass(const double& mass);
97  void removeLoad();
98 
99  // /* --- SETTER GAINS --- */
100  void setCostGainState(const dynamicgraph::Vector& Q);
101  void setCostGainStateConstraint(const dynamicgraph::Vector& W);
102  void setCostGainCommand(const dynamicgraph::Vector& R);
103  void setCostGainTorqueConstraint(const dynamicgraph::Vector& P);
104 };
105 } // namespace torque_control
106 } // namespace sot
107 } // namespace dynamicgraph
108 #endif // _SOT_SIMPLE_DDP_ACTUATOR_SOLVER_H
dynamicgraph::sot::torque_control::DdpPyreneActuatorSolver::m_initSucceeded
bool m_initSucceeded
Definition: ddp_pyrene_actuator_solver.hh:69
dynamicgraph
to read text file
Definition: treeview.dox:22
dynamicgraph::sot::torque_control::DdpPyreneActuatorSolver::m_stopCrit
double m_stopCrit
Definition: ddp_pyrene_actuator_solver.hh:73
dynamicgraph::sot::torque_control::DdpPyreneActuatorSolver::m_dt
double m_dt
Definition: ddp_pyrene_actuator_solver.hh:68
dynamicgraph::sot::torque_control::DdpPyreneActuatorSolver::m_solver
DDPSolver< double, 2, 1 > m_solver
Definition: ddp_pyrene_actuator_solver.hh:77
dynamicgraph::sot::torque_control::DdpPyreneActuatorSolver::m_iterMax
unsigned int m_iterMax
Definition: ddp_pyrene_actuator_solver.hh:74
dynamicgraph::sot::torque_control::DdpPyreneActuatorSolver
Definition: ddp_pyrene_actuator_solver.hh:46
dynamicgraph::sot::torque_control::DdpPyreneActuatorSolver::m_model
pyreneActuator m_model
Definition: ddp_pyrene_actuator_solver.hh:75
dynamicgraph::sot::torque_control::DdpPyreneActuatorSolver::m_cost
CostFunctionPyreneActuator m_cost
Definition: ddp_pyrene_actuator_solver.hh:76
torque_control
Definition: __init__.py:1
SOTDDPPYRENEACTUATORSOLVER_EXPORT
#define SOTDDPPYRENEACTUATORSOLVER_EXPORT
Definition: ddp_pyrene_actuator_solver.hh:24
dynamicgraph::sot::torque_control::DdpPyreneActuatorSolver::m_zeroState
DDPSolver< double, 2, 1 >::stateVec_t m_zeroState
Definition: ddp_pyrene_actuator_solver.hh:70
dynamicgraph::sot::torque_control::DdpPyreneActuatorSolver::m_u
DDPSolver< double, 2, 1 >::commandVec_t m_u
Definition: ddp_pyrene_actuator_solver.hh:71
dynamicgraph::sot::torque_control::DdpPyreneActuatorSolver::m_T
unsigned int m_T
Definition: ddp_pyrene_actuator_solver.hh:72
dynamicgraph::sot::torque_control::DdpPyreneActuatorSolver::m_previous_tau
dynamicgraph::Vector m_previous_tau
Definition: ddp_pyrene_actuator_solver.hh:67