pinocchio  1.2.6-7-g6de3e-dirty
actuator-model.hpp
1 //
2 // Copyright (c) 2017 LAAS CNRS
3 //
4 // Author: Olivier Stasse
5 //
6 // This file is part of Pinocchio
7 // Pinocchio is free software: you can redistribute it
8 // and/or modify it under the terms of the GNU Lesser General Public
9 // License as published by the Free Software Foundation, either version
10 // 3 of the License, or (at your option) any later version.
11 //
12 // Pinocchio is distributed in the hope that it will be
13 // useful, but WITHOUT ANY WARRANTY; without even the implied warranty
14 // of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 // General Lesser Public License for more details. You should have
16 // received a copy of the GNU Lesser General Public License along with
17 // Pinocchio If not, see
18 // <http://www.gnu.org/licenses/>.
19 
20 #ifndef _ACTUATOR_MODEL_HH_
21 #define _ACTUATOR_MODEL_HH_
22 
23 #include<string>
24 
25 #include "pinocchio/spatial/force.hpp"
26 
27 namespace se3
28 {
51  template<typename C> struct amb_traits;
52  template<typename C> struct adb_traits;
53 
54  template<typename Derived>
56  {
57  typedef typename adb_traits<Derived>::ActuatorDataDerived ActuatorDataDerived;
58  ActuatorDataDerived& derived() { return *static_cast<Derived*>(this);}
59  const ActuatorDataDerived & derived()
60  const { return *static_cast<const Derived *>(this);}
61  }; // struct ActuatorDataBase
62 
63  template<typename Derived>
65  {
66  EIGEN_MAKE_ALIGNED_OPERATOR_NEW
67 
68  typedef typename amb_traits<Derived>::ActuatorModelDerived ActuatorModelDerived;
69  typedef typename amb_traits<Derived>::ActuatorDataDerived ActuatorDataDerived;
70  typedef typename ActuatorDataDerived::X_t X_t;
71  typedef typename ActuatorDataDerived::dX_t dX_t;
72  typedef typename ActuatorDataDerived::U_t U_t;
73  typedef typename ActuatorDataDerived::S_t S_t;
74  typedef typename ActuatorDataDerived::Observations_t Observations_t;
75  typedef typename ActuatorDataDerived::Parameters_t Parameters_t;
76 
77  ActuatorModelDerived & derived() { return *static_cast<Derived *>(this);}
78  const ActuatorModelDerived& derived() const
79  { return *static_cast<const Derived*>(this); }
80 
81  ActuatorDataDerived createData() const { return derived().createData(); }
82 
83  void ode_func(dX_t & dstate,
84  X_t & state,
85  U_t & control,
86  Force fext,
87  ActuatorDataDerived &data) const
88  { derived().ode_func(dstate,data,state);}
89 
90  void get_force(ActuatorDataDerived &data, Force &aForce) const
91  {
92  derived().get_force(data,aForce);
93  };
94 
95  const Observations_t & h(ActuatorDataDerived &data, X_t & state)
96  const { return derived(data,state).h; }
97 
98  const Parameters_t & c(ActuatorDataDerived &data) const
99  { return derived(data).c;}
100 
101  const S_t & S() const { return derived().S;}
102 
103  const U_t & u() const { return derived().u;}
104 
105  }; // struct ActuatorModelBase
106 }
107 #endif /* _ACTUATOR_MODEL_HH_ */
Concreate Class representing a force.
Definition: force.hpp:243