You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The dynamic-graph package is used to connect computation nodes, "entities"
28
-
together using a graph system, akin to what Simulink does. With the building
29
-
blocks this package provides, you can easily create a full computation graph
30
+
together using a graph system, akin to what Simulink does. Entities are connected
31
+
through input and output signals.
32
+
With the building blocks this package provides, you can easily create a full computation graph
30
33
for a given problem. It is the basis for the stack of tasks operation.
31
34
32
-
\image html entity.png
33
-
Functionality:
34
-
\li Built-in scripting language* for fast prototyping and testing
35
+
36
+
\subsection controlgraph Exemple: Real-time control
37
+
38
+
<p>To give a more concrete example, the real-time control used by the Gepetto group for the humanoid robot HRP-2
39
+
is detailled.</p>
40
+
<p>
41
+
Real-time control system are usually driven by a cyclic computational node which
42
+
needs to send a control reference value to each motors of a robot. To compute this
43
+
control reference values, sensor values need to be provided.
44
+
In the Stack-Of-Tasks special entities called Device are used to
45
+
provide an abstract interface to the hardware.</p>
46
+
A scheme of the real-time control graph used for the humanoid robot HRP-2 is depicted in the following figure:
47
+
48
+
\image html Concept-Software-Fig.png
49
+
50
+
<p>The device therefore has a specific input which should contain the control vector.
51
+
This control vector is the result of a computation solving a control problem.
52
+
The entity in charge of solving this control problem is called "Solver" in the previous
53
+
figure.
54
+
In the SoT framework it is often cast as an optimization problem.
55
+
This optimization problem is build using a control "Task" (not to be confused with the
56
+
general word task). A control "Task" regulates the difference with a "Feature" computed
57
+
on the current robot state and a "Desired Feature". For instance when walking, the regulated
58
+
feature is the robot's Center-Of-Mass (CoM) position. The "Feature" is computed using a
59
+
library using the robot model and the sensor value. The entity making this computation is "Dyn".
60
+
A walking pattern generator using foot-steps position given in advance generates the desired
61
+
value for the CoM.
62
+
Note that the "Dyn" entity uses the sensor provided by the entity "Robot". </p>
63
+
64
+
<p>
65
+
From a pure computer science viewpoint we wish to avoid recomputing data such as articular Jacobians
66
+
when this is unnecessary. Therefore the data generated by an entity through signals may have two types of
67
+
dependencies: one dependency related to time and dependencies on other signals. Internally an entity
68
+
does not recompute the data if no new information is available, it is simply providing the same information
69
+
computed before. Please note that this package provides only the computational framework to realize
70
+
the data dependency and the entities. Solvers, libraries to compute mechanical quantities are provided
71
+
in different packages.
72
+
</p>
73
+
74
+
<p>
75
+
Finally in order to dynamically create a graph, it is possible \b on-line to load classes of entities and
76
+
create instances of entities.</p>
77
+
78
+
\subsection Functionnalities
79
+
80
+
\li Built-in scripting language* for fast prototyping and testing of computational graph
35
81
\li Support for extensions and modules using dynamic link libraries
36
82
\li Template-based signal definition, independent
37
83
\li Type-safe connection of input and output signals
38
84
\li On-demand signal computation as well as a caching system for signal values allow fast
39
85
computation of signal values, which is a critical point for real-time systems\n
40
86
See \ref scriptingabout
41
87
42
-
\section overview Code overview
43
-
This code implements the factory design pattern, making creation of entities
44
-
(as C++ classes) available to packages depending on the dynamic-graph API.
45
-
For more information on this package's code or how to develop your own entities,
46
-
see \ref usecase.
88
+
\section entity Computational Entity
89
+
\image html entity.png
90
+
91
+
\subsection entity_definition General definition
92
+
Despite the fact that it looks very similar to a ROS node or a CORBA/OpenRTM server, an entity is simply a C++ object.
93
+
The main idea is that this entity is providing mostly a data-driven functionnality working at very high rate (\f$ 200 Hz\f$ or \f$ 1 kHz \f$)
94
+
and should have a minimal computational time foot-print.
95
+
96
+
For this signals (or ports to use a more classical terminology) are providing a time dependency between data.
97
+
To implement this, an output signal is linked with a method of the entity. The method calls input signals or use other means
98
+
to get the needed data.
99
+
It might be provided by the connection with remote computers through a middleware, or specific protocols,
100
+
but in general the external data is based upon the sensor values provided by a "Device" entity.
101
+
For this reason the signal evaluations are realized through the cascade of dependencies and start from the evaluation of an input
102
+
signal of a periodic node (in general the device). This is realized inside a \b real-time thread.
103
+
104
+
To add flexibility to a node, it is possible to add command with arguments to modify the internal behavior of the entity
105
+
or get information from the entity.
106
+
As a command is in general asynchronous and rare with respect to the data-flow scheme for the signals the command is in general
107
+
executed in a \b none-real-time thread.
108
+
109
+
\subsection entity_classes Entity class
110
+
Entities are implemented as C++ classes and compiled as dynamic libraries. They can be loaded and instancied dynamically.
111
+
It is therefore necessary to specify the location of their dynamical libraries.
112
+
However given the time it might take to load the library, it is not advised to do that during a control-law computation.
113
+
Entity instanciation also implies memory allocation which is also time consuming and thus not advised inside a real-time thread.
47
114
115
+
The entities will be placed in ${PREFIX}/lib/plugin (since this may change, it is advised to
116
+
check the install log or the CMakeLists.txt file to check the installation path).
48
117
49
-
\section entities List of entities in this package
118
+
\subsection entities List of entities in this package
50
119
Since most of the functionality in projects using the dynamic-graph framework
51
120
is exposed from entities, here is a short description of all the entities contained in
52
121
this package. Note that most entities are contained in a binary file that closely matches
@@ -57,42 +126,46 @@ enable creation of this entity through the factory.
57
126
\li ShellProcedure
58
127
\li \ref shellfunctions_doc
59
128
60
-
The entities will be placed in ${PREFIX}/lib/plugin (since this may change, it is advised to
61
-
check the install log or the CMakeLists.txt file to check the installation path).
62
-
\section sigintro About signals
129
+
\subsection specific_semantics Specific semantics with entities
130
+
131
+
It is possible to derive classes and apply specific semantic for the entities. In our case we are interested in specific control semantics:
132
+
\li Tasks (more information <a href="http://stack-of-tasks.github.io/sot-core/doxygen/HEAD/a00089.html">here</a>)
133
+
\li Features (more information <a href="http://stack-of-tasks.github.io/sot-core/doxygen/HEAD/a00030.html">here</a>)
134
+
\li Solver (more information <a href="http://stack-of-tasks.github.io/sot-core/doxygen/HEAD/a00078.html">here</a>)
135
+
136
+
\section sigintro Signals
63
137
64
138
Entities can output different types of signals. All signals are templated by a Time
65
139
tick type parameter (which is used in the caching of signals) - usually \c int. Signals
66
140
are also templated after the type of data they accept or provide. For example:
67
141
(example)
68
142
For a more detailed programmer-oriented description of signals, please see \ref signals
69
143
70
-
\section scriptingabout Notes about the scripting language
71
-
The scripting language allows entities to define their own commands, and
72
-
provides a basic framework for working with the dynamic-graph.
73
-
At the time of writing, there is talk about replacing (or complementing) this limited
74
-
language with a python interpreter.
144
+
\section graph Graph
75
145
76
-
A couple of functions are built-in in the interpreter and provides low-level features such as file sourcing or
77
-
plug-in loading.\n
78
-
These functions are:\n
79
-
\code plug <obj1.sig1> <obj2.sig2> \endcode plugs the signal sig1 of obj1 to the signal sig2 of obj2. sig1 and sig2
80
-
have to be of the same type. sig1 has to be an output signal and sig2 an input signal.
81
-
\code new <class> <object> \endcode instantiates an object object of class class. object has to be a free identifier and
82
-
class an existing entity.
83
-
\code destroy <object> \endcode deletes an instance previously created.
84
-
\code run <script.txt> \endcode sources (i.e. read and interpret) an external file.
85
-
\code loadPlugin <file.so> <directory> \endcode loads a plugin called file.so and located in the directory directory.
86
-
\code unloadPlugin <path/file.so> \endcode unloads a plugin.
87
-
\code help \endcode lists available functions.
88
-
\code set <obj.signal> <value> \endcode defines an input signal to a specific, constant, value.
89
-
\code get <obj.signal> <value> \endcode prints out a signal value.
90
-
\code compute <obj.sig> <time> \endcode computes an output signal and sets the associated time to time.
146
+
In this package, the graph considered are directed graphs.
147
+
148
+
\subsection factory Factory
149
+
150
+
The class \ref dynamicgraph::FactoryStorage is a singleton which register the entity classes and which is allowing the instancation of such classes.
151
+
152
+
\subsection pool Pool
153
+
The class \ref dynamicgraph::PoolStorage keeps track of the entities instanciated with the factory.
154
+
The entities are the graph nodes. Signals are constructed during the class instanciation, they do not live independently
155
+
from the entities. Signals are the directed edges of the graph.
156
+
The pool can write a file representing the graph of entities.
157
+
158
+
\subsection scriptingabout Building the graph
159
+
160
+
This package provides a scripting language allows entities to define their own commands, and
161
+
provides a basic framework to build dynamically the computational graph.
162
+
However bindings have been created with python in the <a href="https://github.com/stack-of-tasks/dynamic-graph-python">dynamic-graph-python package</a>
163
+
and we strongly recommend to use this package instead of the in-house scripting language.
91
164
92
165
\section usecase How to use this package
93
-
1) Programmatically\n
166
+
\subsection use_programmtically Programmatically
94
167
Objects, which are derived from Entities (base class dynamicgraph::Entity), can be
95
-
declared within the code and compiled to shared libraries (.so/.dll files).
168
+
declared within the code and compiled to shared libraries (.so/.dll files).
96
169
These libraries can be loaded at run-time using the PluginLoader methods,
97
170
and at the same time register their class names to the Factory (see the
98
171
examples in the SOT documentation to learn how).
@@ -112,28 +185,54 @@ Some basic shell functions, and support for procedures, are also included.
112
185
For a complete list of those, load the plugin shell-functions.so and type 'help'
113
186
at the command line.
114
187
115
-
The (singletons made available by including the corresponding headers in this
188
+
The singletons made available by including the corresponding headers in this
116
189
module are:
117
190
\li dynamicgraph::FactoryStorage
118
191
\li dynamicgraph::PoolStorage
119
192
120
193
For an example of a program creating entities in C++, see the unit test
121
194
test_pool.cpp (in your package source directory/unitTesting).
122
195
123
-
2) Through scripts\n
196
+
\subsection use_scripts Through scripts
124
197
The program \ref dgshell_doc can be used to have scripting access to the dynamic-graph
125
198
library, where you can execute scripts and commands, load plugins, create entities and connect signals.
126
199
127
200
Here is a typical use case for programmers:
128
201
\image html figures/use-case.png
129
202
130
-
\section References
203
+
\section references References
204
+
\anchor Mansard2009
205
+
206
+
<b> "A versatile Generalized Inverted Kinematics implementation for collaborative working humanoid robots: The Stack Of Tasks"</b>,
207
+
<em>N. Mansard, O. Stasse, P. Evrard, A. Kheddar,</em>
208
+
Int. Conf. on Autonomous Robots, ICAR, 2009
209
+
131
210
\anchor Mansard2007
132
211
133
212
<b>"Task sequencing for sensor-based control"</b>,
134
213
<em>N. Mansard, F. Chaumette,</em>
135
214
IEEE Trans. on Robotics, 23(1):60-72, February 2007
136
215
216
+
\namespace dynamicgraph This is the namespace where every object and class of this library is located.
217
+
218
+
\defgroup gshellfunctions Notes about the scripting language
219
+
@{
220
+
A couple of functions are built-in in the interpreter and provides low-level features such as file sourcing or
221
+
plug-in loading.\n
222
+
These functions are:\n
223
+
\code plug <obj1.sig1> <obj2.sig2> \endcode plugs the signal sig1 of obj1 to the signal sig2 of obj2. sig1 and sig2
224
+
have to be of the same type. sig1 has to be an output signal and sig2 an input signal.
225
+
\code new <class> <object> \endcode instantiates an object object of class class. object has to be a free identifier and
226
+
class an existing entity.
227
+
\code destroy <object> \endcode deletes an instance previously created.
228
+
\code run <script.txt> \endcode sources (i.e. read and interpret) an external file.
229
+
\code loadPlugin <file.so> <directory> \endcode loads a plugin called file.so and located in the directory directory.
230
+
\code unloadPlugin <path/file.so> \endcode unloads a plugin.
231
+
\code help \endcode lists available functions.
232
+
\code set <obj.signal> <value> \endcode defines an input signal to a specific, constant, value.
233
+
\code get <obj.signal> <value> \endcode prints out a signal value.
234
+
\code compute <obj.sig> <time> \endcode computes an output signal and sets the associated time to time.
235
+
@}
137
236
138
237
\defgroup dgraph Core classes and objects
139
238
@{
@@ -180,5 +279,4 @@ computations, when accessed.
180
279
181
280
@}
182
281
183
-
\namespace dynamicgraph This is the namespace where every object and class of this library is located.
0 commit comments