pinocchio  2.1.3
motion-zero.hpp
1 //
2 // Copyright (c) 2015-2017 CNRS
3 // Copyright (c) 2015-2016 Wandercraft, 86 rue de Paris 91400 Orsay, France.
4 //
5 
6 #ifndef __pinocchio_motion_zero_hpp__
7 #define __pinocchio_motion_zero_hpp__
8 
9 namespace pinocchio
10 {
11 
12  namespace internal
13  {
14 
15  template<typename Scalar, int Options>
16  struct SE3GroupAction< BiasZeroTpl<Scalar,Options> >
17  {
18  typedef BiasZeroTpl<Scalar,Options> ReturnType;
19  };
20 
21  template<typename Scalar, int Options, typename MotionDerived>
22  struct MotionAlgebraAction< BiasZeroTpl<Scalar,Options>, MotionDerived>
23  {
24  typedef BiasZeroTpl<Scalar,Options> ReturnType;
25  };
26  }
27 
28  template<typename _Scalar, int _Options>
29  struct traits< BiasZeroTpl<_Scalar,_Options> >
30  {
31  enum {
32  Options = _Options,
33  LINEAR = 0,
34  ANGULAR = 3
35  };
36  typedef _Scalar Scalar;
37  typedef Eigen::Matrix<Scalar,3,1,Options> Vector3;
38  typedef Eigen::Matrix<Scalar,6,1,Options> Vector6;
39  typedef Eigen::Matrix<Scalar,3,3,Options> Matrix3;
40  typedef Eigen::Matrix<Scalar,6,6,Options> Matrix6;
41  typedef typename PINOCCHIO_EIGEN_REF_CONST_TYPE(Vector6) ToVectorConstReturnType;
42  typedef typename PINOCCHIO_EIGEN_REF_TYPE(Vector6) ToVectorReturnType;
43  typedef Matrix6 ActionMatrixType;
44  typedef Vector3 AngularType;
45  typedef const Vector3 ConstAngularType;
46  typedef Vector3 LinearType;
47  typedef const Vector3 ConstLinearType;
48  typedef Motion MotionPlain;
49 
50  }; // traits BiasZeroTpl
51 
52  template<typename Scalar, int Options>
53  struct BiasZeroTpl : public MotionBase< BiasZeroTpl<Scalar,Options> >
54  {
56 
57 // operator MotionPlain () const { return MotionPlain::Zero(); }
58 
59  template<typename D2>
60  static bool isEqual_impl(const MotionDense<D2> & other)
61  { return other.linear().isZero() && other.angular().isZero(); }
62 
63  template<typename D2>
64  static void addTo(const MotionBase<D2> &) {}
65 
66  template<typename D2>
67  static void setTo(MotionBase<D2> & other)
68  {
69  other.setZero();
70  }
71 
72  template<typename M1>
73  BiasZeroTpl motionAction(const MotionBase<M1> &) const
74  {
75  return BiasZeroTpl();
76  }
77 
78  template<typename S2, int O2, typename D2>
79  void se3Action_impl(const SE3Tpl<S2,O2> &, MotionDense<D2> & v) const
80  {
81  v.setZero();
82  }
83 
84  template<typename S2, int O2>
85  BiasZeroTpl se3Action_impl(const SE3Tpl<S2,O2> &) const
86  {
87  return BiasZeroTpl();
88  }
89 
90  template<typename S2, int O2, typename D2>
91  void se3ActionInverse_impl(const SE3Tpl<S2,O2> &, MotionDense<D2> & v) const
92  {
93  v.setZero();
94  }
95 
96  template<typename S2, int O2>
97  BiasZeroTpl se3ActionInverse_impl(const SE3Tpl<S2,O2> &) const
98  {
99  return BiasZeroTpl();
100  }
101 
102  }; // struct BiasZeroTpl
103 
104  template<typename M1, typename Scalar, int Options>
105  inline const M1 & operator+(const MotionBase<M1> & v,
107  { return v.derived(); }
108 
109  template<typename Scalar, int Options, typename M1>
110  inline const M1 & operator+(const BiasZeroTpl<Scalar,Options> &,
111  const MotionBase<M1> & v)
112  { return v.derived(); }
113 
114 } // namespace pinocchio
115 
116 #endif // ifndef __pinocchio_motion_zero_hpp__
Main pinocchio namespace.
Definition: treeview.dox:24
Common traits structure to fully define base classes for CRTP.
Definition: spatial/fwd.hpp:29