task.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_TASK_H__
11 #define __SOT_TASK_H__
12 
13 /* --------------------------------------------------------------------- */
14 /* --- INCLUDE --------------------------------------------------------- */
15 /* --------------------------------------------------------------------- */
16 
17 /* Matrix */
18 #include <dynamic-graph/linear-algebra.h>
19 namespace dg = dynamicgraph;
20 
21 /* STD */
22 #include <string>
23 
24 /* SOT */
26 #include <sot/core/flags.hh>
28 
30 
31 /* --------------------------------------------------------------------- */
32 /* --- API ------------------------------------------------------------- */
33 /* --------------------------------------------------------------------- */
34 
35 #if defined(WIN32)
36 #if defined task_EXPORTS
37 #define SOTTASK_EXPORT __declspec(dllexport)
38 #else
39 #define SOTTASK_EXPORT __declspec(dllimport)
40 #endif
41 #else
42 #define SOTTASK_EXPORT
43 #endif
44 
45 /* --------------------------------------------------------------------- */
46 /* --- CLASS ----------------------------------------------------------- */
47 /* --------------------------------------------------------------------- */
71 namespace dynamicgraph {
72 namespace sot {
73 namespace dg = dynamicgraph;
74 
76 public:
77  typedef std::list<FeatureAbstract *> FeatureList_t;
78 
79 protected:
82 
83  DYNAMIC_GRAPH_ENTITY_DECL();
84 
85 public:
86  Task(const std::string &n);
87  void initCommands(void);
88 
89  void addFeature(FeatureAbstract &s);
90  void addFeatureFromName(const std::string &name);
91  void clearFeatureList(void);
92  FeatureList_t &getFeatureList(void) { return featureList; }
93 
94  void setControlSelection(const Flags &act);
95  void addControlSelection(const Flags &act);
96  void clearControlSelection(void);
97 
98  void setWithDerivative(const bool &s);
99  bool getWithDerivative(void);
100 
101  /* --- COMPUTATION --- */
102  dg::Vector &computeError(dg::Vector &error, int time);
103  VectorMultiBound &computeTaskExponentialDecrease(VectorMultiBound &errorRef,
104  int time);
105  dg::Matrix &computeJacobian(dg::Matrix &J, int time);
106  dg::Vector &computeErrorTimeDerivative(dg::Vector &res, int time);
107 
108  /* --- SIGNALS ------------------------------------------------------------ */
109 public:
110  dg::SignalPtr<double, int> controlGainSIN;
111  dg::SignalPtr<double, int> dampingGainSINOUT;
112  dg::SignalPtr<Flags, int> controlSelectionSIN;
113  dg::SignalTimeDependent<dg::Vector, int> errorSOUT;
114  dg::SignalTimeDependent<dg::Vector, int> errorTimeDerivativeSOUT;
115 
116  /* --- DISPLAY ------------------------------------------------------------ */
117  void display(std::ostream &os) const;
118 
119  /* --- Writing graph --- */
120  virtual std::ostream &writeGraph(std::ostream &os) const;
121 };
122 
123 } /* namespace sot */
124 } /* namespace dynamicgraph */
125 
126 #endif /* #ifndef __SOT_TASK_H__ */
dynamicgraph::sot::Task::controlSelectionSIN
dg::SignalPtr< Flags, int > controlSelectionSIN
Definition: task.hh:112
dynamicgraph::sot::Task::FeatureList_t
std::list< FeatureAbstract * > FeatureList_t
Definition: task.hh:77
dynamicgraph::sot::Task::withDerivative
bool withDerivative
Definition: task.hh:81
dynamicgraph
Definition: abstract-sot-external-interface.hh:17
dynamicgraph::sot::Task::errorSOUT
dg::SignalTimeDependent< dg::Vector, int > errorSOUT
Definition: task.hh:113
dynamicgraph::sot::VectorMultiBound
std::vector< MultiBound > VectorMultiBound
Definition: multi-bound.hh:68
feature-abstract.hh
dynamicgraph::sot::TaskAbstract
Definition: task-abstract.hh:49
dynamicgraph::sot::FeatureAbstract
This class gives the abstract definition of a feature.
Definition: feature-abstract.hh:76
dynamicgraph::sot::Task::featureList
FeatureList_t featureList
Definition: task.hh:80
dynamicgraph::sot::Task::controlGainSIN
dg::SignalPtr< double, int > controlGainSIN
Definition: task.hh:110
dynamicgraph::sot::Task::dampingGainSINOUT
dg::SignalPtr< double, int > dampingGainSINOUT
Definition: task.hh:111
dynamicgraph::sot::Task::getFeatureList
FeatureList_t & getFeatureList(void)
Definition: task.hh:92
SOTTASK_EXPORT
#define SOTTASK_EXPORT
Definition: task.hh:42
dynamicgraph::sot::Task::errorTimeDerivativeSOUT
dg::SignalTimeDependent< dg::Vector, int > errorTimeDerivativeSOUT
Definition: task.hh:114
flags.hh
exception-task.hh
dynamicgraph::sot::Task
Class that defines the basic elements of a task.
Definition: task.hh:75
task-abstract.hh
dynamicgraph::sot::Flags
Definition: flags.hh:31