Skip to content

Commit 6a78910

Browse files
[doc] Improve documentation.
1 parent 3c7460d commit 6a78910

File tree

4 files changed

+140
-41
lines changed

4 files changed

+140
-41
lines changed

doc/additionalDoc/dgshell_doc.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
2+
\ingroup gshellfunctions
33
\page dgshell_doc dg-shell executable
44
The dynamic-graph shell program "dg-shell" allows access to the dynamic-graph library's
55
Interpreter class, which can execute commands and scripts from the command line.

doc/additionalDoc/package.h

Lines changed: 138 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -22,31 +22,100 @@
2222
/**
2323
\mainpage
2424
25+
26+
2527
\section intro_dynamicGraph Introduction
2628
2729
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
3033
for a given problem. It is the basis for the stack of tasks operation.
3134
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
3581
\li Support for extensions and modules using dynamic link libraries
3682
\li Template-based signal definition, independent
3783
\li Type-safe connection of input and output signals
3884
\li On-demand signal computation as well as a caching system for signal values allow fast
3985
computation of signal values, which is a critical point for real-time systems\n
4086
See \ref scriptingabout
4187
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.
47114
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).
48117
49-
\section entities List of entities in this package
118+
\subsection entities List of entities in this package
50119
Since most of the functionality in projects using the dynamic-graph framework
51120
is exposed from entities, here is a short description of all the entities contained in
52121
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.
57126
\li ShellProcedure
58127
\li \ref shellfunctions_doc
59128
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
63137
64138
Entities can output different types of signals. All signals are templated by a Time
65139
tick type parameter (which is used in the caching of signals) - usually \c int. Signals
66140
are also templated after the type of data they accept or provide. For example:
67141
(example)
68142
For a more detailed programmer-oriented description of signals, please see \ref signals
69143
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
75145
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.
91164
92165
\section usecase How to use this package
93-
1) Programmatically\n
166+
\subsection use_programmtically Programmatically
94167
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).
96169
These libraries can be loaded at run-time using the PluginLoader methods,
97170
and at the same time register their class names to the Factory (see the
98171
examples in the SOT documentation to learn how).
@@ -112,28 +185,54 @@ Some basic shell functions, and support for procedures, are also included.
112185
For a complete list of those, load the plugin shell-functions.so and type 'help'
113186
at the command line.
114187
115-
The (singletons made available by including the corresponding headers in this
188+
The singletons made available by including the corresponding headers in this
116189
module are:
117190
\li dynamicgraph::FactoryStorage
118191
\li dynamicgraph::PoolStorage
119192
120193
For an example of a program creating entities in C++, see the unit test
121194
test_pool.cpp (in your package source directory/unitTesting).
122195
123-
2) Through scripts\n
196+
\subsection use_scripts Through scripts
124197
The program \ref dgshell_doc can be used to have scripting access to the dynamic-graph
125198
library, where you can execute scripts and commands, load plugins, create entities and connect signals.
126199
127200
Here is a typical use case for programmers:
128201
\image html figures/use-case.png
129202
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+
131210
\anchor Mansard2007
132211
133212
<b>"Task sequencing for sensor-based control"</b>,
134213
<em>N. Mansard, F. Chaumette,</em>
135214
IEEE Trans. on Robotics, 23(1):60-72, February 2007
136215
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+
@}
137236
138237
\defgroup dgraph Core classes and objects
139238
@{
@@ -180,5 +279,4 @@ computations, when accessed.
180279
181280
@}
182281
183-
\namespace dynamicgraph This is the namespace where every object and class of this library is located.
184282
*/

doc/additionalDoc/shellfunctions_doc.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/**
2+
\ingroup gshellfunctions
23
\page shellfunctions_doc ShellFunctions
34
\note Note: this documentation covers specific aspects of the in-house
45
scripting language currently used by the dynamic-graph script. Unless

doc/figures/Concept-Software-Fig.png

30.9 KB
Loading

0 commit comments

Comments
 (0)