Using this package

How to use this package

General introduction

For control purposes the main use of this package is to create new entities and connect them through signals.

Objects, which are derived from Entities (base class dynamicgraph::Entity), can be declared within the code and compiled as shared libraries (.so/.dll files). These libraries can be loaded at run-time using the PluginLoader methods, and at the same time register their class names to the Factory (see the examples in the sot-core documentation for advanced control examples).

The Factory can then create instances of these objects and subsequently register them in the Pool. From the pool they can be listed, accessed, and acted upon (see PoolStorage documentation). Basic commands defined by entities include signal connection graph file generation, help and name print, and signals. This is usually done through a scripting language such as python (see dynamic-graph-python)

The singletons made available by including the corresponding headers in this module are:

For an example of a program creating entities in C++, see the unit test test_pool.cpp (in your package source directory/tests).

Tutorial

A tutorial is available here. It is providing a step-by-step way of building an entity

Helpers

When writing entities you might use some macros which are very useful to write your class.

Entity helpers

The header entity-helper.h is defining a type called EntityClassName

Macro helpers

Preprocessing macros for entities

Preprocessing macros for signals

  • Macro for input signals
    • DECLARE_SIGNAL_IN(signal_name,type): Declare an input time dependent signal as a field of the class with the following name:
      m_signal_nameSIN
    • CONSTRUCT_SIGNAL_IN(signal_name,type): This macro is used in the constructor of the entity class handling this signal. It is calling the signal constructor and set the signal name to:
      EntityClassName(entity-name)::input(type)::signal_name
  • Macro for output signals
    • DECLARE_SIGNAL_OUT(signal_name,type): Declare an output time dependent signal as a field of the class with the following name:
      m_signal_nameSOUT
      It also declares a method with the following pattern:
      type signal_nameSOUT_function(type &,int)
      The second pattern is the time when calling the output.
    • CONSTRUCT_SIGNAL_OUT(signal_name,type) This macro is used in the constructor of the entity class handling this signal. It creates the binding to the method described previously, and set the signal name to:

      EntityClassName(entity_name)::output(type)::signal_name

      where entity_name is the name of the entity currently instanciated.

    • DEFINE_SIGNAL_OUT_FUNCTION(signal_name, type): This macro is used when implementing the method specific to the output signal. It is used in the main body of the entity class to declare the header of the method with the following pattern:

      type
      EntityClassName::signal_nameSOUT_function(type &, int iter)

  • Inner signals
    • DECLARE_SIGNAL_INNER(signal_name,type) Inner signal are signal that depend on a state of the entity and not on input signals. This macro declares an inner signal with the following pattern:
      m_signal_nameSINNER
      It also creates a member function with the following pattern:
      type & EntityClassName::nameSINNER_function(signal_name)(type &, int)
    • DEFINE_SIGNAL_INNER_FUNCTION(signal_name,type) This macro is used to implement the method related to signal_name. More precisely it provides the header of the member function(i.e. method) declaration.
    • DECLARE_SIGNAL_INNER_FUNCTION(signal_name,type) This macros declares the member function used to handle the access to this signal.
compile.name
name
Definition: compile.py:23


dynamic-graph
Author(s): Nicolas Mansard, Olivier Stasse
autogenerated on Fri Aug 2 2024 08:36:38