sot-core  4.11.8
Hierarchical task solver plug-in for dynamic-graph.
memory-task-sot.hh
Go to the documentation of this file.
1 /*
2  * Copyright 2010,
3  * François Bleibel,
4  * Olivier Stasse,
5  *
6  * CNRS/AIST
7  *
8  */
9 
10 #ifndef __SOT_MEMORY_TASK_HH
11 #define __SOT_MEMORY_TASK_HH
12 
13 #include <sot/core/matrix-svd.hh>
15 
16 #include "sot/core/api.hh"
17 
18 /* --------------------------------------------------------------------- */
19 /* --- CLASS ----------------------------------------------------------- */
20 /* --------------------------------------------------------------------- */
21 
22 namespace dynamicgraph {
23 namespace sot {
24 
26  public: // protected:
27  typedef Eigen::Map<Matrix, Eigen::internal::traits<Matrix>::Alignment>
29  typedef Eigen::Map<const Matrix, Eigen::internal::traits<Matrix>::Alignment>
31 
32  /* Internal memory to reduce the dynamic allocation at task resolution. */
33  dynamicgraph::Vector err, tmpTask, tmpVar, tmpControl;
34  dynamicgraph::Matrix Jt; //( nJ,mJ );
35 
36  dynamicgraph::Matrix JK; //(nJ,mJ);
37 
40 
41  void resizeKernel(const Matrix::Index r, const Matrix::Index c) {
42  if (kernel.rows() != r || kernel.cols() != c) {
43  if (kernelMem.size() < r * c) kernelMem.resize(r, c);
44  new (&kernel) Kernel_t(kernelMem.data(), r, c);
45  }
46  }
47 
49  resizeKernel(r, c);
50  return kernel;
51  }
52 
53  public:
58  MemoryTaskSOT(const Matrix::Index nJ = 0, const Matrix::Index mJ = 0);
59 
60  void display(std::ostream &os) const;
61 
62  private:
63  void initMemory(const Matrix::Index nJ, const Matrix::Index mJ);
64 
65  Matrix kernelMem;
66 };
67 
68 } /* namespace sot */
69 } /* namespace dynamicgraph */
70 
71 #endif // __SOT_MEMORY_TASK_HH
#define SOT_CORE_EXPORT
Definition: api.hh:20
Definition: memory-task-sot.hh:25
Eigen::Map< const Matrix, Eigen::internal::traits< Matrix >::Alignment > KernelConst_t
Definition: memory-task-sot.hh:30
dynamicgraph::Matrix Jt
Definition: memory-task-sot.hh:34
SVD_t svd
Definition: memory-task-sot.hh:38
void resizeKernel(const Matrix::Index r, const Matrix::Index c)
Definition: memory-task-sot.hh:41
Eigen::Map< Matrix, Eigen::internal::traits< Matrix >::Alignment > Kernel_t
Definition: memory-task-sot.hh:28
dynamicgraph::Vector err
Definition: memory-task-sot.hh:33
void display(std::ostream &os) const
dynamicgraph::Matrix JK
Definition: memory-task-sot.hh:36
Kernel_t & getKernel(const Matrix::Index r, const Matrix::Index c)
Definition: memory-task-sot.hh:48
Kernel_t kernel
Definition: memory-task-sot.hh:39
MemoryTaskSOT(const Matrix::Index nJ=0, const Matrix::Index mJ=0)
Eigen::VectorXd::Index Index
Definition: robot-utils.hh:39
Definition: abstract-sot-external-interface.hh:17
Eigen::JacobiSVD< Matrix > SVD_t
Definition: matrix-svd.hh:23