Unverified Commit 73ec4a43 authored by Guilhem Saurel's avatar Guilhem Saurel Committed by GitHub
Browse files

Merge pull request #10 from nim65s/devel

format
parents e60289d4 8b1594ef
Pipeline #18176 failed
# format (Guilhem Saurel, 2022-04-05)
4f6fe74a60b3f740a598fe0059db2c1c7f1fe174
repos:
- repo: https://github.com/pre-commit/mirrors-clang-format
rev: v13.0.1
hooks:
- id: clang-format
args: [-i, --style=Google]
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.1.0
hooks:
- id: check-added-large-files
- id: check-ast
- id: check-executables-have-shebangs
- id: check-json
- id: check-merge-conflict
- id: check-symlinks
- id: check-toml
- id: check-yaml
- id: debug-statements
- id: destroyed-symlinks
- id: detect-private-key
- id: end-of-file-fixer
- id: fix-byte-order-marker
- id: mixed-line-ending
- id: trailing-whitespace
- repo: https://github.com/psf/black
rev: 22.3.0
hooks:
- id: black
- repo: https://github.com/PyCQA/flake8
rev: 4.0.1
hooks:
- id: flake8
...@@ -56,8 +56,8 @@ SET(${PROJECT_NAME}_HEADERS ...@@ -56,8 +56,8 @@ SET(${PROJECT_NAME}_HEADERS
) )
SET(${PROJECT_NAME}_SOURCES SET(${PROJECT_NAME}_SOURCES
src/inverted-pendulum src/inverted-pendulum.cpp
src/feedback-controller src/feedback-controller.cpp
) )
ADD_LIBRARY(${PROJECT_NAME} SHARED ADD_LIBRARY(${PROJECT_NAME} SHARED
......
...@@ -2,8 +2,9 @@ ...@@ -2,8 +2,9 @@
[![License](https://img.shields.io/badge/License-BSD%202--Clause-orange.svg)](https://opensource.org/licenses/BSD-2-Clause) [![License](https://img.shields.io/badge/License-BSD%202--Clause-orange.svg)](https://opensource.org/licenses/BSD-2-Clause)
[![Pipeline status](https://gitlab.laas.fr/stack-of-tasks/dynamic-graph-tutorial/badges/master/pipeline.svg)](https://gitlab.laas.fr/stack-of-tasks/dynamic-graph-tutorial/commits/master) [![Pipeline status](https://gitlab.laas.fr/stack-of-tasks/dynamic-graph-tutorial/badges/master/pipeline.svg)](https://gitlab.laas.fr/stack-of-tasks/dynamic-graph-tutorial/commits/master)
[![Coverage report](https://gitlab.laas.fr/stack-of-tasks/dynamic-graph-tutorial/badges/master/coverage.svg?job=doc-coverage)](http://projects.laas.fr/gepetto/doc/stack-of-tasks/dynamic-graph-tutorial/master/coverage/) [![Coverage report](https://gitlab.laas.fr/stack-of-tasks/dynamic-graph-tutorial/badges/master/coverage.svg?job=doc-coverage)](https://gepettoweb.laas.fr/doc/stack-of-tasks/dynamic-graph-tutorial/master/coverage/)
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
[![pre-commit.ci status](https://results.pre-commit.ci/badge/github/stack-of-tasks/dynamic-graph-tutorial/master.svg)](https://results.pre-commit.ci/latest/github/stack-of-tasks/dynamic-graph-tutorial)
See INSTALL for installation instruction. See INSTALL for installation instruction.
......
Subproject commit 7e797cbcae0947acce802c0bc63765a2b7c75828 Subproject commit 3d6176d439963702d97b82555e3007de05a4e6a4
...@@ -8,4 +8,3 @@ ...@@ -8,4 +8,3 @@
</center> </center>
</body> </body>
</head> </head>
...@@ -4,4 +4,3 @@ ...@@ -4,4 +4,3 @@
<LINK HREF="package.css" REL="stylesheet" TYPE="text/css"> <LINK HREF="package.css" REL="stylesheet" TYPE="text/css">
</HEAD> </HEAD>
<BODY> <BODY>
...@@ -45,8 +45,8 @@ a:link { ...@@ -45,8 +45,8 @@ a:link {
color:#0066CC color:#0066CC
} }
a:hover, a:active { a:hover, a:active {
text-decoration: underline; text-decoration: underline;
color: #3C9A35; color: #3C9A35;
} }
...@@ -57,7 +57,7 @@ a:visited { ...@@ -57,7 +57,7 @@ a:visited {
} }
DIV.memitem DIV.memitem
{ {
spacing: 10px; spacing: 10px;
width:100%; width:100%;
background:#FFFFFF; background:#FFFFFF;
...@@ -70,7 +70,7 @@ DIV.memitem ...@@ -70,7 +70,7 @@ DIV.memitem
} }
DIV.memproto DIV.memproto
{ {
width:100%; width:100%;
background:#F0F0F0; background:#F0F0F0;
font-size:100%; font-size:100%;
...@@ -82,7 +82,7 @@ DIV.memproto ...@@ -82,7 +82,7 @@ DIV.memproto
} }
DIV.memdoc DIV.memdoc
{ {
padding: 10px; padding: 10px;
width:100%; width:100%;
font-size:100%; font-size:100%;
...@@ -189,7 +189,7 @@ DIV.nav ...@@ -189,7 +189,7 @@ DIV.nav
} }
DIV.groupHeader DIV.groupHeader
{ {
padding-top: 30px; padding-top: 30px;
padding-bottom: 20px; padding-bottom: 20px;
background : none; background : none;
...@@ -214,23 +214,23 @@ DIV.fragment ...@@ -214,23 +214,23 @@ DIV.fragment
-moz-border-radius: 8px 8px 8px 8px; -moz-border-radius: 8px 8px 8px 8px;
} }
.directory p .directory p
{ {
margin: 0px; margin: 0px;
white-space: nowrap; white-space: nowrap;
font-family: 'Lucida Grande','Lucida Sans Unicode',Verdana,Sans-Serif; font-family: 'Lucida Grande','Lucida Sans Unicode',Verdana,Sans-Serif;
font-size: 10pt; font-size: 10pt;
font-weight: normal; font-weight: normal;
} }
.directory h3 .directory h3
{ {
font-family: 'Lucida Grande','Lucida Sans Unicode',Verdana,Sans-Serif; font-family: 'Lucida Grande','Lucida Sans Unicode',Verdana,Sans-Serif;
margin: 0px; margin: 0px;
margin-top: 1em; margin-top: 1em;
padding-bottom: 20px; padding-bottom: 20px;
font-size: 12pt; font-size: 12pt;
font-variant: small-caps; font-variant: small-caps;
text-align: center; text-align: center;
} }
...@@ -240,4 +240,3 @@ DIV.fragment ...@@ -240,4 +240,3 @@ DIV.fragment
text-decoration: none; text-decoration: none;
color:#0066CC color:#0066CC
} }
...@@ -23,8 +23,8 @@ ABBREVIATE_BRIEF = "The $name class" \ ...@@ -23,8 +23,8 @@ ABBREVIATE_BRIEF = "The $name class" \
ALWAYS_DETAILED_SEC = YES ALWAYS_DETAILED_SEC = YES
INLINE_INHERITED_MEMB = NO INLINE_INHERITED_MEMB = NO
FULL_PATH_NAMES = NO FULL_PATH_NAMES = NO
STRIP_FROM_PATH = STRIP_FROM_PATH =
STRIP_FROM_INC_PATH = STRIP_FROM_INC_PATH =
SHORT_NAMES = NO SHORT_NAMES = NO
JAVADOC_AUTOBRIEF = YES JAVADOC_AUTOBRIEF = YES
MULTILINE_CPP_IS_BRIEF = NO MULTILINE_CPP_IS_BRIEF = NO
...@@ -49,7 +49,7 @@ SORT_MEMBER_DOCS = YES ...@@ -49,7 +49,7 @@ SORT_MEMBER_DOCS = YES
SORT_BRIEF_DOCS = NO SORT_BRIEF_DOCS = NO
SORT_BY_SCOPE_NAME = NO SORT_BY_SCOPE_NAME = NO
MAX_INITIALIZER_LINES = 30 MAX_INITIALIZER_LINES = 30
FILE_VERSION_FILTER = FILE_VERSION_FILTER =
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
# configuration options related to warning and progress messages # configuration options related to warning and progress messages
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
...@@ -59,18 +59,18 @@ WARN_IF_UNDOCUMENTED = YES ...@@ -59,18 +59,18 @@ WARN_IF_UNDOCUMENTED = YES
WARN_IF_DOC_ERROR = YES WARN_IF_DOC_ERROR = YES
WARN_NO_PARAMDOC = NO WARN_NO_PARAMDOC = NO
WARN_FORMAT = "$file:$line: $text" WARN_FORMAT = "$file:$line: $text"
WARN_LOGFILE = WARN_LOGFILE =
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
# configuration options related to the input files # configuration options related to the input files
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
RECURSIVE = YES RECURSIVE = YES
EXCLUDE = EXCLUDE =
EXCLUDE_SYMLINKS = NO EXCLUDE_SYMLINKS = NO
EXAMPLE_PATH = EXAMPLE_PATH =
EXAMPLE_PATTERNS = * EXAMPLE_PATTERNS = *
EXAMPLE_RECURSIVE = NO EXAMPLE_RECURSIVE = NO
INPUT_FILTER = INPUT_FILTER =
FILTER_PATTERNS = FILTER_PATTERNS =
FILTER_SOURCE_FILES = NO FILTER_SOURCE_FILES = NO
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
# configuration options related to source browsing # configuration options related to source browsing
...@@ -80,7 +80,7 @@ FILTER_SOURCE_FILES = NO ...@@ -80,7 +80,7 @@ FILTER_SOURCE_FILES = NO
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
ALPHABETICAL_INDEX = NO ALPHABETICAL_INDEX = NO
COLS_IN_ALPHA_INDEX = 5 COLS_IN_ALPHA_INDEX = 5
IGNORE_PREFIX = IGNORE_PREFIX =
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
# configuration options related to the HTML output # configuration options related to the HTML output
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
...@@ -88,8 +88,8 @@ GENERATE_HTML = YES ...@@ -88,8 +88,8 @@ GENERATE_HTML = YES
HTML_FILE_EXTENSION = .html HTML_FILE_EXTENSION = .html
HTML_ALIGN_MEMBERS = YES HTML_ALIGN_MEMBERS = YES
GENERATE_HTMLHELP = NO GENERATE_HTMLHELP = NO
CHM_FILE = CHM_FILE =
HHC_LOCATION = HHC_LOCATION =
GENERATE_CHI = NO GENERATE_CHI = NO
BINARY_TOC = NO BINARY_TOC = NO
TOC_EXPAND = YES TOC_EXPAND = YES
...@@ -105,8 +105,8 @@ LATEX_CMD_NAME = latex ...@@ -105,8 +105,8 @@ LATEX_CMD_NAME = latex
MAKEINDEX_CMD_NAME = makeindex MAKEINDEX_CMD_NAME = makeindex
COMPACT_LATEX = NO COMPACT_LATEX = NO
PAPER_TYPE = a4wide PAPER_TYPE = a4wide
EXTRA_PACKAGES = EXTRA_PACKAGES =
LATEX_HEADER = LATEX_HEADER =
PDF_HYPERLINKS = NO PDF_HYPERLINKS = NO
USE_PDFLATEX = NO USE_PDFLATEX = NO
LATEX_BATCHMODE = NO LATEX_BATCHMODE = NO
...@@ -118,8 +118,8 @@ FORMULA_FONTSIZE = 16 ...@@ -118,8 +118,8 @@ FORMULA_FONTSIZE = 16
RTF_OUTPUT = rtf RTF_OUTPUT = rtf
COMPACT_RTF = NO COMPACT_RTF = NO
RTF_HYPERLINKS = NO RTF_HYPERLINKS = NO
RTF_STYLESHEET_FILE = RTF_STYLESHEET_FILE =
RTF_EXTENSIONS_FILE = RTF_EXTENSIONS_FILE =
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
# configuration options related to the man page output # configuration options related to the man page output
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
...@@ -130,8 +130,8 @@ MAN_LINKS = NO ...@@ -130,8 +130,8 @@ MAN_LINKS = NO
# configuration options related to the XML output # configuration options related to the XML output
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
XML_OUTPUT = xml XML_OUTPUT = xml
XML_SCHEMA = XML_SCHEMA =
XML_DTD = XML_DTD =
XML_PROGRAMLISTING = YES XML_PROGRAMLISTING = YES
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
# configuration options for the AutoGen Definitions output # configuration options for the AutoGen Definitions output
...@@ -142,20 +142,20 @@ GENERATE_AUTOGEN_DEF = NO ...@@ -142,20 +142,20 @@ GENERATE_AUTOGEN_DEF = NO
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
PERLMOD_LATEX = NO PERLMOD_LATEX = NO
PERLMOD_PRETTY = YES PERLMOD_PRETTY = YES
PERLMOD_MAKEVAR_PREFIX = PERLMOD_MAKEVAR_PREFIX =
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
# Configuration options related to the preprocessor # Configuration options related to the preprocessor
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
ENABLE_PREPROCESSING = YES ENABLE_PREPROCESSING = YES
MACRO_EXPANSION = YES MACRO_EXPANSION = YES
EXPAND_ONLY_PREDEF = YES EXPAND_ONLY_PREDEF = YES
SEARCH_INCLUDES = YES SEARCH_INCLUDES = YES
INCLUDE_PATH = INCLUDE_PATH =
INCLUDE_FILE_PATTERNS = INCLUDE_FILE_PATTERNS =
EXPAND_AS_DEFINED = EXPAND_AS_DEFINED =
SKIP_FUNCTION_MACROS = YES SKIP_FUNCTION_MACROS = YES
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
# Configuration::additions related to external references # Configuration::additions related to external references
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
TAGFILES = \ TAGFILES = \
${DYNAMIC_GRAPH_PYTHON_DOCDIR}/html/dynamic-graph-python.doxytag=${DYNAMIC_GRAPH_PYTHON_DOCDIR}/html \ ${DYNAMIC_GRAPH_PYTHON_DOCDIR}/html/dynamic-graph-python.doxytag=${DYNAMIC_GRAPH_PYTHON_DOCDIR}/html \
...@@ -165,10 +165,10 @@ ALLEXTERNALS = NO ...@@ -165,10 +165,10 @@ ALLEXTERNALS = NO
EXTERNAL_GROUPS = YES EXTERNAL_GROUPS = YES
PERL_PATH = /usr/bin/perl PERL_PATH = /usr/bin/perl
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
# Configuration options related to the dot tool # Configuration options related to the dot tool
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
# Configuration::additions related to the search engine # Configuration::additions related to the search engine
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
SEARCHENGINE = NO SEARCHENGINE = NO
...@@ -197,7 +197,7 @@ GENERATE_TODOLIST = YES ...@@ -197,7 +197,7 @@ GENERATE_TODOLIST = YES
GENERATE_TESTLIST = NO GENERATE_TESTLIST = NO
GENERATE_BUGLIST = NO GENERATE_BUGLIST = NO
GENERATE_DEPRECATEDLIST= YES GENERATE_DEPRECATEDLIST= YES
ENABLED_SECTIONS = ENABLED_SECTIONS =
SHOW_USED_FILES = NO SHOW_USED_FILES = NO
SHOW_DIRECTORIES = NO SHOW_DIRECTORIES = NO
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
...@@ -207,7 +207,7 @@ SHOW_DIRECTORIES = NO ...@@ -207,7 +207,7 @@ SHOW_DIRECTORIES = NO
# configuration options related to the input files # configuration options related to the input files
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
FILE_PATTERNS = *.hh *.idl FILE_PATTERNS = *.hh *.idl
EXCLUDE_PATTERNS = EXCLUDE_PATTERNS =
INPUT = ${${PROJECT_NAME}_SOURCE_DIR}/include \ INPUT = ${${PROJECT_NAME}_SOURCE_DIR}/include \
${CMAKE_CURRENT_SOURCE_DIR}/additionalDoc ${CMAKE_CURRENT_SOURCE_DIR}/additionalDoc
...@@ -261,13 +261,13 @@ GENERATE_AUTOGEN_DEF = NO ...@@ -261,13 +261,13 @@ GENERATE_AUTOGEN_DEF = NO
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
GENERATE_PERLMOD = NO GENERATE_PERLMOD = NO
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
# Configuration options related to the preprocessor # Configuration options related to the preprocessor
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
# Configuration::additions related to external references # Configuration::additions related to external references
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
# Configuration options related to the dot tool # Configuration options related to the dot tool
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
CLASS_DIAGRAMS = YES CLASS_DIAGRAMS = YES
HIDE_UNDOC_RELATIONS = YES HIDE_UNDOC_RELATIONS = YES
...@@ -283,8 +283,8 @@ CALL_GRAPH = NO ...@@ -283,8 +283,8 @@ CALL_GRAPH = NO
GRAPHICAL_HIERARCHY = YES GRAPHICAL_HIERARCHY = YES
DIRECTORY_GRAPH = YES DIRECTORY_GRAPH = YES
DOT_IMAGE_FORMAT = png DOT_IMAGE_FORMAT = png
DOT_PATH = DOT_PATH =
DOTFILE_DIRS = DOTFILE_DIRS =
MAX_DOT_GRAPH_DEPTH = 1000 MAX_DOT_GRAPH_DEPTH = 1000
DOT_TRANSPARENT = NO DOT_TRANSPARENT = NO
DOT_MULTI_TARGETS = YES DOT_MULTI_TARGETS = YES
......
...@@ -11,7 +11,8 @@ As an example, we review below class dynamicgraph::tutorial::InvertedPendulum. ...@@ -11,7 +11,8 @@ As an example, we review below class dynamicgraph::tutorial::InvertedPendulum.
\section dg_tutorial_inverted_pendulum_cxx_interface Interface \section dg_tutorial_inverted_pendulum_cxx_interface Interface
The interface is defined in file <c>include/dynamic-graph/tutorial/inverted-pendulum.hh</c>. The interface is defined in file
<c>include/dynamic-graph/tutorial/inverted-pendulum.hh</c>.
First, we include First, we include
\li the header defining Entity class and \li the header defining Entity class and
...@@ -20,8 +21,8 @@ First, we include ...@@ -20,8 +21,8 @@ First, we include
\code \code
#include <dynamic-graph/entity.h> #include <dynamic-graph/entity.h>
#include <dynamic-graph/signal-ptr.h>
#include <dynamic-graph/linear-algebra.h> #include <dynamic-graph/linear-algebra.h>
#include <dynamic-graph/signal-ptr.h>
\endcode \endcode
Then in namespace <c>dynamicgraph::tutorial</c> we define class InvertedPendulum Then in namespace <c>dynamicgraph::tutorial</c> we define class InvertedPendulum
...@@ -108,14 +109,16 @@ First, we include headers defining ...@@ -108,14 +109,16 @@ First, we include headers defining
\subsection dg_tutorial_inverted_pendulum_cxx_implementation_headers Headers \subsection dg_tutorial_inverted_pendulum_cxx_implementation_headers Headers
\code \code
#include <dynamic-graph/factory.h>
#include <dynamic-graph/command-setter.h>
#include <dynamic-graph/command-getter.h> #include <dynamic-graph/command-getter.h>
#include "dynamic-graph/tutorial/inverted-pendulum.hh" #include <dynamic-graph/command-setter.h>
#include <dynamic-graph/factory.h>
#include "command-increment.hh" #include "command-increment.hh"
#include "dynamic-graph/tutorial/inverted-pendulum.hh"
\endcode \endcode
\subsection dg_tutorial_inverted_pendulum_cxx_implementation_entity_registration Entity registration \subsection dg_tutorial_inverted_pendulum_cxx_implementation_entity_registration
Entity registration
The second step consists in The second step consists in
\li registering our new class into the entity factory and \li registering our new class into the entity factory and
...@@ -130,7 +133,8 @@ using a macro defined in <c>dynamic-graph/factory.h</c>: ...@@ -130,7 +133,8 @@ using a macro defined in <c>dynamic-graph/factory.h</c>:
\li the name of the type of the corresponding python class. It is highly \li the name of the type of the corresponding python class. It is highly
recommended to use the same name for both. recommended to use the same name for both.
\subsection dg_tutorial_inverted_pendulum_cxx_implementation_constructor Constructor \subsection dg_tutorial_inverted_pendulum_cxx_implementation_constructor
Constructor
Then we define the class constructor Then we define the class constructor
\li passing the instance name to Entity class constructor, \li passing the instance name to Entity class constructor,
...@@ -160,10 +164,9 @@ We set input and output signal as constant with a given value ...@@ -160,10 +164,9 @@ We set input and output signal as constant with a given value
\endcode \endcode
The following lines of code define and register commands into the entity. The following lines of code define and register commands into the entity.
A \ref dynamicgraph::command::Command "command" is created by calling a constructor with A \ref dynamicgraph::command::Command "command" is created by calling a
\li a string: the name of the command, constructor with \li a string: the name of the command, \li a pointer to a newly
\li a pointer to a newly created command and created command and \li a string documenting the command:
\li a string documenting the command:
\code \code
std::string docstring; std::string docstring;
...@@ -180,10 +183,12 @@ A \ref dynamicgraph::command::Command "command" is created by calling a construc ...@@ -180,10 +183,12 @@ A \ref dynamicgraph::command::Command "command" is created by calling a construc
\endcode \endcode
In this example, command::Increment is a command specific to our class In this example, command::Increment is a command specific to our class
InvertedPendulum. This new command is explained in page \ref dg_tutorial_inverted_pendulum_command. InvertedPendulum. This new command is explained in page \ref
dg_tutorial_inverted_pendulum_command.
Setter and getter commands are available through classes templated by the type of entity using the command and the type Setter and getter commands are available through classes templated by the type
of the parameter. Be aware that only a prespecified set of types are supported for commands, see class of entity using the command and the type of the parameter. Be aware that only a
prespecified set of types are supported for commands, see class
dynamicgraph::command::Value. \code docstring = dynamicgraph::command::Value. \code docstring =
"\n" "\n"
" Set cart mass\n" " Set cart mass\n"
...@@ -203,18 +208,22 @@ dynamicgraph::command::Value. \code docstring = ...@@ -203,18 +208,22 @@ dynamicgraph::command::Value. \code docstring =
\note \note
It is important to notice that It is important to notice that
\li commands passed to method Entity::addCommand will be destroyed automatically by Entity class destructor. The user \li commands passed to method Entity::addCommand will be destroyed automatically
should therefore not destroy them, \li commands should be defined and registered in the class constructor. Commands by Entity class destructor. The user should therefore not destroy them, \li
commands should be defined and registered in the class constructor. Commands
defined later on will not be reachable by python bindings. defined later on will not be reachable by python bindings.
\subsection dg_tutorial_inverted_pendulum_cxx_implementation_newtypes Registering new types: advanced feature \subsection dg_tutorial_inverted_pendulum_cxx_implementation_newtypes
Registering new types: advanced feature
Signals are templated by the type of data they convey. In this example, we hae defined our own class of vectors Signals are templated by the type of data they convey. In this example, we hae
InvertedPendulum::Vector. In order to be able to create signals with this type, we need to register the new type: \code defined our own class of vectors InvertedPendulum::Vector. In order to be able
to create signals with this type, we need to register the new type: \code
dynamicgraph::DefaultCastRegisterer<InvertedPendulum::Vector> IPVectorCast; dynamicgraph::DefaultCastRegisterer<InvertedPendulum::Vector> IPVectorCast;
\endcode \endcode
\note \note
The new type should implement operator<< and operator>> in order to store variables in streams. The new type should implement operator<< and operator>> in order to store
variables in streams.
*/ */
...@@ -23,11 +23,12 @@ We first define the new class by deriving dynamicgraph::command::Command: ...@@ -23,11 +23,12 @@ We first define the new class by deriving dynamicgraph::command::Command:
The constructor takes The constructor takes
\li a reference to a InvertedPendulum and calls parent class, \li a reference to a InvertedPendulum and calls parent class,
\li a vector a types specifying the number and types of input arguments of the command and \li a vector a types specifying the number and types of input arguments of the
\li a string documenting the command. command and \li a string documenting the command. In this case, there is only
In this case, there is only one argument of type <c>double</c>. Note the use of <c>boost::assign::list_of</c> to build one argument of type <c>double</c>. Note the use of
a vector in one command line: \code Increment(InvertedPendulum& entity, const std::string& docstring) : Command(entity, <c>boost::assign::list_of</c> to build a vector in one command line: \code
boost::assign::list_of(Value::DOUBLE), docstring) Increment(InvertedPendulum& entity, const std::string& docstring) :
Command(entity, boost::assign::list_of(Value::DOUBLE), docstring)
{ {
} }
\endcode \endcode
......
...@@ -3,15 +3,16 @@ ...@@ -3,15 +3,16 @@
\section dg_tutorial_inverted_pendulum_python_intro Introduction \section dg_tutorial_inverted_pendulum_python_intro Introduction