Line |
Branch |
Exec |
Source |
1 |
|
|
/* |
2 |
|
|
* Copyright 2010, |
3 |
|
|
* François Bleibel, |
4 |
|
|
* Olivier Stasse, |
5 |
|
|
* |
6 |
|
|
* CNRS/AIST |
7 |
|
|
* |
8 |
|
|
*/ |
9 |
|
|
|
10 |
|
|
#ifndef __SOT_TASKABSTRACT_H__ |
11 |
|
|
#define __SOT_TASKABSTRACT_H__ |
12 |
|
|
|
13 |
|
|
/* --------------------------------------------------------------------- */ |
14 |
|
|
/* --- INCLUDE --------------------------------------------------------- */ |
15 |
|
|
/* --------------------------------------------------------------------- */ |
16 |
|
|
|
17 |
|
|
/* Matrix */ |
18 |
|
|
#include <dynamic-graph/linear-algebra.h> |
19 |
|
|
|
20 |
|
|
#include <Eigen/SVD> |
21 |
|
|
|
22 |
|
|
/* STD */ |
23 |
|
|
#include <string> |
24 |
|
|
|
25 |
|
|
/* SOT */ |
26 |
|
|
#include <dynamic-graph/all-signals.h> |
27 |
|
|
#include <dynamic-graph/entity.h> |
28 |
|
|
|
29 |
|
|
#include <sot/core/multi-bound.hh> |
30 |
|
|
|
31 |
|
|
#include "sot/core/api.hh" |
32 |
|
|
|
33 |
|
|
/* --------------------------------------------------------------------- */ |
34 |
|
|
/* --- CLASS ----------------------------------------------------------- */ |
35 |
|
|
/* --------------------------------------------------------------------- */ |
36 |
|
|
|
37 |
|
|
namespace dynamicgraph { |
38 |
|
|
namespace sot { |
39 |
|
|
|
40 |
|
|
/// Hierarchical element of the stack of tasks. |
41 |
|
|
/// |
42 |
|
|
/// A task computes a value and a Jacobian as output signals. |
43 |
|
|
/// Once stacked into a solver, the solver will compute the control |
44 |
|
|
/// vector that makes the task values converge toward zero in the |
45 |
|
|
/// order defined by the priority levels. |
46 |
|
|
/// |
47 |
|
|
/// \image html pictures/task.png "Task diagram: Task types derive from |
48 |
|
|
/// TaskAbstract. The value and Jacobian of a Task are computed from the |
49 |
|
|
/// features that are stored in the task. |
50 |
|
|
|
51 |
|
|
class SOT_CORE_EXPORT TaskAbstract : public dynamicgraph::Entity { |
52 |
|
|
public: |
53 |
|
|
/* Use a derivative of this class to store computational memory. */ |
54 |
|
|
class MemoryTaskAbstract { |
55 |
|
|
public: |
56 |
|
|
int timeLastChange; |
57 |
|
|
|
58 |
|
|
public: |
59 |
|
✗ |
MemoryTaskAbstract(void) : timeLastChange(0){}; |
60 |
|
✗ |
virtual ~MemoryTaskAbstract(void){}; |
61 |
|
|
|
62 |
|
|
public: |
63 |
|
|
virtual void display(std::ostream &os) const = 0; |
64 |
|
|
friend std::ostream &operator<<(std::ostream &os, |
65 |
|
|
const MemoryTaskAbstract &tcm) { |
66 |
|
|
tcm.display(os); |
67 |
|
|
return os; |
68 |
|
|
} |
69 |
|
|
}; |
70 |
|
|
|
71 |
|
|
public: |
72 |
|
|
MemoryTaskAbstract *memoryInternal; |
73 |
|
|
|
74 |
|
|
protected: |
75 |
|
|
void taskRegistration(void); |
76 |
|
|
|
77 |
|
|
public: |
78 |
|
|
TaskAbstract(const std::string &n); |
79 |
|
|
|
80 |
|
|
public: /* --- SIGNALS --- */ |
81 |
|
|
dynamicgraph::SignalTimeDependent<VectorMultiBound, int> taskSOUT; |
82 |
|
|
dynamicgraph::SignalTimeDependent<dynamicgraph::Matrix, int> jacobianSOUT; |
83 |
|
|
}; |
84 |
|
|
|
85 |
|
|
} /* namespace sot */ |
86 |
|
|
} /* namespace dynamicgraph */ |
87 |
|
|
|
88 |
|
|
#endif /* #ifndef __SOT_TASKABSTRACT_H__ */ |
89 |
|
|
|