hpp-constraints  4.9.1
Definition of basic geometric constraints for motion planning
symbolic-calculus.hh
Go to the documentation of this file.
1 // Copyright (c) 2014, LAAS-CNRS
2 // Authors: Joseph Mirabel (joseph.mirabel@laas.fr)
3 //
4 // This file is part of hpp-constraints.
5 // hpp-constraints is free software: you can redistribute it
6 // and/or modify it under the terms of the GNU Lesser General Public
7 // License as published by the Free Software Foundation, either version
8 // 3 of the License, or (at your option) any later version.
9 //
10 // hpp-constraints is distributed in the hope that it will be
11 // useful, but WITHOUT ANY WARRANTY; without even the implied warranty
12 // of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 // General Lesser Public License for more details. You should have
14 // received a copy of the GNU Lesser General Public License along with
15 // hpp-constraints. If not, see <http://www.gnu.org/licenses/>.
16 
17 #ifndef HPP_CONSTRAINTS_SYMBOLIC_CALCULUS_HH
18 #define HPP_CONSTRAINTS_SYMBOLIC_CALCULUS_HH
19 
20 #define HPP_CONSTRAINTS_CB_REF boost::shared_ptr
21 #define HPP_CONSTRAINTS_CB_WKREF boost::shared_ptr
22 
23 #define HPP_CONSTRAINTS_CB_DEFINE_OPERATOR1(op, InType, OutType) \
24  template < typename RhsType > \
25  typename Traits <OutType < RhsType > >::Ptr_t op ( \
26  const InType& lhs, \
27  const HPP_CONSTRAINTS_CB_REF <RhsType>& rhs) { \
28  typedef OutType < RhsType> Op_t; \
29  return Op_t::create (lhs, rhs); \
30  }
31 #define HPP_CONSTRAINTS_CB_FRIEND_OPERATOR1(op, InType, OutType) \
32  template < typename RhsType > \
33  friend typename Traits <OutType < RhsType > >::Ptr_t op ( \
34  const InType& lhs, \
35  const HPP_CONSTRAINTS_CB_REF <RhsType>& rhs);
36 
37 #define HPP_CONSTRAINTS_CB_DEFINE_OPERATOR2(op, OutType) \
38  template < typename LhsType, typename RhsType > \
39  typename Traits <OutType < LhsType, RhsType > >::Ptr_t op ( \
40  const HPP_CONSTRAINTS_CB_REF <LhsType>& lhs, \
41  const HPP_CONSTRAINTS_CB_REF <RhsType>& rhs) { \
42  typedef OutType < LhsType, RhsType> Op_t; \
43  return Op_t::create (lhs, rhs); \
44  }
45 
46 #define HPP_CONSTRAINTS_CB_FRIEND_OPERATOR2(op, OutType) \
47  template < typename LhsType, typename RhsType > \
48  friend typename Traits <OutType < LhsType, RhsType > >::Ptr_t op ( \
49  const HPP_CONSTRAINTS_CB_REF <LhsType>& lhs, \
50  const HPP_CONSTRAINTS_CB_REF <RhsType>& rhs);
51 
52 #define HPP_CONSTRAINTS_CB_CREATE1(Class, Arg0Type) \
53  static typename Traits <Class>::Ptr_t create (Arg0Type arg0) { \
54  typename Traits <Class>::Ptr_t ptr (new Class (arg0)); \
55  ptr->init (ptr); \
56  return ptr; \
57  }
58 
59 #define HPP_CONSTRAINTS_CB_CREATE2(Class, Arg0Type, Arg1Type) \
60  static typename Traits <Class>::Ptr_t create (Arg0Type arg0, Arg1Type arg1) { \
61  typename Traits <Class>::Ptr_t ptr (new Class (arg0, arg1)); \
62  ptr->init (ptr); \
63  return ptr; \
64  }
65 
66 #define HPP_CONSTRAINTS_CB_CREATE3(Class, Arg0Type, Arg1Type, Arg2Type) \
67  static typename Traits <Class>::Ptr_t create (Arg0Type arg0, Arg1Type arg1, Arg2Type arg2) { \
68  typename Traits <Class>::Ptr_t ptr (new Class (arg0, arg1, arg2)); \
69  ptr->init (ptr); \
70  return ptr; \
71  }
72 
73 #include <Eigen/SVD>
74 
75 #include <hpp/pinocchio/joint.hh>
78 
79 #include <hpp/constraints/fwd.hh>
80 #include <hpp/constraints/svd.hh>
81 #include <hpp/constraints/tools.hh>
83 
84 namespace hpp {
85  namespace constraints {
87 
90 
91  template <typename ValueType, typename JacobianType> class CalculusBaseAbstract;
92  template <typename T> class Traits;
93 
94  template <typename LhsValue, typename RhsValue> class Expression;
95  template <typename LhsValue, typename RhsValue> class CrossProduct;
96  template <typename LhsValue, typename RhsValue> class ScalarProduct;
97  template <typename LhsValue, typename RhsValue> class Difference;
98  template <typename LhsValue, typename RhsValue> class Sum;
99  template <typename RhsValue> class ScalarMultiply;
100  template <typename RhsValue> class RotationMultiply;
102  typedef Eigen::Matrix <value_type, 1, Eigen::Dynamic, Eigen::RowMajor> RowJacobianMatrix;
103  typedef Eigen::Matrix <value_type, 3, Eigen::Dynamic, Eigen::RowMajor> JacobianMatrix;
104 
105  template <typename Class>
106  struct Traits {
107  typedef HPP_CONSTRAINTS_CB_REF <Class> Ptr_t;
108  typedef HPP_CONSTRAINTS_CB_WKREF <Class> WkPtr_t;
109  };
110  template <> struct Traits<value_type> {
111  typedef value_type Ptr_t;
113  };
114  template <> struct Traits<pinocchio::Joint> {
115  typedef JointPtr_t Ptr_t;
117  };
118 
119  struct JointTranspose {
120  JointTranspose (const JointPtr_t& joint) :
121  j_ (joint) {}
122  const JointPtr_t j_;
123  };
124  template <> struct Traits<JointTranspose> {
127  };
128 
140  template <class ValueType = eigen::vector3_t,
141  class JacobianType = JacobianMatrix >
143  {
144  public:
145  typedef ValueType ValueType_t;
146  typedef JacobianType JacobianType_t;
147 
148  virtual const ValueType& value () const = 0;
149  virtual const JacobianType& jacobian () const = 0;
150  virtual void computeValue (const ConfigurationIn_t arg) = 0;
151  virtual void computeJacobian (const ConfigurationIn_t arg) = 0;
152  virtual void invalidate () = 0;
153  };
154 
166  template <class T,
167  class ValueType = vector3_t,
168  class JacobianType = JacobianMatrix,
169  class CrossType = CrossMatrix >
170  class CalculusBase : public CalculusBaseAbstract <ValueType, JacobianType>
171  {
172  public:
173  CalculusBase () : cross_ (CrossMatrix::Zero()) {}
174 
175  CalculusBase (const ValueType& value, const JacobianType& jacobian) :
176  value_ (value), jacobian_ (jacobian),
177  cross_ (CrossMatrix::Zero()) {}
178 
180  value_ (o.value()), jacobian_ (o.jacobian_),
181  cross_ (o.cross())
182  {
183  }
184 
185  inline const ValueType& value () const {
186  return value_;
187  }
188  inline const JacobianType& jacobian () const {
189  return jacobian_;
190  }
191  void computeValue (const ConfigurationIn_t arg) {
192  if (vValid_) return;
193  static_cast<T*>(this)->impl_value (arg);
194  vValid_ = true;
195  }
197  if (jValid_) return;
198  static_cast<T*>(this)->impl_jacobian (arg);
199  jValid_ = true;
200  }
201  void invalidate () {
202  vValid_ = false;
203  jValid_ = false;
204  cValid_ = false;
205  }
206  inline const CrossType& cross () const {
207  return cross_;
208  }
210  if (cValid_) return;
211  computeValue (arg);
212  computeCrossMatrix (value_, cross_);
213  cValid_ = true;
214  }
215 
216  protected:
217  ValueType value_;
218  JacobianType jacobian_;
219  CrossType cross_;
220 
221  bool vValid_, jValid_, cValid_;
222 
223  void init (const typename Traits <T>::Ptr_t& ptr) {
224  wkPtr_ = ptr;
225  }
226 
227  private:
228  typename Traits <T>::WkPtr_t wkPtr_;
229 
230  public:
231  EIGEN_MAKE_ALIGNED_OPERATOR_NEW
232  };
233 
238 
242 
243 
244  template <typename LhsValue, typename RhsValue>
245  class Expression
246  {
247  public:
248  typedef boost::shared_ptr <
250  > Ptr_t;
251  typedef boost::weak_ptr <
254 
255  static Ptr_t create () {
256  Ptr_t p (new Expression ());
257  p->init (p);
258  return p;
259  }
260 
261  static Ptr_t create (const typename Traits<LhsValue>::Ptr_t& lhs,
262  const typename Traits<RhsValue>::Ptr_t& rhs) {
263  Ptr_t p (new Expression (lhs, rhs));
264  p->init (p);
265  return p;
266  }
267 
268  const LhsValue& lhs () const {
269  return lhs_;
270  }
271 
272  const RhsValue& rhs () const {
273  return rhs_;
274  }
275 
277 
278  Expression (const Expression& other):
279  rhs_ (other.rhs()), lhs_ (other.lhs())
280  {}
281 
282  Expression (const typename Traits<LhsValue>::Ptr_t& lhs,
283  const typename Traits<RhsValue>::Ptr_t& rhs):
284  rhs_ (rhs), lhs_ (lhs)
285  {}
286 
287  inline void init (Ptr_t self) {
288  self_ = self;
289  }
290 
294 
295  public:
296  EIGEN_MAKE_ALIGNED_OPERATOR_NEW
297  };
298 
300  template <typename LhsValue, typename RhsValue>
301  class CrossProduct :
302  public CalculusBase < CrossProduct < LhsValue, RhsValue > >
303  {
304  public:
307 
309 
311 
313  Parent_t (other),
314  e_ (static_cast <const CrossProduct&>(other).e_)
315  {}
316 
317  CrossProduct (const typename Traits<LhsValue>::Ptr_t& lhs, const typename Traits<RhsValue>::Ptr_t& rhs):
318  e_ (Expression < LhsValue, RhsValue >::create (lhs, rhs))
319  {}
320 
321  void impl_value (const ConfigurationIn_t arg) {
322  e_->lhs_->computeCrossValue (arg);
323  e_->rhs_->computeValue (arg);
324  this->value_ = e_->lhs_->cross () * e_->rhs_->value ();
325  }
326  void impl_jacobian (const ConfigurationIn_t arg) {
327  e_->lhs_->computeCrossValue (arg);
328  e_->rhs_->computeCrossValue (arg);
329  e_->lhs_->computeJacobian (arg);
330  e_->rhs_->computeJacobian (arg);
331  this->jacobian_ = e_->lhs_->cross () * e_->rhs_->jacobian ()
332  - e_->rhs_->cross () * e_->lhs_->jacobian ();
333  }
334  void invalidate () {
335  Parent_t::invalidate ();
336  e_->rhs_->invalidate ();
337  e_->lhs_->invalidate ();
338  }
339 
340  protected:
342 
343  friend class Expression <LhsValue, RhsValue>;
344  };
345 
347  template <typename LhsValue, typename RhsValue>
348  class ScalarProduct :
349  public CalculusBase < ScalarProduct < LhsValue, RhsValue >, Eigen::Matrix<value_type,1,1>, RowJacobianMatrix >
350  {
351  public:
352  typedef CalculusBase < ScalarProduct < LhsValue, RhsValue >, Eigen::Matrix<value_type,1,1>, RowJacobianMatrix >
354 
356 
358 
360  CalculusBase <ScalarProduct> (other),
361  e_ (static_cast <const ScalarProduct&>(other).e_)
362  {}
363 
364  ScalarProduct (const typename Traits<LhsValue>::Ptr_t& lhs, const typename Traits<RhsValue>::Ptr_t& rhs):
365  e_ (Expression < LhsValue, RhsValue >::create (lhs, rhs))
366  {}
367 
368  void impl_value (const ConfigurationIn_t arg) {
369  e_->lhs_->computeValue (arg);
370  e_->rhs_->computeValue (arg);
371  this->value_[0] = e_->lhs_->value ().dot (e_->rhs_->value ());
372  }
373  void impl_jacobian (const ConfigurationIn_t arg) {
374  e_->lhs_->computeValue (arg);
375  e_->rhs_->computeValue (arg);
376  e_->lhs_->computeJacobian (arg);
377  e_->rhs_->computeJacobian (arg);
378  this->jacobian_ = e_->lhs_->value ().transpose () * e_->rhs_->jacobian ()
379  + e_->rhs_->value ().transpose () * e_->lhs_->jacobian ();
380  }
381  void invalidate () {
382  Parent_t::invalidate ();
383  e_->rhs_->invalidate ();
384  e_->lhs_->invalidate ();
385  }
386 
387  protected:
389 
390  friend class Expression <LhsValue, RhsValue>;
391  };
392 
394  template <typename LhsValue, typename RhsValue>
395  class Difference :
396  public CalculusBase < Difference < LhsValue, RhsValue > >
397  {
398  public:
401 
403 
405 
407  CalculusBase <Difference> (other),
408  e_ (static_cast <const Difference&>(other).e_)
409  {}
410 
411  Difference (const typename Traits<LhsValue>::Ptr_t& lhs, const typename Traits<RhsValue>::Ptr_t& rhs):
412  e_ (Expression < LhsValue, RhsValue >::create (lhs, rhs))
413  {}
414 
415  void impl_value (const ConfigurationIn_t arg) {
416  e_->lhs_->computeValue (arg);
417  e_->rhs_->computeValue (arg);
418  this->value_ = e_->lhs_->value () - e_->rhs_->value ();
419  }
420  void impl_jacobian (const ConfigurationIn_t arg) {
421  e_->lhs_->computeJacobian (arg);
422  e_->rhs_->computeJacobian (arg);
423  this->jacobian_ = e_->lhs_->jacobian () - e_->rhs_->jacobian ();
424  }
425  void invalidate () {
426  Parent_t::invalidate ();
427  e_->rhs_->invalidate ();
428  e_->lhs_->invalidate ();
429  }
430 
431  protected:
433 
434  friend class Expression <LhsValue, RhsValue>;
435  };
436 
438  template <typename LhsValue, typename RhsValue>
439  class Sum :
440  public CalculusBase < Sum < LhsValue, RhsValue > >
441  {
442  public:
445 
447 
448  Sum () {}
449 
450  Sum (const CalculusBase < Sum >& other) :
451  CalculusBase < Sum > (other),
452  e_ (static_cast <const Sum&>(other).e_)
453  {}
454 
455  Sum (const typename Traits<RhsValue>::Ptr_t& rhs, const typename Traits<LhsValue>::Ptr_t& lhs):
456  e_ (Expression < LhsValue, RhsValue >::create (lhs, rhs))
457  {}
458 
459  void impl_value (const ConfigurationIn_t arg) {
460  e_->lhs_->computeValue (arg);
461  e_->rhs_->computeValue (arg);
462  this->value_ = e_->lhs_->value () + e_->rhs_->value ();
463  }
464  void impl_jacobian (const ConfigurationIn_t arg) {
465  e_->lhs_->computeJacobian (arg);
466  e_->rhs_->computeJacobian (arg);
467  this->jacobian_ = e_->lhs_->jacobian () + e_->rhs_->jacobian ();
468  }
469  void invalidate () {
470  Parent_t::invalidate ();
471  e_->rhs_->invalidate ();
472  e_->lhs_->invalidate ();
473  }
474 
475  protected:
477 
478  friend class Expression <LhsValue, RhsValue>;
479  };
480 
482  template <typename RhsValue>
483  class ScalarMultiply :
484  public CalculusBase < ScalarMultiply < RhsValue > >
485  {
486  public:
489 
491 
493 
495  CalculusBase < ScalarMultiply > (other),
496  e_ (static_cast <const ScalarMultiply&>(other).e_)
497  {}
498 
499  ScalarMultiply (const typename Traits<value_type>::Ptr_t& scalar, const typename Traits<RhsValue>::Ptr_t& rhs):
500  e_ (Expression < value_type, RhsValue >::create (scalar, rhs))
501  {}
502 
503  void impl_value (const ConfigurationIn_t arg) {
504  e_->rhs_->computeValue (arg);
505  this->value_ = e_->lhs_ * e_->rhs_->value ();
506  }
507  void impl_jacobian (const ConfigurationIn_t arg) {
508  e_->rhs_->computeJacobian (arg);
509  this->jacobian_ = e_->lhs_ * e_->rhs_->jacobian ();
510  }
511  void invalidate () {
512  Parent_t::invalidate ();
513  e_->rhs_->invalidate ();
514  }
515 
516  protected:
518 
519  friend class Expression <value_type, RhsValue>;
520  };
521 
523  template <typename RhsValue>
524  class RotationMultiply :
525  public CalculusBase < RotationMultiply < RhsValue > >
526  {
527  public:
530 
532 
534  CalculusBase < RotationMultiply > (other),
535  e_ (static_cast <const RotationMultiply&>(other).e_),
536  transpose_ (other.transpose_)
537  {}
538 
540 
542 
543  RotationMultiply (const typename Traits<JointTranspose>::Ptr_t& joint, const typename Traits<RhsValue>::Ptr_t& rhs):
544  e_ (Expression < pinocchio::Joint, RhsValue >::create (joint.j_, rhs)),
545  transpose_ (true)
546  {}
547 
548  RotationMultiply (const typename Traits<pinocchio::Joint>::Ptr_t& joint, const typename Traits<RhsValue>::Ptr_t& rhs,
549  bool transpose = false):
550  e_ (Expression < pinocchio::Joint, RhsValue >::create (joint, rhs)),
551  transpose_ (transpose)
552  {}
553 
554  void impl_value (const ConfigurationIn_t arg) {
555  e_->rhs_->computeValue (arg);
556  const matrix3_t& R = e_->lhs_->currentTransformation ().rotation ();
557  if (transpose_)
558  this->value_ = R.transpose() * e_->rhs_->value ();
559  else
560  this->value_ = R * e_->rhs_->value ();
561  }
562  void impl_jacobian (const ConfigurationIn_t arg) {
563  e_->rhs_->computeJacobian (arg);
564  e_->rhs_->computeCrossValue (arg);
565  const JointJacobian_t& J = e_->lhs_->jacobian ();
566  const matrix3_t& R = e_->lhs_->currentTransformation ().rotation ();
567  if (transpose_)
568  this->jacobian_ = R.transpose()
569  * ((e_->rhs_->cross () * R) * J.bottomRows<3>() + e_->rhs_->jacobian ());
570  else
571  this->jacobian_ = R
572  * ((e_->rhs_->cross () * R) * J.bottomRows<3>() + e_->rhs_->jacobian ());
573  }
574  void invalidate () {
575  Parent_t::invalidate ();
576  e_->rhs_->invalidate ();
577  }
578 
579  protected:
581 
582  friend class Expression <pinocchio::Joint, RhsValue>;
583 
584  private:
585  bool transpose_;
586  };
587 
589  class PointInJoint : public CalculusBase <PointInJoint>
590  {
591  public:
593 
596 
598 
600  CalculusBase<PointInJoint> (other)
601  {
602  const PointInJoint& o = static_cast <const PointInJoint&>(other);
603  joint_ = o.joint ();
604  local_ = o.local ();
605  center_= local_.isZero ();
606  }
607 
608  PointInJoint (const PointInJoint& pointInJoint) :
609  CalculusBase<PointInJoint> (pointInJoint),
610  joint_ (pointInJoint.joint ()), local_ (pointInJoint.local ()),
611  center_ (local_.isZero ())
612  {}
613 
614  PointInJoint (const JointPtr_t& joint,
615  const vector3_t& pointInLocalFrame) :
616  joint_ (joint), local_ (pointInLocalFrame),
617  center_ (pointInLocalFrame.isZero ())
618  {
619  assert (joint_ != NULL);
620  }
621 
622  PointInJoint (const JointPtr_t& joint,
623  const vector3_t& pointInLocalFrame,
624  size_type nbDof) :
625  joint_ (joint), local_ (pointInLocalFrame),
626  center_ (pointInLocalFrame.isZero ())
627  {
628  if (joint_ == NULL) {
629  for (int i = 0; i < 3; ++i) this->value_[i] = local_[i];
630  this->jacobian_.resize (3, nbDof);
631  this->jacobian_.setZero ();
632  this->cross_.setZero ();
633  }
634  }
635 
636 
637  const JointPtr_t& joint () const {
638  return joint_;
639  }
640  const vector3_t& local () const {
641  return local_;
642  }
644  if (joint_ == NULL) return;
645  this->value_ = joint_->currentTransformation ().act (local_);
646  }
648  if (joint_ == NULL) return;
649  const JointJacobian_t& J (joint_->jacobian ());
650  const matrix3_t& R = joint_->currentTransformation ().rotation ();
651  this->jacobian_.noalias() = R * J.topRows<3>();
652  if (!center_) {
653  computeCrossRXl ();
654  this->jacobian_.noalias() -= (this->cross_ * R) * J.bottomRows<3>();
655  }
656  }
657  void computeCrossRXl () {
658  if (joint_ == NULL) return;
659  if (center_) {
660  this->cross_.setZero ();
661  return;
662  }
663  computeCrossMatrix (
664  joint_->currentTransformation ().rotation () * local_,
665  this->cross_);
666  }
667 
668  protected:
671  bool center_;
672 
673  public:
674  EIGEN_MAKE_ALIGNED_OPERATOR_NEW
675  };
676 
678  class VectorInJoint : public CalculusBase <VectorInJoint>
679  {
680  public:
681 
684 
686 
688  CalculusBase<VectorInJoint> (other),
689  joint_ (static_cast <const VectorInJoint&>(other).joint()),
690  vector_ (static_cast <const VectorInJoint&>(other).vector())
691  {}
692 
693  VectorInJoint (const VectorInJoint& vectorInJoint) :
694  CalculusBase<VectorInJoint> (vectorInJoint),
695  joint_ (vectorInJoint.joint ()),
696  vector_ (vectorInJoint.vector())
697  {}
698 
699  VectorInJoint (const JointPtr_t& joint,
700  const vector3_t& vectorInLocalFrame) :
701  joint_ (joint), vector_ (vectorInLocalFrame)
702  {}
703 
704  VectorInJoint (const JointPtr_t& joint,
705  const vector3_t& vectorInLocalFrame,
706  const size_type& nbDof) :
707  joint_ (joint), vector_ (vectorInLocalFrame)
708  {
709  if (joint_ == NULL) {
710  for (int i = 0; i < 3; ++i) this->value_[i] = vector_[i];
711  this->jacobian_.resize (3, nbDof);
712  this->jacobian_.setZero ();
713  this->cross_.setZero ();
714  }
715  }
716 
717  const JointPtr_t& joint () const {
718  return joint_;
719  }
720  const vector3_t& vector () const {
721  return vector_;
722  }
724  if (joint_ == NULL) return;
725  this->value_ = joint_->currentTransformation ().rotation () * vector_;
726  }
728  if (joint_ == NULL) return;
729  const JointJacobian_t& J (joint_->jacobian ());
730  const matrix3_t& R = joint_->currentTransformation ().rotation ();
731  computeCrossRXl ();
732  this->jacobian_.noalias() = (- this->cross_ * R ) * J.bottomRows<3>();
733  }
734  void computeCrossRXl () {
735  if (joint_ == NULL) return;
736  computeCrossMatrix (
737  joint_->currentTransformation ().rotation () * vector_,
738  this->cross_);
739  }
740 
741  protected:
744 
745  public:
746  EIGEN_MAKE_ALIGNED_OPERATOR_NEW
747  };
748 
750  template <typename FunctionType>
751  class FunctionExp : public CalculusBase <FunctionExp<FunctionType>, vector_t, matrix_t>
752  {
753  public:
755  typedef boost::shared_ptr<FunctionType> FunctionTypePtr_t;
756 
757  HPP_CONSTRAINTS_CB_CREATE1 (FunctionExp<FunctionType>, const FunctionTypePtr_t&)
758 
760 
761  FunctionExp (const Parent_t& other) :
762  Parent_t (other), f_ (other.f_), lge_ (other.lge_)
763  {}
764 
765  FunctionExp (const FunctionExp& other) :
766  Parent_t (other), f_ (other.f_), lge_ (other.lge_)
767  {}
768 
772  FunctionExp (const FunctionTypePtr_t& func) :
773  Parent_t (vector_t::Zero(func->outputSize()),
774  matrix_t::Zero(func->outputDerivativeSize(), func->inputDerivativeSize())),
775  f_ (func), lge_ (func->outputSpace())
776  {}
777 
778  void impl_value (const ConfigurationIn_t arg)
779  {
780  f_->value (lge_, arg);
781  this->value_ = lge_.vector();
782  }
783  void impl_jacobian (const ConfigurationIn_t arg) { f_->jacobian (this->jacobian_, arg); }
784 
785  private:
786  FunctionTypePtr_t f_;
787  LiegroupElement lge_;
788  };
789 
793  class Point : public CalculusBase <Point, vector3_t, JacobianMatrix>
794  {
795  public:
796  HPP_CONSTRAINTS_CB_CREATE2 (Point, const vector3_t&, const size_t&)
797 
798  Point () {}
799 
802  {
803  }
804 
805  Point (const Point& point) :
807  {
808  }
809 
814  Point (const vector3_t& point, size_t jacobianNbCols) :
816  (point, JacobianMatrix::Zero (3, jacobianNbCols))
817  {
818  }
819 
820  void impl_value (const ConfigurationIn_t ) {}
822  };
823 
825  class PointCom : public CalculusBase <PointCom, vector3_t, ComJacobian_t>
826  {
827  public:
830 
831  PointCom () {}
832 
833  PointCom (const Parent_t& other):
834  Parent_t (other),
835  comc_ (static_cast <const PointCom&>(other).centerOfMassComputation ())
836  {
837  }
838 
839  PointCom (const CenterOfMassComputationPtr_t& comc): comc_ (comc)
840  {}
841 
842  inline const vector3_t& value () const {
843  return comc_->com();
844  }
845  inline const ComJacobian_t& jacobian () const {
846  return comc_->jacobian();
847  }
848 
850  return comc_;
851  }
853  comc_->compute (hpp::pinocchio::COM);
854  }
856  comc_->compute (hpp::pinocchio::COMPUTE_ALL);
857  // TODO: there is memory and time to be saved here as this copy is
858  // not important.
859  //this->jacobian_ = comc_->jacobian ();
860  }
861 
862  protected:
864  };
865 
866  class JointFrame : public CalculusBase <JointFrame, Eigen::Matrix<value_type, 6, 1>, Eigen::Matrix<value_type, 6, Eigen::Dynamic> >
867  {
868  public:
870 
872 
874 
875  JointFrame (const Parent_t& other) :
876  Parent_t (other),
877  joint_ (static_cast <const JointFrame&>(other).joint_)
878  {}
879 
880  JointFrame (const JointFrame& jf) :
881  Parent_t (jf), joint_ (jf.joint ())
882  {}
883 
884  JointFrame (const JointPtr_t& joint) :
885  joint_ (joint)
886  {
887  assert (joint_ != NULL);
888  this->jacobian_.resize(6,joint->robot()->numberDof()-joint->robot()->extraConfigSpace().dimension());
889  }
890 
891  const JointPtr_t& joint () const {
892  return joint_;
893  }
895  const Transform3f& M = joint_->currentTransformation ();
896  this->value_.head<3>() = M.translation ();
897  logSO3 (M.rotation(), theta_, this->value_.tail<3>());
898  }
899  void impl_jacobian (const ConfigurationIn_t arg) {
900  computeValue (arg);
901  const JointJacobian_t& J (joint_->jacobian ());
902  const matrix3_t& R (joint_->currentTransformation ().rotation ());
903  // Compute vector r
904  eigen::matrix3_t Jlog;
905  assert (theta_ >= 0);
906  JlogSO3 (theta_, this->value_.tail<3>(), Jlog);
907  this->jacobian_.topRows<3>().noalias() = R * J.topRows<3>();
908  this->jacobian_.bottomRows<3>().noalias() = Jlog * J.bottomRows<3>();
909  }
910 
911  protected:
913  double theta_;
914 
915  public:
916  EIGEN_MAKE_ALIGNED_OPERATOR_NEW
917  };
918 
920  template <typename ValueType = eigen::vector3_t, typename JacobianType = JacobianMatrix>
922  public CalculusBase <MatrixOfExpressions <ValueType, JacobianType > ,
923  Eigen::Matrix<value_type, Eigen::Dynamic, Eigen::Dynamic >,
924  Eigen::Matrix<value_type, Eigen::Dynamic, Eigen::Dynamic > >
925  {
926  public:
927  typedef Eigen::Matrix<value_type, Eigen::Dynamic, Eigen::Dynamic >
929  typedef Eigen::Matrix<value_type, Eigen::Dynamic, Eigen::Dynamic >
931  typedef Eigen::Matrix<value_type, Eigen::Dynamic, Eigen::Dynamic >
933  typedef Eigen::Matrix<value_type, Eigen::Dynamic, Eigen::Dynamic >
938  typedef Eigen::JacobiSVD <Value_t> SVD_t;
939 
940  HPP_CONSTRAINTS_CB_CREATE2 (MatrixOfExpressions, const Eigen::Ref<const Value_t>&, const Eigen::Ref<const Jacobian_t>&)
941 
942  MatrixOfExpressions (const Eigen::Ref<const Value_t>& value,
943  const Eigen::Ref<const Jacobian_t>& jacobian) :
944  Parent_t (value, jacobian),
945  nRows_ (0), nCols_ (0),
946  svd_ (value.rows(), value.cols(), Eigen::ComputeFullU | Eigen::ComputeFullV),
947  piValid_ (false), svdValid_ (false)
948  {}
949 
950  MatrixOfExpressions (const Parent_t& other) :
951  Parent_t (other),
952  nRows_ (static_cast <const MatrixOfExpressions&>(other).nRows_),
953  nCols_ (static_cast <const MatrixOfExpressions&>(other).nCols_),
954  elements_ (static_cast <const MatrixOfExpressions&>(other).elements_),
955  svd_ (static_cast <const MatrixOfExpressions&>(other).svd_),
956  piValid_ (static_cast <const MatrixOfExpressions&>(other).piValid_),
957  svdValid_ (static_cast <const MatrixOfExpressions&>(other).svdValid_)
958  {
959  }
960 
962  Parent_t (matrix),
963  nRows_ (matrix.nRows_), nCols_ (matrix.nCols_),
964  elements_ (matrix.elements_),
965  svd_ (matrix.svd_),
966  piValid_ (matrix.piValid_),
967  svdValid_ (matrix.svdValid_)
968  {
969  }
970 
971  void setSize (std::size_t nRows, std::size_t nCols) {
972  nRows_ = nRows;
973  nCols_ = nCols;
974  elements_.resize (nRows_);
975  for (std::size_t i = 0; i < nRows; ++i)
976  elements_[i].resize(nCols);
977  }
978 
979  ElementPtr_t& operator() (std::size_t i, std::size_t j) {
980  return elements_[i][j];
981  }
982 
983  void set (std::size_t i, std::size_t j, const ElementPtr_t ptr) {
984  elements_[i][j] = ptr;
985  }
986 
987  void impl_value (const ConfigurationIn_t arg) {
988  size_type r = 0, c = 0, nr = 0, nc = 0;
989  for (std::size_t i = 0; i < nRows_; ++i) {
990  c = 0;
991  nr = elements_[i][0]->value().rows();
992  for (std::size_t j = 0; j < nCols_; ++j) {
993  elements_[i][j]->computeValue (arg);
994  assert (nr == elements_[i][j]->value().rows());
995  nc = elements_[i][j]->value().cols();
996  this->value_.block (r, c, nr, nc)
997  = elements_[i][j]->value();
998  c += nc;
999  }
1000  r += nr;
1001  }
1002  }
1004  size_type r = 0, c = 0, nr = 0, nc = 0;
1005  for (std::size_t i = 0; i < nRows_; ++i) {
1006  c = 0;
1007  nr = elements_[i][0]->jacobian().rows();
1008  for (std::size_t j = 0; j < nCols_; ++j) {
1009  elements_[i][j]->computeJacobian (arg);
1010  assert (nr == elements_[i][j]->jacobian().rows());
1011  nc = elements_[i][j]->jacobian().cols();
1012  this->jacobian_.block (r, c, nr, nc)
1013  = elements_[i][j]->jacobian();
1014  c += nc;
1015  }
1016  r += nr;
1017  }
1018  }
1019 
1020  inline const PseudoInv_t& pinv () const {
1021  return pi_;
1022  }
1023  inline const PseudoInvJacobian_t& pinvJacobian () const {
1024  return pij_;
1025  }
1026  void computeSVD (const ConfigurationIn_t arg) {
1027  if (svdValid_) return;
1028  this->computeValue (arg);
1029  svd_.compute (this->value_);
1030  HPP_DEBUG_SVDCHECK(svd_);
1031  svdValid_ = true;
1032  }
1034  if (piValid_) return;
1035  this->computeValue (arg);
1036  this->computeSVD(arg);
1037  pi_.resize (this->value_.cols(), this->value_.rows());
1038  pseudoInverse <SVD_t> (svd_, pi_);
1039  piValid_ = true;
1040  }
1041  void computePseudoInverseJacobian (const ConfigurationIn_t arg, const Eigen::Ref <const Eigen::Matrix<value_type, Eigen::Dynamic, 1> >& rhs) {
1042  this->computeJacobian (arg);
1043  computePseudoInverse (arg);
1044  const std::size_t nbDof = elements_[0][0]->jacobian().cols();
1045  const std::size_t inSize = this->value_.cols();
1046  const vector_t piTrhs = svd_.solve (rhs);
1047  assert (pi_.rows () == (size_type)inSize);
1048 
1049  Jacobian_t cache (this->jacobian_.rows(), nbDof);
1050  jacobianTimes (arg, piTrhs, cache);
1051  pij_.noalias() = - pi_ * cache;
1052  cache.resize (inSize, nbDof);
1053 
1054  pkInv_.resize (pi_.cols(), pi_.cols());
1055  projectorOnKernelOfInv <SVD_t> (svd_, pkInv_, true);
1056  jacobianTransposeTimes (arg, pkInv_ * rhs, cache);
1057  pij_.noalias() += (pi_ * pi_.transpose()) * cache;
1058 
1059  jacobianTransposeTimes (arg, pi_.transpose() * piTrhs , cache);
1060  pk_.resize (inSize, inSize);
1061  projectorOnKernel <SVD_t> (svd_, pk_, true);
1062  pij_.noalias() += pk_ * cache;
1063  }
1064 
1065  void jacobianTimes (const ConfigurationIn_t arg, const Eigen::Ref <const Eigen::Matrix<value_type, Eigen::Dynamic, 1> >& rhs, Eigen::Ref<Jacobian_t> cache) const {
1066  size_type r = 0, c = 0, nr = 0, nc = 0;
1067  cache.setZero();
1068  for (std::size_t i = 0; i < nRows_; ++i) {
1069  c = 0;
1070  nr = elements_[i][0]->jacobian().rows();
1071  for (std::size_t j = 0; j < nCols_; ++j) {
1072  elements_[i][j]->computeJacobian (arg);
1073  assert (nr == elements_[i][j]->jacobian().rows());
1074  nc = elements_[i][j]->jacobian().cols();
1075  cache.middleRows (r,nr).noalias() +=
1076  this->jacobian_.block (r, c, nr, nc) * rhs[j];
1077  c += nc;
1078  }
1079  r += nr;
1080  }
1081  }
1082 
1083  void jacobianTransposeTimes (const ConfigurationIn_t arg, const Eigen::Ref <const Eigen::Matrix<value_type, Eigen::Dynamic, 1> >& rhs, Eigen::Ref<Jacobian_t> cache) const {
1084  size_type r = 0, c = 0, nr = 0, nc = 0;
1085  cache.setZero();
1086  for (std::size_t i = 0; i < nRows_; ++i) {
1087  c = 0;
1088  nr = elements_[i][0]->jacobian().rows();
1089  for (std::size_t j = 0; j < nCols_; ++j) {
1090  elements_[i][j]->computeJacobian (arg);
1091  assert (nr == elements_[i][j]->jacobian().rows());
1092  nc = elements_[i][j]->jacobian().cols();
1093  cache.row (j) += rhs.segment (r, nr).transpose() * this->jacobian_.block (r, c, nr, nc);
1094  c += nc;
1095  }
1096  r += nr;
1097  }
1098  }
1099 
1100  Eigen::JacobiSVD <Value_t>& svd () { return svd_; }
1101 
1102  void invalidate () {
1103  Parent_t::invalidate ();
1104  for (std::size_t i = 0; i < nRows_; ++i)
1105  for (std::size_t j = 0; j < nCols_; ++j)
1106  elements_[i][j]->invalidate ();
1107  piValid_ = false;
1108  svdValid_ = false;
1109  }
1110 
1111  std::size_t nRows_, nCols_;
1112  std::vector <std::vector <ElementPtr_t> > elements_;
1113 
1114  private:
1115  SVD_t svd_;
1116  matrix_t pkInv_, pk_;
1117  PseudoInv_t pi_;
1118  PseudoInvJacobian_t pij_;
1119  bool piValid_, svdValid_;
1120 
1121  public:
1122  EIGEN_MAKE_ALIGNED_OPERATOR_NEW
1123  };
1124 
1126  } // namespace constraints
1127 } // namespace hpp
1128 
1129 #endif // HPP_CONSTRAINTS_SYMBOLIC_CALCULUS_HH
void jacobianTransposeTimes(const ConfigurationIn_t arg, const Eigen::Ref< const Eigen::Matrix< value_type, Eigen::Dynamic, 1 > > &rhs, Eigen::Ref< Jacobian_t > cache) const
Definition: symbolic-calculus.hh:1083
PointCom(const CenterOfMassComputationPtr_t &comc)
Definition: symbolic-calculus.hh:839
const vector3_t & vector() const
Definition: symbolic-calculus.hh:720
CalculusBaseAbstract< ValueType, JacobianType > Element_t
Definition: symbolic-calculus.hh:936
pinocchio::vector_t vector_t
Definition: fwd.hh:45
Eigen::Matrix< value_type, Eigen::Dynamic, Eigen::Dynamic > Jacobian_t
Definition: symbolic-calculus.hh:930
PointInJoint(const JointPtr_t &joint, const vector3_t &pointInLocalFrame, size_type nbDof)
Definition: symbolic-calculus.hh:622
Difference of two expressions.
Definition: symbolic-calculus.hh:97
CalculusBase< Difference< LhsValue, RhsValue > > Parent_t
Definition: symbolic-calculus.hh:400
void invalidate()
Definition: symbolic-calculus.hh:201
#define HPP_DEBUG_SVDCHECK(svd)
Definition: macros.hh:46
boost::posix_time::ptime point
Eigen::Matrix< value_type, 3, 3 > matrix3_t
Definition: fwd.hh:57
Sum(const typename Traits< RhsValue >::Ptr_t &rhs, const typename Traits< LhsValue >::Ptr_t &lhs)
Definition: symbolic-calculus.hh:455
Multiplication of an expression by a scalar.
Definition: symbolic-calculus.hh:99
JacobianType jacobian_
Definition: symbolic-calculus.hh:218
bool vValid_
Definition: symbolic-calculus.hh:221
pinocchio::JointJacobian_t JointJacobian_t
Definition: fwd.hh:49
CalculusBase< ScalarProduct< LhsValue, RhsValue >, Eigen::Matrix< value_type, 1, 1 >, RowJacobianMatrix > Parent_t
Definition: symbolic-calculus.hh:353
Eigen::Matrix< value_type, Eigen::Dynamic, Eigen::Dynamic > PseudoInv_t
Definition: symbolic-calculus.hh:932
void impl_jacobian(const ConfigurationIn_t)
Definition: symbolic-calculus.hh:647
MatrixOfExpressions(const Parent_t &other)
Definition: symbolic-calculus.hh:950
PointInJoint(const CalculusBase< PointInJoint > &other)
Definition: symbolic-calculus.hh:599
value_type Ptr_t
Definition: symbolic-calculus.hh:111
#define HPP_CONSTRAINTS_CB_CREATE2(Class, Arg0Type, Arg1Type)
Definition: symbolic-calculus.hh:59
Eigen::JacobiSVD< Value_t > & svd()
Definition: symbolic-calculus.hh:1100
Traits< LhsValue >::Ptr_t lhs_
Definition: symbolic-calculus.hh:292
ValueType value_
Definition: symbolic-calculus.hh:217
void computePseudoInverseJacobian(const ConfigurationIn_t arg, const Eigen::Ref< const Eigen::Matrix< value_type, Eigen::Dynamic, 1 > > &rhs)
Definition: symbolic-calculus.hh:1041
Expression< value_type, RhsValue >::Ptr_t e_
Definition: symbolic-calculus.hh:517
Basic expression representing a COM.
Definition: symbolic-calculus.hh:825
std::vector< std::vector< ElementPtr_t > > elements_
Definition: symbolic-calculus.hh:1112
Basic expression mapping a function as an expression.
Definition: symbolic-calculus.hh:751
CalculusBase< JointFrame, ValueType_t, JacobianType_t > Parent_t
Definition: symbolic-calculus.hh:869
Matrix having Expression elements.
Definition: symbolic-calculus.hh:921
Definition: symbolic-calculus.hh:92
Eigen::JacobiSVD< Value_t > SVD_t
Definition: symbolic-calculus.hh:938
Basic expression representing a point in a joint frame.
Definition: symbolic-calculus.hh:589
Eigen::Matrix< value_type, 1, Eigen::Dynamic, Eigen::RowMajor > RowJacobianMatrix
Definition: symbolic-calculus.hh:102
void impl_jacobian(const ConfigurationIn_t arg)
Definition: symbolic-calculus.hh:373
void computeValue(const ConfigurationIn_t arg)
Definition: symbolic-calculus.hh:191
Traits< Expression >::WkPtr_t self_
Definition: symbolic-calculus.hh:293
ObjectFactory * create(ObjectFactory *parent=NULL, const XMLElement *element=NULL)
Definition: fwd.hh:26
void eigen(const Eigen::MatrixBase< Derived > &m, typename Derived::Scalar dout[3], Vector *vout)
Definition: symbolic-calculus.hh:91
CalculusBase< FunctionExp< FunctionType >, vector_t, matrix_t > Parent_t
Definition: symbolic-calculus.hh:754
Point(const CalculusBase< Point, vector3_t, JacobianMatrix > &other)
Definition: symbolic-calculus.hh:800
void init(Ptr_t self)
Definition: symbolic-calculus.hh:287
FCL_REAL r
pinocchio::matrix3_t matrix3_t
Definition: fwd.hh:40
void impl_jacobian(const ConfigurationIn_t arg)
Definition: symbolic-calculus.hh:1003
void computeCrossRXl()
Definition: symbolic-calculus.hh:657
void impl_value(const ConfigurationIn_t)
Definition: symbolic-calculus.hh:852
void impl_jacobian(const ConfigurationIn_t)
Definition: symbolic-calculus.hh:855
void invalidate()
Definition: symbolic-calculus.hh:425
Eigen::Matrix< value_type, 3, Eigen::Dynamic, Eigen::RowMajor > JacobianMatrix
Definition: symbolic-calculus.hh:103
ValueType ValueType_t
Definition: symbolic-calculus.hh:145
boost::weak_ptr< Expression< LhsValue, RhsValue > > WkPtr_t
Definition: symbolic-calculus.hh:253
CalculusBase(const ValueType &value, const JacobianType &jacobian)
Definition: symbolic-calculus.hh:175
boost::shared_ptr< Expression< LhsValue, RhsValue > > Ptr_t
Definition: symbolic-calculus.hh:250
VectorInJoint(const JointPtr_t &joint, const vector3_t &vectorInLocalFrame)
Definition: symbolic-calculus.hh:699
pinocchio::matrix_t matrix_t
Definition: fwd.hh:42
void impl_value(const ConfigurationIn_t arg)
Definition: symbolic-calculus.hh:321
Vec3f c
CalculusBase()
Definition: symbolic-calculus.hh:173
ScalarMultiply(const typename Traits< value_type >::Ptr_t &scalar, const typename Traits< RhsValue >::Ptr_t &rhs)
Definition: symbolic-calculus.hh:499
Expression< LhsValue, RhsValue >::Ptr_t e_
Definition: symbolic-calculus.hh:476
void invalidate()
Definition: symbolic-calculus.hh:469
JointPtr_t joint_
Definition: symbolic-calculus.hh:742
void impl_value(const ConfigurationIn_t arg)
Definition: symbolic-calculus.hh:778
pinocchio::ComJacobian_t ComJacobian_t
Definition: fwd.hh:48
Point(const Point &point)
Definition: symbolic-calculus.hh:805
void JlogSO3(const value_type &theta, const Eigen::MatrixBase< Derived > &log, matrix3_t &Jlog)
Definition: tools.hh:109
VectorInJoint(const VectorInJoint &vectorInJoint)
Definition: symbolic-calculus.hh:693
const LhsValue & lhs() const
Definition: symbolic-calculus.hh:268
Point(const vector3_t &point, size_t jacobianNbCols)
Definition: symbolic-calculus.hh:814
ScalarMultiply(const CalculusBase< ScalarMultiply > &other)
Definition: symbolic-calculus.hh:494
pinocchio::vector3_t vector3_t
Definition: fwd.hh:39
Expression()
Definition: symbolic-calculus.hh:276
void impl_jacobian(const ConfigurationIn_t arg)
Definition: symbolic-calculus.hh:783
#define HPP_CONSTRAINTS_CB_CREATE3(Class, Arg0Type, Arg1Type, Arg2Type)
Definition: symbolic-calculus.hh:66
PointCom(const Parent_t &other)
Definition: symbolic-calculus.hh:833
const PseudoInvJacobian_t & pinvJacobian() const
Definition: symbolic-calculus.hh:1023
void computePseudoInverse(const ConfigurationIn_t arg)
Definition: symbolic-calculus.hh:1033
Expression< pinocchio::Joint, RhsValue >::Ptr_t e_
Definition: symbolic-calculus.hh:580
JacobianType JacobianType_t
Definition: symbolic-calculus.hh:146
void impl_value(const ConfigurationIn_t)
Definition: symbolic-calculus.hh:723
void invalidate()
Definition: symbolic-calculus.hh:334
CenterOfMassComputationPtr_t comc_
Definition: symbolic-calculus.hh:863
CalculusBase< Sum< LhsValue, RhsValue > > Parent_t
Definition: symbolic-calculus.hh:444
Eigen::Matrix< value_type, 3, 1 > vector3_t
Definition: fwd.hh:58
VectorInJoint(const JointPtr_t &joint, const vector3_t &vectorInLocalFrame, const size_type &nbDof)
Definition: symbolic-calculus.hh:704
value_type WkPtr_t
Definition: symbolic-calculus.hh:112
pinocchio::ConfigurationIn_t ConfigurationIn_t
Definition: fwd.hh:88
void impl_jacobian(const ConfigurationIn_t)
Definition: symbolic-calculus.hh:821
const PseudoInv_t & pinv() const
Definition: symbolic-calculus.hh:1020
JointPtr_t joint_
Definition: symbolic-calculus.hh:669
Eigen::Matrix< value_type, Eigen::Dynamic, Eigen::Dynamic > PseudoInvJacobian_t
Definition: symbolic-calculus.hh:934
assert(d.lhs()._blocks()==d.rhs()._blocks())
Scalar product of two expressions.
Definition: symbolic-calculus.hh:96
void computeCrossRXl()
Definition: symbolic-calculus.hh:734
Sum of two expressions.
Definition: symbolic-calculus.hh:98
pinocchio::JointPtr_t JointPtr_t
Definition: fwd.hh:37
#define HPP_CONSTRAINTS_CB_DEFINE_OPERATOR1(op, InType, OutType)
Definition: symbolic-calculus.hh:23
void invalidate()
Definition: symbolic-calculus.hh:511
std::size_t nRows_
Definition: symbolic-calculus.hh:1111
Expression(const typename Traits< LhsValue >::Ptr_t &lhs, const typename Traits< RhsValue >::Ptr_t &rhs)
Definition: symbolic-calculus.hh:282
void impl_value(const ConfigurationIn_t arg)
Definition: symbolic-calculus.hh:415
static Ptr_t create(const typename Traits< LhsValue >::Ptr_t &lhs, const typename Traits< RhsValue >::Ptr_t &rhs)
Definition: symbolic-calculus.hh:261
const JacobianType & jacobian() const
Definition: symbolic-calculus.hh:188
void impl_jacobian(const ConfigurationIn_t)
Definition: symbolic-calculus.hh:727
Traits< Element_t >::Ptr_t ElementPtr_t
Definition: symbolic-calculus.hh:937
void impl_value(const ConfigurationIn_t)
Definition: symbolic-calculus.hh:643
FunctionExp(const Parent_t &other)
Definition: symbolic-calculus.hh:761
const JointPtr_t j_
Definition: symbolic-calculus.hh:122
void impl_jacobian(const ConfigurationIn_t arg)
Definition: symbolic-calculus.hh:420
Cross product of two expressions.
Definition: symbolic-calculus.hh:95
vector3_t vector_
Definition: symbolic-calculus.hh:743
#define HPP_CONSTRAINTS_CB_CREATE1(Class, Arg0Type)
Definition: symbolic-calculus.hh:52
CalculusBase< RotationMultiply< RhsValue > > Parent_t
Definition: symbolic-calculus.hh:529
void impl_value(const ConfigurationIn_t arg)
Definition: symbolic-calculus.hh:503
Definition: symbolic-calculus.hh:119
CalculusBase< PointInJoint > Parent_t
Definition: symbolic-calculus.hh:592
Expression< LhsValue, RhsValue >::Ptr_t e_
Definition: symbolic-calculus.hh:432
void computeJacobian(const ConfigurationIn_t arg)
Definition: symbolic-calculus.hh:196
#define HPP_CONSTRAINTS_CB_DEFINE_OPERATOR2(op, OutType)
Definition: symbolic-calculus.hh:37
void invalidate()
Definition: symbolic-calculus.hh:381
const ComJacobian_t & jacobian() const
Definition: symbolic-calculus.hh:845
FunctionExp(const FunctionExp &other)
Definition: symbolic-calculus.hh:765
void computeCrossValue(const ConfigurationIn_t arg)
Definition: symbolic-calculus.hh:209
Definition: symbolic-calculus.hh:793
static Ptr_t create()
Definition: symbolic-calculus.hh:255
vector3_t local_
Definition: symbolic-calculus.hh:670
void setSize(std::size_t nRows, std::size_t nCols)
Definition: symbolic-calculus.hh:971
double theta_
Definition: symbolic-calculus.hh:913
const vector3_t & local() const
Definition: symbolic-calculus.hh:640
FunctionExp(const FunctionTypePtr_t &func)
Definition: symbolic-calculus.hh:772
Sum(const CalculusBase< Sum > &other)
Definition: symbolic-calculus.hh:450
void invalidate()
Definition: symbolic-calculus.hh:1102
RotationMultiply()
Definition: symbolic-calculus.hh:531
PointInJoint(const JointPtr_t &joint, const vector3_t &pointInLocalFrame)
Definition: symbolic-calculus.hh:614
CrossProduct(const CalculusBase< CrossProduct > &other)
Definition: symbolic-calculus.hh:312
Multiplication of an expression by a rotation matrix.
Definition: symbolic-calculus.hh:100
void invalidate()
Definition: symbolic-calculus.hh:574
Definition: symbolic-calculus.hh:866
const CenterOfMassComputationPtr_t & centerOfMassComputation() const
Definition: symbolic-calculus.hh:849
const JointPtr_t & joint() const
Definition: symbolic-calculus.hh:891
const CrossType & cross() const
Definition: symbolic-calculus.hh:206
bool center_
Definition: symbolic-calculus.hh:671
JointFrame(const Parent_t &other)
Definition: symbolic-calculus.hh:875
const vector3_t & value() const
Definition: symbolic-calculus.hh:842
void logSO3(const matrix3_t &R, value_type &theta, Eigen::MatrixBase< Derived > const &result)
Definition: tools.hh:48
HPP_CONSTRAINTS_CB_REF< Class > Ptr_t
Definition: symbolic-calculus.hh:107
CalculusBase< MatrixOfExpressions, Value_t, Jacobian_t > Parent_t
Definition: symbolic-calculus.hh:935
CalculusBase< PointCom, vector3_t, ComJacobian_t > Parent_t
Definition: symbolic-calculus.hh:828
Base class for classes representing an operation.
Definition: symbolic-calculus.hh:94
const JointPtr_t & joint() const
Definition: symbolic-calculus.hh:717
void computeSVD(const ConfigurationIn_t arg)
Definition: symbolic-calculus.hh:1026
JointPtr_t Ptr_t
Definition: symbolic-calculus.hh:115
Difference(const CalculusBase< Difference > &other)
Definition: symbolic-calculus.hh:406
pinocchio::size_type size_type
Definition: fwd.hh:35
RotationMultiply(const typename Traits< pinocchio::Joint >::Ptr_t &joint, const typename Traits< RhsValue >::Ptr_t &rhs, bool transpose=false)
Definition: symbolic-calculus.hh:548
Difference(const typename Traits< LhsValue >::Ptr_t &lhs, const typename Traits< RhsValue >::Ptr_t &rhs)
Definition: symbolic-calculus.hh:411
void impl_value(const ConfigurationIn_t arg)
Definition: symbolic-calculus.hh:554
JointTranspose Ptr_t
Definition: symbolic-calculus.hh:125
VectorInJoint(const CalculusBase< VectorInJoint > &other)
Definition: symbolic-calculus.hh:687
void impl_jacobian(const ConfigurationIn_t arg)
Definition: symbolic-calculus.hh:326
Definition: symbolic-calculus.hh:170
void impl_jacobian(const ConfigurationIn_t arg)
Definition: symbolic-calculus.hh:899
Expression< LhsValue, RhsValue >::Ptr_t e_
Definition: symbolic-calculus.hh:341
pinocchio::value_type value_type
Definition: fwd.hh:36
Expression(const Expression &other)
Definition: symbolic-calculus.hh:278
void impl_jacobian(const ConfigurationIn_t arg)
Definition: symbolic-calculus.hh:562
Traits< RhsValue >::Ptr_t rhs_
Definition: symbolic-calculus.hh:291
JointPtr_t joint_
Definition: symbolic-calculus.hh:912
void impl_value(const ConfigurationIn_t)
Definition: symbolic-calculus.hh:820
eigen::matrix3_t CrossMatrix
Definition: symbolic-calculus.hh:100
void impl_value(const ConfigurationIn_t)
Definition: symbolic-calculus.hh:894
boost::shared_ptr< FunctionType > FunctionTypePtr_t
Definition: symbolic-calculus.hh:755
void impl_jacobian(const ConfigurationIn_t arg)
Definition: symbolic-calculus.hh:507
JointFrame(const JointPtr_t &joint)
Definition: symbolic-calculus.hh:884
void impl_value(const ConfigurationIn_t arg)
Definition: symbolic-calculus.hh:987
JointTranspose(const JointPtr_t &joint)
Definition: symbolic-calculus.hh:120
CalculusBase< ScalarMultiply< RhsValue > > Parent_t
Definition: symbolic-calculus.hh:488
RotationMultiply(const CalculusBase< RotationMultiply > &other)
Definition: symbolic-calculus.hh:533
void init(const typename Traits< T >::Ptr_t &ptr)
Definition: symbolic-calculus.hh:223
void jacobianTimes(const ConfigurationIn_t arg, const Eigen::Ref< const Eigen::Matrix< value_type, Eigen::Dynamic, 1 > > &rhs, Eigen::Ref< Jacobian_t > cache) const
Definition: symbolic-calculus.hh:1065
ScalarProduct(const typename Traits< LhsValue >::Ptr_t &lhs, const typename Traits< RhsValue >::Ptr_t &rhs)
Definition: symbolic-calculus.hh:364
Basic expression representing a vector in a joint frame.
Definition: symbolic-calculus.hh:678
const JointPtr_t & joint() const
Definition: symbolic-calculus.hh:637
void impl_value(const ConfigurationIn_t arg)
Definition: symbolic-calculus.hh:368
MatrixOfExpressions(const MatrixOfExpressions &matrix)
Definition: symbolic-calculus.hh:961
CrossType cross_
Definition: symbolic-calculus.hh:219
Eigen::Matrix< value_type, Eigen::Dynamic, Eigen::Dynamic > Value_t
Definition: symbolic-calculus.hh:928
JointFrame(const JointFrame &jf)
Definition: symbolic-calculus.hh:880
JointTranspose WkPtr_t
Definition: symbolic-calculus.hh:126
JointPtr_t WkPtr_t
Definition: symbolic-calculus.hh:116
void impl_value(const ConfigurationIn_t arg)
Definition: symbolic-calculus.hh:459
const RhsValue & rhs() const
Definition: symbolic-calculus.hh:272
void impl_jacobian(const ConfigurationIn_t arg)
Definition: symbolic-calculus.hh:464
CrossProduct(const typename Traits< LhsValue >::Ptr_t &lhs, const typename Traits< RhsValue >::Ptr_t &rhs)
Definition: symbolic-calculus.hh:317
pinocchio::CenterOfMassComputationPtr_t CenterOfMassComputationPtr_t
Definition: fwd.hh:93
pinocchio::Transform3f Transform3f
Definition: fwd.hh:50
const ValueType & value() const
Definition: symbolic-calculus.hh:185
Expression< LhsValue, RhsValue >::Ptr_t e_
Definition: symbolic-calculus.hh:388
HPP_CONSTRAINTS_CB_WKREF< Class > WkPtr_t
Definition: symbolic-calculus.hh:108
CalculusBase< CrossProduct< LhsValue, RhsValue > > Parent_t
Definition: symbolic-calculus.hh:306
CalculusBase(const CalculusBase &o)
Definition: symbolic-calculus.hh:179
Vec3f o
PointInJoint(const PointInJoint &pointInJoint)
Definition: symbolic-calculus.hh:608
ScalarProduct(const CalculusBase< ScalarProduct > &other)
Definition: symbolic-calculus.hh:359