Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found
Select Git revision
  • devel
  • master
  • pre-commit-ci-update-config
  • topic/xenial
  • v2.5
  • v2.5.1
  • v2.5.2
  • v2.5.3
  • v2.5.4
  • v2.5.5
  • v3.0.0
  • v3.0.1
  • v3.0.2
  • v3.1.0
  • v3.2.0
  • v3.3.0
  • v3.3.1
  • v3.3.2
  • v3.4.0
  • v3.4.1
  • v3.5.0
  • v3.5.1
  • v3.5.2
  • v3.5.3
  • v4.0.0
  • v4.0.1
  • v4.0.10
  • v4.0.11
  • v4.0.2
  • v4.0.3
  • v4.0.4
  • v4.0.5
  • v4.0.6
  • v4.0.7
  • v4.0.8
  • v4.0.9
36 results

Target

Select target project
  • Olivier Stasse / dynamic-graph-python
  • Guilhem Saurel / dynamic-graph-python
  • Stack Of Tasks / dynamic-graph-python
3 results
Select Git revision
  • devel
  • master
  • 2.5.6
  • v2.5
  • v2.5.1
  • v2.5.2
  • v2.5.3
  • v2.5.4
  • v2.5.5
  • v3.0.0
  • v3.0.1
  • v3.0.2
  • v3.1.0
  • v3.2.0
  • v3.3.0
  • v3.3.1
  • v3.3.2
  • v3.4.0
  • v3.4.1
19 results
Show changes
106 files
+ 2345
4809
Compare changes
  • Side-by-side
  • Inline

Files

.git-blame-ignore-revs

0 → 100644
+2 −0
Original line number Diff line number Diff line
# pre-commit run -a (Guilhem Saurel, 2022-07-27)
db4d991c9d727b8454695ce8d88948b948c6b36f
+1 −53
Original line number Diff line number Diff line
variables:
  GIT_SUBMODULE_STRATEGY: "recursive"
  GIT_DEPTH: "3"
  CCACHE_BASEDIR: "${CI_PROJECT_DIR}"
  CCACHE_DIR: "${CI_PROJECT_DIR}/ccache"

cache:
  paths:
    - ccache

.robotpkg-py-dynamic-graph-v3: &robotpkg-py-dynamic-graph-v3
  except:
    - gh-pages
  script:
    - mkdir -p ccache
    - cd /root/robotpkg/wip/py-dynamic-graph-v3
    - git pull
    - make checkout MASTER_REPOSITORY="dir ${CI_PROJECT_DIR}"
    - make install
    - cd work.$(hostname)/$(make show-var VARNAME=DISTNAME)
    - make test

robotpkg-py-dynamic-graph-v3-14.04-release:
  <<: *robotpkg-py-dynamic-graph-v3
  image: eur0c.laas.fr:5000/stack-of-tasks/dynamic-graph-python/py-dynamic-graph-v3:14.04

robotpkg-py-dynamic-graph-v3-16.04-release:
  <<: *robotpkg-py-dynamic-graph-v3
  image: eur0c.laas.fr:5000/stack-of-tasks/dynamic-graph-python/py-dynamic-graph-v3:16.04

robotpkg-py-dynamic-graph-v3-18.04-release:
  <<: *robotpkg-py-dynamic-graph-v3
  image: eur0c.laas.fr:5000/stack-of-tasks/dynamic-graph-python/py-dynamic-graph-v3:18.04

doc-coverage:
  <<: *robotpkg-py-dynamic-graph-v3
  image: eur0c.laas.fr:5000/stack-of-tasks/dynamic-graph-python/py-dynamic-graph-v3:16.04
  before_script:
    - echo -e 'CXXFLAGS+= --coverage\nLDFLAGS+= --coverage\nPKG_DEFAULT_OPTIONS= debug' >> /opt/openrobots/etc/robotpkg.conf
  after_script:
    - cd /root/robotpkg/wip/py-dynamic-graph-v3
    - cd work.$(hostname)/$(make show-var VARNAME=DISTNAME)
    - make doc
    - mv doc/doxygen-html ${CI_PROJECT_DIR}
    - mkdir -p ${CI_PROJECT_DIR}/coverage/
    - gcovr -r .
    - gcovr -r . --html --html-details -o ${CI_PROJECT_DIR}/coverage/index.html
  artifacts:
    expire_in: 1 day
    paths:
      - doxygen-html/
      - coverage/
include: http://rainboard.laas.fr/project/dynamic-graph-python/.gitlab-ci.yml
+1 −4
Original line number Diff line number Diff line
[submodule "cmake"]
	path = cmake
	url = git://github.com/jrl-umi3218/jrl-cmakemodules.git
[submodule ".travis"]
	path = .travis
	url = git://github.com/jrl-umi3218/jrl-travis
	url = https://github.com/jrl-umi3218/jrl-cmakemodules.git
+39 −0
Original line number Diff line number Diff line
exclude: tests/test_python-syntax_error.py
ci:
    autoupdate_branch: 'devel'
repos:
-   repo: https://github.com/pre-commit/mirrors-clang-format
    rev: v14.0.6
    hooks:
    -   id: clang-format
        args: [--style=Google]
-   repo: https://github.com/pre-commit/pre-commit-hooks
    rev: v4.3.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.8.0
    hooks:
    -   id: black
-   repo: https://github.com/PyCQA/flake8
    rev: 5.0.4
    hooks:
    -   id: flake8
-   repo: https://github.com/cheshirekow/cmake-format-precommit
    rev: v0.6.13
    hooks:
    - id: cmake-format
Compare 083fa2cb to 083fa2cb
Original line number Diff line number Diff line
Subproject commit 083fa2cb0fa4ad594926d9bb3d246075e62ce9ee

.travis.yml

deleted100644 → 0
+0 −27
Original line number Diff line number Diff line
language: cpp
sudo: required
compiler:
  - gcc
  - clang
env:
  global:
  - secure: ECiHIh0aT5ml/MdKifvFIM2UpDWiPsJPEZpafLYM8U0VAPYThSfUe8JWhMsky8amOwm38akbSbr6C7iBKVpzjAqpgNdOdufO1RUZ6pUvtlVXiXTw2KlqPqbDVlD3QroVDhnX/rIRcg5ezEHAIb594uEaHdf8tlikhjdTc3aAgMA=
  - APT_DEPENDENCIES="doxygen doxygen-latex libboost-all-dev libeigen3-dev liblapack-dev libblas-dev gfortran python-dev python-sphinx"
  - GIT_DEPENDENCIES="proyan/dynamic-graph"
  - LCOV_IGNORE_RULES="*unitTesting*"
  allow_failures: 
  - compiler: clang
notifications:
  email:
  - hpp-source@laas.fr
branches:
  only:
  - master
  - debian
script: ./.travis/run build
after_success: ./.travis/run after_success
after_failure: ./.travis/run after_failure
before_install: ./.travis/run before_install
matrix:
  allow_failures:
    - compiler: clang

.yapfignore

0 → 100644
+1 −0
Original line number Diff line number Diff line
tests/test_python-syntax_error.py

AUTHORS

deleted100644 → 0
+0 −1
Original line number Diff line number Diff line
Authors: 
+85 −53
Original line number Diff line number Diff line
# Copyright 2010, 2011, Florent Lamiraux, Thomas Moulard, JRL, CNRS/AIST
#
# This file is part of dynamic-graph-python.
# dynamic-graph-python is free software: you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public License
# as published by the Free Software Foundation, either version 3 of
# the License, or (at your option) any later version.
#
# dynamic-graph-python is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# General Lesser Public License for more details.  You should have
# received a copy of the GNU Lesser General Public License along with
# dynamic-graph-python. If not, see <http://www.gnu.org/licenses/>.

CMAKE_MINIMUM_REQUIRED(VERSION 2.6)

INCLUDE(cmake/base.cmake)
INCLUDE(cmake/boost.cmake)
INCLUDE(cmake/eigen.cmake)
INCLUDE(cmake/pthread.cmake)
INCLUDE(cmake/cpack.cmake)
include(cmake/header.cmake)
include(cmake/python.cmake)

SET(PROJECT_NAME dynamic-graph-python)
SET(PROJECT_DESCRIPTION "Dynamic graph library Python bindings")
SET(PROJECT_URL "http://github.com/stack-of-tasks/dynamic-graph-python")

SET(DOXYGEN_USE_MATHJAX YES)

SET(CUSTOM_HEADER_DIR "dynamic-graph/python")
# Headers list.
SET(${PROJECT_NAME}_HEADERS
  include/dynamic-graph/python/interpreter.hh
  include/dynamic-graph/python/api.hh
  include/dynamic-graph/python/exception-python.hh
# Copyright 2010-2020, Florent Lamiraux, Thomas Moulard, Olivier Stasse, Guilhem
# Saurel, JRL, CNRS/AIST, LAAS-CNRS

cmake_minimum_required(VERSION 3.1)

# Project properties
set(PROJECT_ORG stack-of-tasks)
set(PROJECT_NAME dynamic-graph-python)
set(PROJECT_DESCRIPTION "Dynamic graph library Python bindings")
set(PROJECT_URL "https://github.com/${PROJECT_ORG}/${PROJECT_NAME}")

# Project options
option(SUFFIX_SO_VERSION "Suffix library name with its version" ON)

# Project configuration
set(PROJECT_USE_CMAKE_EXPORT TRUE)
set(CUSTOM_HEADER_DIR "dynamic-graph/python")
set(CXX_DISABLE_WERROR TRUE)
set(DOXYGEN_USE_MATHJAX YES)

# JRL-cmakemodule setup
include(cmake/base.cmake)
include(cmake/boost.cmake)

# Project definition
compute_project_args(PROJECT_ARGS LANGUAGES CXX)
project(${PROJECT_NAME} ${PROJECT_ARGS})
check_minimal_cxx_standard(14 ENFORCE)

# Project dependencies
set(PYTHON_COMPONENTS Interpreter Development NumPy)
add_project_dependency(dynamic-graph 4.4.0 REQUIRED)
add_project_dependency(eigenpy 2.7.10 REQUIRED)
set(PYTHON_EXPORT_DEPENDENCY_MACROS
    "list(APPEND PYTHON_COMPONENTS ${PYTHON_COMPONENTS})\n${PYTHON_EXPORT_DEPENDENCY_MACROS}"
)
if(BUILD_TESTING)
  find_package(Boost REQUIRED COMPONENTS unit_test_framework)
endif(BUILD_TESTING)

SET(PKG_CONFIG_ADDITIONAL_VARIABLES plugindir ${PKG_CONFIG_ADDITIONAL_VARIABLES})
if(Boost_VERSION GREATER 107299 OR Boost_VERSION_MACRO GREATER 107299)
  # Silence a warning about a deprecated use of boost bind by boost >= 1.73
  # without dropping support for boost < 1.73
  add_definitions(-DBOOST_BIND_GLOBAL_PLACEHOLDERS)
endif()

SETUP_PROJECT()
# Main Library
set(${PROJECT_NAME}_HEADERS
    include/${CUSTOM_HEADER_DIR}/api.hh
    include/${CUSTOM_HEADER_DIR}/convert-dg-to-py.hh
    include/${CUSTOM_HEADER_DIR}/dynamic-graph-py.hh
    include/${CUSTOM_HEADER_DIR}/fwd.hh
    include/${CUSTOM_HEADER_DIR}/interpreter.hh
    include/${CUSTOM_HEADER_DIR}/module.hh
    include/${CUSTOM_HEADER_DIR}/python-compat.hh
    include/${CUSTOM_HEADER_DIR}/signal.hh
    include/${CUSTOM_HEADER_DIR}/signal-wrapper.hh)

FINDPYTHON(2.7 EXACT REQUIRED)
set(${PROJECT_NAME}_SOURCES
    src/interpreter.cc src/dynamic_graph/python-compat.cc
    src/dynamic_graph/entity-py.cc src/dynamic_graph/convert-dg-to-py.cc)

# Trigger dependency to dynamic-graph.
ADD_REQUIRED_DEPENDENCY("dynamic-graph >= 3.0.0")
add_library(${PROJECT_NAME} SHARED ${${PROJECT_NAME}_SOURCES}
                                   ${${PROJECT_NAME}_HEADERS})
target_include_directories(${PROJECT_NAME} PUBLIC $<INSTALL_INTERFACE:include>)
target_link_libraries(${PROJECT_NAME} PUBLIC dynamic-graph::dynamic-graph)
modernize_target_link_libraries(
  ${PROJECT_NAME}
  SCOPE
  PUBLIC
  TARGETS
  Python${PYTHON_VERSION_MAJOR}::Python
  LIBRARIES
  ${PYTHON_LIBRARIES}
  INCLUDE_DIRS
  ${PYTHON_INCLUDE_DIRS})
target_link_boost_python(${PROJECT_NAME} PUBLIC)

# Add dependency toward dynamic graph library in pkg-config file.
PKG_CONFIG_APPEND_LIBS("dynamic-graph-python")
if(SUFFIX_SO_VERSION)
  set_target_properties(${PROJECT_NAME} PROPERTIES SOVERSION ${PROJECT_VERSION})
endif(SUFFIX_SO_VERSION)

# Search for Boost.
SET(BOOST_COMPONENTS python filesystem system thread program_options unit_test_framework)
SEARCH_FOR_BOOST()
SEARCH_FOR_EIGEN()
target_compile_definitions(${PROJECT_NAME}
                           PRIVATE PYTHON_LIBRARY="${PYTHON_LIBRARY}")

ADD_SUBDIRECTORY(src)
ADD_SUBDIRECTORY(include)
ADD_SUBDIRECTORY(doc)
ADD_SUBDIRECTORY(unitTesting)
install(
  TARGETS ${PROJECT_NAME}
  EXPORT ${TARGETS_EXPORT_NAME}
  DESTINATION lib)

SETUP_PROJECT_FINALIZE()
add_subdirectory(src)
if(BUILD_TESTING)
  add_subdirectory(tests)
endif(BUILD_TESTING)

install(FILES package.xml DESTINATION share/${PROJECT_NAME})
+1 −1
Original line number Diff line number Diff line
BSD 2-Clause License

Copyright (c) 2018, CNRS
Copyright (c) 2011-2019, CNRS
Author: Stack of Tasks Development Team
All rights reserved.

ChangeLog

deleted100644 → 0
+0 −202
Original line number Diff line number Diff line
CHANGELOG
----------------------

[Current]
 * Synchronize
 * Allow iterable instead of only tuple in signal value affectation.
 * Synchronize.
 * Fix compilation on Ubuntu 10.04 (32 bits).
 * Fix Ubuntu 12.04 (64 bits) portability issues.
 * Corrected the #include problem.
 * Modify SignalBase.value.

[v2.5.3]
 * Update ChangeLog.
 * Fix pb with filesystem version.

[v2.5.2]
 * Make runCommand without error messages deprecated.
 * Changes std::cout to dgDEBUG.
 * Add test to detect statement in evaluation.
 * Synchronize cmake
 * Robustify the python interpreter when some python objects cannot be stringified.
 * Synchronize.
 * Correct the link with boost on Ubuntu 11.04.
 * Keep track of entities created via python.
 * Document entity class types with the output of C++ getDocString method.
 * In command Entity.help (), first print __doc__ if any.
 * Make bindings more robust to exceptions.
 * Make sure that Boost.Filesystem v2 is used.
 * Revert "Add appropriate flag. file_system::file_string is deprecated since boost 1.46."
 * Synchronize cmake submodule.
 * Catch exceptions in getValue of signal-base-py.cc
 * Add appropriate flag. file_system::file_string is deprecated since boost 1.46.
 * Synchronize.
 * Win32: Remove wrong LoadLibrary.
 * Correct the handling of python modules
 * Correct the link with boost for Mac systems
 * Add missing dependency in python
 * Correct the link with the plugins for the wrap
 * Correct the Python_module handling
 * Correct link and dependencies
 * Clean cmake files by using the routines in cmake/python.cmake
 * Win32: correct the library load
 * Win32: Correct the API of exception-python.hh
 * Revert "Correct the link with lapack"
 * Correct the link with lapack
 * Correct the link with boost libraries
 * Python object SignalBase can be constructed only with a SignalBase C++ object.
 * Revert "Modify SignalBase.value."
 * Modify SignalBase.value.

[v2.5.1]
 * Update NEWS.
 * Add python binding for writing graph.
 * Make error message more expressive.
 * Enforce compatibility with python3.
 * Replace dl module by DLFCN.
 * More search for boost earlier in file.
 * Synchronize and fix definition of PYTHON_SITELIB.
 * Add dynamicgraph namespace to make VP_DEBUG mode compile.
 * Minor changes in matlab display. Add a functor member to explicit the callable of optionalparentethis.
 * Add tools.py file containing addTrace.

[v2.5]
 * Replace call to g_caster by call to SignalCaster::getInstance static method.
 * FactoryStorage and PoolStorage are now singletons.
 * Homogeneize error messages.
 * Fix bug in getCommandDocstring.
 * Changed the factory to enable heritage for Entity py-classes.
 * Return a python error instead of throwing C++ exception.
 * Merge branches 'topic/jrl-mal' and 'topic/jrl-mal' of ssh://github.com/jrl-umi3218/dynamic-graph-python into topic/jrl-mal
 * Correct a bug in parsing vector commands with integer value.
 * Finished to correct the name of the DG error.
 * Replace two remaining error by dgpyError.
 * Correct exception throwing from C++ to rely raise something in the interpreter.
 * Systematically catch std::exception abstract in python bindings.
 * Corrected a wrong cast for specialized type in signal value accessor.
 * Add method intepreter::python with stdout and stderr returned along with result.
 * Make error message more specific whenever Entity.__getattr__ fails.
 * Added a protection to avoid erasing signal name when setting a new value to the signal.
 * Added the decorator optionalparentheses.
 * Corrected a syntax error in an exception raising + remove the shortcut .m from the class basic definition.
 * Corrected minor bug in command return.
 * Added the entity.sigs shortcuts.
 * Reorganize the command bindings of the entity classes. Remove the script shortcuts from the basic definition of Entity.
 * Added the setattrpath function to handle for command name with . inside, like: robot.periodicCall.addSignal.
 * Display repr() output instead of str() when command is successful.
 * Do not add current directory in sys.path.
 * Added a proper factory for pyEntities.
 * Modify the "runFile" function that was not working, at create a new function to call for the shell.
 * Changed the call to create_entity: when the required creation names already exists, check is the existing object is of the same class. If it is, returns the existing object instead of creating a new oine.
 * IVIGIT.
 * Added an exception to handle error while creating an object.
 * Dynamically load libpython.so before initializing python interpreter.
 * Add an accessor to get the global dictionary.
 * Account for singleton rewriting of g_caster.
 * Added a wrapper for entities of dg.
 * Added display and displayDep in entity and signal.
 * Bind SignalBase<T, int>::setTime.
 * Revert "Set version number as 1.99."
 * Fix --libs output of pkg-config and link boost and python with library.
 * Added missing convert.cc in the makefile.
 * Added some specific convertion for vector, matrix and double signal, from C to Python (to avoid unnecessary convertion through strings.
 * IVIGIT: passes some conveertion code from entity-py to the new files, for mutualisation.
 * Added exception.hh in the files to install.
 * IVIGIT.
 * Install and include in interpreter.hh api.hh.
 * Fix installation of header file.
 * Set version number as 1.99.
 * Enable conversion from int to float and double in argument of bound functions.
 * Added the display method, py-bound in __str__.
 * Added a method to bound all new commands.
 * Added a method to bound new commands dynamically.
 * Define function display.
 * Enable reading an int as a float when parsing a matrix.
 * Added shortcuts in the entity and signal-base api to help debuging during online script execution.
 * Added the unplug python function as a member of the signal-base class.
 * Set sys.argv to [''] at initialization.
 * Implement on-board python interpreter
 * Added build and ~ in the gitignoe.
 * Update docstring of Entity.signals().
 * Bind SignalBase.display() and implement Entity.displaySignals() in python.
 * Fix typo.
 * Fix warnings.
 * Save temporary changes to get list of signals of an entity.
 * Synchronize cmake submodule.
 * Raise exception when PyCObject_Check fails.
 * Fix warnings.
 * Switch to submodule.
 * Do not destroy C++ entity when destroying python binding object.
 * In Entity class, each signal gives rise to an attribute returning the signal.
 * Change the error message when an attribute does not exist.
 * Add a method getName in python class SignalBase
 * Added the signals in the attribute of the entity class.
 * With the doc.
 * Added an helper to get the commands list and doc.
 * Set error message in function w_plug when arguments are of wrong types.
 * Add a function to get the list of type names registered for signals.
 * Catch exception in SignalBase::recompute().
 * Rename method display_signals -> displaySignals.
 * Add recompute method in SignalBase python class.
 * Add a function to get the list of type names registered for signals.
 * Rename error
 * Rewrite enableTrace command without using commandLine.
 * Handle entity type as input to signal_base.value setter.
 * Catch std::exception instead of dynamicgraph::ExceptionFactory.
 * Remove debug output.
 * Fix a bug in conversion of tuple of tuple python object to matrix.
 * Rewrite stringToTuple and stringToMatrix in a simpler way.
 * Set flags of dynamic loader so that symbols are global.
 * Check that argument is string when string is expected in command.
 * Catch std::exception when executing command
 * Comply with jrl-mal syntax for vectors and matrices.
 * Replace object member by obj in classes
 * Rename method in python module
 * When building python Entity classes, populate methods with docstrings.
 * Use autotools substitution rule.
 * Use submodule cmake to generate python documentation
 * Add documentation generation using sphinx.
 * Add submodule cmake
 * Re-inforce type checking.
 * Allow SignalBase.value to take typed arguments
 * Remove debug output
 * Remove debug output
 * Implement tupleToString function
 * Fix typo.
 * Switch arguments of command plug.
 * Fix a bug in handling of new types
 * Support more types in command parameters
 * Add a function to convert a string to a tuple
 * Fix memory issue
 * Remove trailing white spaces.
 * Bind Entity commands as method in python classes
 * Get rid of warning message
 * Bind method Entity::getNewStyleCommandMap()
 * Add a class attribute to store whether command methods have been created.
 * Register Entity classes in modules from which they are imported
 * Implement a function that creates a python class for for each entity C++ class
 * Implement return value for commands.
 * Fix a memory bug
 * Add some debug output
 * Implement binidings for commands
 * Use factory to create entities.
 * Bind method Entity::listEntities.
 * Fix comment
 * Make classes derive from object and re-introduce getter and setter decorators
 * Remove registration of new ublas vector type.
 * Call plug with right order for signals: plug (sigIn, sigOut).
 * Rewrite dynamic_graph.plug.
 * Use class InterpreterHelper instead of Interpreter.
 * Catch exceptions in signal set and get value methods.
 * Catch exceptions in signal set and get value methods.
 * Do not use sophisticated setter and getter for the moment
 * Change signal access method name in Entity python class
 * Adapt to dynamic-graph change of interface
 * Implement set and get signal value
 * Fix constructor of python class SignalBase.
 * Implement bindings for Entity and SignalBase C++ classes.
 * Raise a python exception upon c++ exception in plug command
 * Implement binding python for plug.
 * Fix compilation of python module
 * Bindings python for dynamic_grapĥ.

INSTALL

deleted100644 → 0
+0 −21
Original line number Diff line number Diff line
#
#  Copyright
#

Installation instructions for library dynamic-graph-python
----------------------------------------------

It is recommended to create a specific directory to install this package.
mkdir build
cd build
cmake [Options] ..
make 
make install

Options:

-DCMAKE_INSTALL_PREFIX=...
  specifies the directory where to install the package.

-DCMAKE_BUILD_TYPE=[none|debug|release|relwithdebinfo|MinSizeRel]
  specifies to type of compilation (release, debug, ...)

NEWS

deleted100644 → 0
+0 −9
Original line number Diff line number Diff line
New in version 2.5.1 - 2011-12-07
* Move search for boost earlier in CMakeLists.txt,
* Use PyObject_IsTrue to test a boolean C/Python API,
* Replace deprecated python module dl module by DLFCN,
* use print as a function for python 3 compatibility,
* Modification of signal management for vector and matrix data,
* Python files are now installed in site-packages instead of dist-packages,
* Add tools.py file containing addTrace.
New in version 2.5 - 2011-06-21
+19 −60
Original line number Diff line number Diff line
dynamic-graph-python
====================
# dynamic-graph-python

[![Building Status](https://travis-ci.org/stack-of-tasks/dynamic-graph-python.svg?branch=master)](https://travis-ci.org/stack-of-tasks/dynamic-graph-python)
[![Pipeline status](https://gepgitlab.laas.fr/stack-of-tasks/dynamic-graph-python/badges/master/pipeline.svg)](https://gepgitlab.laas.fr/stack-of-tasks/dynamic-graph-python/commits/master)
[![Coverage report](https://gepgitlab.laas.fr/stack-of-tasks/dynamic-graph-python/badges/master/coverage.svg?job=doc-coverage)](http://projects.laas.fr/stack-of-tasks/doc/stack-of-tasks/dynamic-graph-python/master/coverage/)
[![Pipeline status](https://gitlab.laas.fr/stack-of-tasks/dynamic-graph-python/badges/master/pipeline.svg)](https://gitlab.laas.fr/stack-of-tasks/dynamic-graph-python/commits/master)
[![Coverage report](https://gitlab.laas.fr/stack-of-tasks/dynamic-graph-python/badges/master/coverage.svg?job=doc-coverage)](http://projects.laas.fr/stack-of-tasks/doc/stack-of-tasks/dynamic-graph-python/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-python/master.svg)](https://results.pre-commit.ci/latest/github/stack-of-tasks/dynamic-graph-python)

Python bindings for dynamic-graph.

@@ -14,52 +15,19 @@ submodules][git-submodules]. Please clone this repository using the
repository, you can run `git submodule init && git submodule update`
to retrieve the submodules.

## Documentation

Documentation
-------------
[Online](https://gepettoweb.laas.fr/doc/stack-of-tasks/dynamic-graph-python/master/doxygen-html/)

To get started with this library, please read the [online Doxygen
documentation][doxygen-documentation].

It can also be generated locally by running the `make doc`
command. After the package is installed, the documentation will be
located in the `$prefix/share/doc/dynamic-graph` directoy where
`$prefix` is your installation prefix (`/usr/local` by default).


Getting Help
------------
## Getting Help

Support is provided through:
 * the HPP mailing-list: hpp@laas.fr
 * the following HipChat room: http://www.hipchat.com/gh4wQrZeV


How can I install dynamic-graph?
--------------------------------

### Installing dependencies

The matrix abstract layer depends on several packages which
have to be available on your machine.

 - Libraries:
   - [Boost][] (>= 1.40)
     Its detection is controled by the `BOOST_ROOT` variable, see next section
     for more information.
   - [Lapack][] library
     Use the generic purpose `CMAKE_CXX_FLAGS` and `CMAKE_EXE_LINKER_FLAGS`
     to insert the flags required for the compiler to find your Lapack library
     if it is installed in a non-standard directory.
   - [jrl-mal][] library
   - [dynamic-graph][] library
 - System tools:
   - [CMake][] (>=2.6)
   - [pkg-config][]
   - usual compilation tools (GCC/G++, make, etc.)
     If you are using Ubuntu, these tools are gathered in the `build-essential` package.
 * the [issue tracker](https://github.com/stack-of-tasks/dynamic-graph-python/issues)
 * the matrix room [#stack-of-tasks:laas.fr](https://matrix.to/#/#stack-of-tasks:laas.fr)


## How can I install dynamic-graph?

### Compiling and installing the package

@@ -68,24 +36,21 @@ The manual compilation requires two steps:
 1. configuration of the build and generation of the build files
 2. compilation of the sources and installation of the package

dynamic-graph uses [CMake][] to generate build files. It is
dynamic-graph uses CMake to generate build files. It is
recommended to create a separate build directory:

```sh
mkdir _build         # (1) Create a build directory
cd _build            # (2) Go to the newly created build directory
cmake [options] ..   # (3) Generate the build files
mkdir build
cd build
cmake ..
```

Options which can be passed to CMake are detailed in the next section.

```sh
make                 # (4) Compile the package
make test            # (5) Execute the package tests
make install         # (6) Install the package into the prefix (see step 3)
make
make test
make install
```


### Options

Additional options can be set on the command line through the
@@ -114,9 +79,3 @@ The test suite can be run from your build directory by running:

Please open a ticket if some tests are failing on your computer, it
should not be the case.

Credits
-------

This package authors are credited in the [AUTHORS](AUTHORS) file.
Original line number Diff line number Diff line
Subproject commit 99aafa43694125e67046bdc91c7b6485b5b6ca45
Subproject commit 08c2c18b9033c2f0a86b885b589f4fa63a163caf

debian/changelog

deleted100644 → 0
+0 −17
Original line number Diff line number Diff line
python-dynamic-graph (3.0.0-0ubuntu1ppa0~precise3) precise; urgency=low

  * Update package dependencies

 -- Rohan Budhiraja <budhiraja.rohan@gmail.com>  Fri, 27 May 2016 18:51:23 +0200

python-dynamic-graph (3.0.0-0ubuntu1ppa0~precise2) precise; urgency=low

  * Update package dependencies

 -- Rohan Budhiraja <budhiraja.rohan@gmail.com>  Fri, 27 May 2016 18:41:23 +0200

python-dynamic-graph (3.0.0-0ubuntu1ppa0~precise1) precise; urgency=low

  * Initial release

 -- Rohan Budhiraja <budhiraja.rohan@gmail.com>  Wed, 04 May 2016 14:34:08 +0200

debian/compat

deleted100644 → 0
+0 −1
Original line number Diff line number Diff line
8

debian/control

deleted100644 → 0
+0 −72
Original line number Diff line number Diff line
Source: python-dynamic-graph
Section: python
X-Python-Version: 2.6,2.7
Priority: extra
Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
Build-Depends: debhelper (>= 8.0.0),
	       cmake (>=2.6),
	       doxygen (>=1.6.3),
	       pkg-config (>=0.22),
	       python (<<2.8),
	       python (>=2.7),
	       python-sphinx (>=1.1),
	       libdynamic-graph-dev (>=3.0.0),
       	       libboost-dev (>=1.46),
	       libboost-filesystem-dev (>=1.46),
	       libboost-python-dev (>=1.46),
      	       libboost-system-dev (>=1.46),
      	       libboost-test-dev (>=1.46),
      	       libboost-thread-dev (>=1.46),
      	       libboost-program-options-dev (>=1.46),
	       libeigen3-dev (>=3.0.5)
Standards-Version: 3.9.7
Homepage: http://stack-of-tasks.github.io/
Vcs-Git: git://github.com/proyan/dynamic-graph-python.git

Package: python-dynamic-graph-dev
Architecture: any
Suggests: python-dynamic-graph-doc
Depends: libdynamic-graph-python3.0.0 (= ${binary:Version}),
	 ${misc:Depends}
Description: Python bindings for dynamic-graph library - Development Files
 The dynamic graph library allows the representation of data-flow in C++.
 It provides fast graph evaluation and a simple script language to manipulate
 the graph actions.
 .
 This package contains dynamic-graph development files.


Package: python-dynamic-graph
Architecture: any
Suggests: python-dynamic-graph-doc
Provides: ${python:Provides}
Depends: libdynamic-graph-python3.0.0 (= ${binary:Version}), ${shlibs:Depends}, ${python:Depends}, ${misc:Depends}
Description: Python bindings for dynamic-graph library
 The dynamic graph library allows the representation of data-flow in C++.
 It provides fast graph evaluation and a simple script language to manipulate
 the graph actions.
 .
 This package contains modules that allow you to use dynamic-graph from Python.

Package: libdynamic-graph-python3.0.0
Architecture: any
Suggests: python-dynamic-graph-doc
Pre-Depends: ${misc:Pre-Depends}
Depends: ${shlibs:Depends}, ${misc:Depends}
Description: Python bindings for dynamic-graph library (Binary and shared libraries)
 The dynamic graph library allows the representation of data-flow in C++.
 It provides fast graph evaluation and a simple script language to manipulate
 the graph actions.
 .
 This package contains binaries and shared libraries.

Package: python-dynamic-graph-doc
Architecture: all
Section: doc
Depends: ${misc:Depends}
Description: Python bindings for dynamic-graph library (common documentation)
 The dynamic graph library allows the representation of data-flow in C++.
 It provides fast graph evaluation and a simple script language to manipulate
 the graph actions.
 .
 This is the common documentation package
 No newline at end of file

debian/copyright

deleted100644 → 0
+0 −14
Original line number Diff line number Diff line
Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0
Upstream-Name: dynamic-graph-python
Upstream-Contact: HPP mailing list <hpp@laas.fr>
Source: https://github.com/proyan/dynamic-graph-python

Files: *
Copyright: 2010-2016 JRL, CNRS/AIST.
License: LGPL-3
  See `/usr/share/common-licenses/LGPL-3'.	 

Files: debian/*
Copyright: 2016 Rohan Budhiraja
License: LGPL-3
  See `/usr/share/common-licenses/LGPL-3'.
 No newline at end of file

debian/docs

deleted100644 → 0
+0 −2
Original line number Diff line number Diff line
NEWS
README.md
+0 −2
Original line number Diff line number Diff line
usr/bin/*
usr/lib/*/*.so.*
 No newline at end of file
+0 −3
Original line number Diff line number Diff line
usr/include/*
usr/lib/*/lib*.so
usr/lib/*/pkgconfig/*
 No newline at end of file
+0 −13
Original line number Diff line number Diff line
Document: python-dynamic-graph
Title: Debian python-dynamic-graph Manual
Author: Thomas Moulard <thomas.moulard@gmail.com>
Abstract: Doxygen documentation of python-dynamic-graph
 This manual describes what python-dynamic-graph is
 and how it can be used
 in making graph-like data-flow structures
 using Python interface.
Section: Programming

Format: HTML
Index: /usr/share/doc/dynamic-graph-python/doxygen-html/index.html
Files: /usr/share/doc/dynamic-graph-python/doxygen-html/*.html
 No newline at end of file
+0 −1
Original line number Diff line number Diff line
usr/share/doc/dynamic-graph-python/*
 No newline at end of file
+0 −1
Original line number Diff line number Diff line
usr/lib/python*
 No newline at end of file
+0 −12
Original line number Diff line number Diff line
#!/bin/sh
# postinst script for python-dynamic-graph
#
# see: dh_installdeb(1)

set -e

if which pycompile >/dev/null 2>&1; then
    pycompile -p python-dynamic-graph
fi

#DEBHELPER#
 No newline at end of file

debian/python-dynamic-graph.prerm

deleted100644 → 0
+0 −17
Original line number Diff line number Diff line
#!/bin/sh
# prerm script for python-dynamic-graph
#
# see: dh_installdeb(1)

set -e

if which pyclean >/dev/null 2>&1; then
    pyclean -p python-dynamic-graph
else
    dpkg -L python-dynamic-graph | grep \.py$ | while read file
    do
	rm -f "${file}"[co] >/dev/null
    done
fi

#DEBHELPER#
 No newline at end of file

debian/rules

deleted100755 → 0
+0 −21
Original line number Diff line number Diff line
#!/usr/bin/make -f
# -*- makefile -*-
# Sample debian/rules that uses debhelper.
# This file was originally written by Joey Hess and Craig Small.
# As a special exception, when this file is copied by dh-make into a
# dh-make output file, you may use that output file without restriction.
# This special exception was added by Craig Small in version 0.37 of dh-make.

# Uncomment this to turn on verbose mode.
# export DH_VERBOSE=1

%:
	dh $@ --with python2 --buildsystem=cmake

override_dh_auto_configure:
	dh_auto_configure -- \
	-DPYTHON_DEB_LAYOUT=ON



export PYBUILD_NAME = dynamic-graph
 No newline at end of file

debian/source/format

deleted100644 → 0
+0 −1
Original line number Diff line number Diff line
3.0 (quilt)

debian/watch

deleted100644 → 0
+0 −3
Original line number Diff line number Diff line
version=3
opts=filenamemangle=s/.+\/v?(\d\S*)\.tar\.gz/dynamic-graph-python$1\.tar\.gz/ \
  https://github.com/proyan/dynamic-graph-python/releases .*/v?(\d\S*)\.tar\.gz
 No newline at end of file

doc/CMakeLists.txt

deleted100644 → 0
+0 −19
Original line number Diff line number Diff line
# Copyright 2010, 2011, Florent Lamiraux, Thomas Moulard, JRL, CNRS/AIST
#
# This file is part of dynamic-graph-python.
# dynamic-graph-python is free software: you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public License
# as published by the Free Software Foundation, either version 3 of
# the License, or (at your option) any later version.
#
# dynamic-graph-python is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# General Lesser Public License for more details.  You should have
# received a copy of the GNU Lesser General Public License along with
# dynamic-graph-python. If not, see <http://www.gnu.org/licenses/>.

INCLUDE(../cmake/sphinx.cmake)

SPHINX_SETUP()
SPHINX_FINALIZE()
+0 −1
Original line number Diff line number Diff line
@@ -8,4 +8,3 @@
 </center>
 </body>
 </head>
+0 −1
Original line number Diff line number Diff line
@@ -4,4 +4,3 @@
      <LINK HREF="package.css" REL="stylesheet" TYPE="text/css">
    </HEAD>
    <BODY>
+15 −16
Original line number Diff line number Diff line
@@ -227,4 +227,3 @@ DIV.groupHeader
    text-decoration: none;
    color:#0066CC
}
+32 −32

File changed and moved.

Contains only whitespace changes.

doc/sphinx/conf.py.in

deleted100644 → 0
+0 −199
Original line number Diff line number Diff line
# -*- coding: utf-8 -*-
#
# @PROJECT_NAME@ documentation build configuration file, created by
# sphinx-quickstart on Mon Nov 22 16:45:27 2010.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All configuration values have a default; values that are commented out
# serve to show the default.

import sys, os

# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
sys.path = [os.path.abspath('@CMAKE_BINARY_DIR@/src')]+sys.path
sys.path = [os.path.abspath('@CMAKE_SOURCE_DIR@/src')]+sys.path

# -- General configuration -----------------------------------------------------

# Add any Sphinx extension module names here, as strings. They can be extensions
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
extensions = ['sphinx.ext.autodoc', 'sphinx.ext.doctest', 'sphinx.ext.intersphinx', 'sphinx.ext.todo', 'sphinx.ext.pngmath']

# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']

# The suffix of source filenames.
source_suffix = '.rst'

# The encoding of source files.
#source_encoding = 'utf-8'

# The master toctree document.
master_doc = 'index'

# General information about the project.
project = u'@PROJECT_NAME@'
copyright = u'2010, Florent Lamiraux'

# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The short X.Y version.
version = '1.0'
# The full version, including alpha/beta/rc tags.
release = '1.0'

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
#language = None

# There are two options for replacing |today|: either, you set today to some
# non-false value, then it is used:
#today = ''
# Else, today_fmt is used as the format for a strftime call.
#today_fmt = '%B %d, %Y'

# List of documents that shouldn't be included in the build.
#unused_docs = []

# List of directories, relative to source directory, that shouldn't be searched
# for source files.
exclude_trees = []

# The reST default role (used for this markup: `text`) to use for all documents.
#default_role = None

# If true, '()' will be appended to :func: etc. cross-reference text.
#add_function_parentheses = True

# If true, the current module name will be prepended to all description
# unit titles (such as .. function::).
#add_module_names = True

# If true, sectionauthor and moduleauthor directives will be shown in the
# output. They are ignored by default.
#show_authors = False

# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx'

# A list of ignored prefixes for module index sorting.
#modindex_common_prefix = []


# -- Options for HTML output ---------------------------------------------------

# The theme to use for HTML and HTML Help pages.  Major themes that come with
# Sphinx are currently 'default' and 'sphinxdoc'.
html_theme = 'default'

# Theme options are theme-specific and customize the look and feel of a theme
# further.  For a list of options available for each theme, see the
# documentation.
#html_theme_options = {}

# Add any paths that contain custom themes here, relative to this directory.
#html_theme_path = []

# The name for this set of Sphinx documents.  If None, it defaults to
# "<project> v<release> documentation".
#html_title = None

# A shorter title for the navigation bar.  Default is the same as html_title.
#html_short_title = None

# The name of an image file (relative to this directory) to place at the top
# of the sidebar.
#html_logo = None

# The name of an image file (within the static path) to use as favicon of the
# docs.  This file should be a Windows icon file (.ico) being 16x16 or 32x32
# pixels large.
#html_favicon = None

# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']

# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
# using the given strftime format.
#html_last_updated_fmt = '%b %d, %Y'

# If true, SmartyPants will be used to convert quotes and dashes to
# typographically correct entities.
#html_use_smartypants = True

# Custom sidebar templates, maps document names to template names.
#html_sidebars = {}

# Additional templates that should be rendered to pages, maps page names to
# template names.
#html_additional_pages = {}

# If false, no module index is generated.
#html_use_modindex = True

# If false, no index is generated.
#html_use_index = True

# If true, the index is split into individual pages for each letter.
#html_split_index = False

# If true, links to the reST sources are added to the pages.
#html_show_sourcelink = True

# If true, an OpenSearch description file will be output, and all pages will
# contain a <link> tag referring to it.  The value of this option must be the
# base URL from which the finished HTML is served.
#html_use_opensearch = ''

# If nonempty, this is the file name suffix for HTML files (e.g. ".xhtml").
#html_file_suffix = ''

# Output file base name for HTML help builder.
htmlhelp_basename = '@PROJECT_NAME@doc'


# -- Options for LaTeX output --------------------------------------------------

# The paper size ('letter' or 'a4').
#latex_paper_size = 'letter'

# The font size ('10pt', '11pt' or '12pt').
#latex_font_size = '10pt'

# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title, author, documentclass [howto/manual]).
latex_documents = [
  ('index', '@PROJECT_NAME@.tex', u'@PROJECT_NAME@ Documentation',
   u'Florent Lamiraux', 'manual'),
]

# The name of an image file (relative to this directory) to place at the top of
# the title page.
#latex_logo = None

# For "manual" documents, if this is true, then toplevel headings are parts,
# not chapters.
#latex_use_parts = False

# Additional stuff for the LaTeX preamble.
#latex_preamble = ''

# Documents to append as an appendix to all manuals.
#latex_appendices = []

# If false, no module index is generated.
#latex_use_modindex = True


# Example configuration for intersphinx: refer to the Python standard library.
intersphinx_mapping = {'http://docs.python.org/': None}

doc/sphinx/index.rst.in

deleted100644 → 0
+0 −42
Original line number Diff line number Diff line
.. dynamic-graph-python documentation master file, created by
   sphinx-quickstart on Mon Nov 22 16:45:27 2010.
   You can adapt this file completely to your liking, but it should at least
   contain the root `toctree` directive.

Welcome to dynamic-graph-python's documentation!
================================================

.. toctree::
   :maxdepth: 2

Python module dynamic_graph implements bindings for dynamic-graph_ library. To each main C++ class is associated a Python class. Main classes are listed below.

Entity
------
maps dynamicgraph::Entity_ C++ class.

.. autoclass:: dynamic_graph.entity.Entity
   :members:

SignalBase
----------
maps dynamicgraph::SignalBase_ C++ class.

.. autoclass:: dynamic_graph.signal_base.SignalBase
   :members:

Other funtions of the module
----------------------------
.. automodule:: dynamic_graph
   :members:

Indices and tables
==================

* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`

.. _dynamic-graph: file://@DYNAMIC_GRAPH_DOXYGENDOCDIR@/index.html
.. _Entity: file://@DYNAMIC_GRAPH_DOXYGENDOCDIR@/classdynamicgraph_1_1_entity.html
.. _SignalBase: file://@DYNAMIC_GRAPH_DOXYGENDOCDIR@/classdynamicgraph_1_1_signal_base.html

include/CMakeLists.txt

deleted100644 → 0
+0 −15
Original line number Diff line number Diff line
# Copyright 2010, 2011, Florent Lamiraux, CNRS
#
# This file is part of dynamic-graph-python.
# dynamic-graph-python is free software: you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public License
# as published by the Free Software Foundation, either version 3 of
# the License, or (at your option) any later version.
#
# dynamic-graph-python is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# General Lesser Public License for more details.  You should have
# received a copy of the GNU Lesser General Public License along with
# dynamic-graph-python. If not, see <http://www.gnu.org/licenses/>.
+3 −16
Original line number Diff line number Diff line
// -*- mode: c++ -*-
// Copyright 2011, Florent Lamiraux, CNRS.
//
// This file is part of dynamic-graph-python.
// dynamic-graph is free software: you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public License
// as published by the Free Software Foundation, either version 3 of
// the License, or (at your option) any later version.
//
// dynamic-graph is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
// General Lesser Public License for more details.  You should have
// received a copy of the GNU Lesser General Public License along with
// dynamic-graph. If not, see <http://www.gnu.org/licenses/>.

#ifndef DYNAMIC_GRAPH_PYTHON_API_HH
#define DYNAMIC_GRAPH_PYTHON_API_HH
+18 −0
Original line number Diff line number Diff line
// Copyright 2010, Florent Lamiraux, Thomas Moulard, LAAS-CNRS.

#include <dynamic-graph/linear-algebra.h>
#include <dynamic-graph/value.h>

#include <boost/python.hpp>

namespace dynamicgraph {
namespace python {
namespace convert {

command::Value toValue(boost::python::object o,
                       const command::Value::Type& type);
boost::python::object fromValue(const command::Value& value);

}  // namespace convert
}  // namespace python
}  // namespace dynamicgraph
+76 −0
Original line number Diff line number Diff line
#ifndef DYNAMIC_GRAPH_PY
#define DYNAMIC_GRAPH_PY

#include <dynamic-graph/debug.h>
#include <dynamic-graph/exception-factory.h>
#include <dynamic-graph/signal-base.h>

#include <boost/python.hpp>
#include <boost/python/stl_iterator.hpp>
#include <iostream>
#include <sstream>

#include "dynamic-graph/python/signal-wrapper.hh"

namespace bp = boost::python;

namespace dynamicgraph {
namespace python {

template <typename Iterator>
inline bp::list to_py_list(Iterator begin, Iterator end) {
  typedef typename Iterator::value_type T;
  bp::list lst;
  std::for_each(begin, end, [&](const T& t) { lst.append(t); });
  return lst;
}

template <typename Iterator>
inline bp::tuple to_py_tuple(Iterator begin, Iterator end) {
  return bp::tuple(to_py_list(begin, end));
}

template <typename T>
inline std::vector<T> to_std_vector(const bp::object& iterable) {
  return std::vector<T>(bp::stl_input_iterator<T>(iterable),
                        bp::stl_input_iterator<T>());
}

void exposeSignals();

// Declare functions defined in other source files
namespace signalBase {
SignalBase<int>* createSignalWrapper(const char* name, const char* type,
                                     bp::object object);
}  // namespace signalBase
namespace entity {

/// \param obj an Entity object
void addCommands(boost::python::object obj);
void addSignals(boost::python::object obj);

Entity* create(const char* type, const char* name);
bp::object executeCmd(bp::tuple args, bp::dict);
}  // namespace entity

namespace factory {
bp::tuple getEntityClassList();
}
namespace pool {
void writeGraph(const char* filename);
bp::list getEntityList();
const std::map<std::string, Entity*>* getEntityMap();
}  // namespace pool
namespace debug {
void addLoggerFileOutputStream(const char* filename);
void addLoggerCoutOutputStream();
void closeLoggerFileOutputStream();
void realTimeLoggerSpinOnce();
void realTimeLoggerDestroy();
void realTimeLoggerInstance();
}  // namespace debug

}  // namespace python
}  // namespace dynamicgraph

#endif
+0 −74
Original line number Diff line number Diff line
// -*- mode: c++ -*-
// Copyright 2010, François Bleibel, Thomas Moulard, Olivier Stasse,
// JRL, CNRS/AIST.
//
// This file is part of dynamic-graph.
// dynamic-graph is free software: you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public License
// as published by the Free Software Foundation, either version 3 of
// the License, or (at your option) any later version.
//
// dynamic-graph is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
// General Lesser Public License for more details.  You should have
// received a copy of the GNU Lesser General Public License along with
// dynamic-graph. If not, see <http://www.gnu.org/licenses/>.

#ifndef DYNAMIC_GRAPH_PYTHON_EXCEPTION_PYTHON_H
# define DYNAMIC_GRAPH_PYTHON_EXCEPTION_PYTHON_H
# include <string>

# include <dynamic-graph/fwd.hh>
# include <dynamic-graph/exception-abstract.h>

// Depending on whether one is building or using the
// library define DLLAPI to import or export.
# if defined (WIN32)
#   if defined (wrap_EXPORTS)
#     define WRAP_DLLAPI __declspec(dllexport)
#   else
#     define WRAP_DLLAPI __declspec(dllimport)
#   endif
# else
#   define WRAP_DLLAPI
# endif

namespace dynamicgraph {
  namespace python {

    /// \ingroup error
    ///
    /// \brief Generic error class.
    class WRAP_DLLAPI ExceptionPython : public ExceptionAbstract
    {
    public:
      enum ErrorCodeEnum
      {
	GENERIC
	,VALUE_PARSING
	,VECTOR_PARSING
	,MATRIX_PARSING
	,CLASS_INCONSISTENT
      };

      static const std::string EXCEPTION_NAME;

      explicit ExceptionPython (const ExceptionPython::ErrorCodeEnum& errcode,
				const std::string & msg = "");

      ExceptionPython (const ExceptionPython::ErrorCodeEnum& errcode,
		       const std::string& msg, const char* format, ...);

      virtual ~ExceptionPython () throw ()
      {}

      virtual const std::string& getExceptionName () const
      {
	return ExceptionPython::EXCEPTION_NAME;
      }
    };
  } // end of namespace python
} // end of namespace dynamicgraph

#endif //! DYNAMIC_GRAPH_PYTHON_EXCEPTION_PYTHON_H
+21 −0
Original line number Diff line number Diff line
/*
 * Copyright CNRS 2021
 *
 * Author: Florent Lamiraux
 *
 * This file is part of sot-core.
 */

#ifndef DYNAMIC_GRAPH_PYTHON_FWD_HH
#define DYNAMIC_GRAPH_PYTHON_FWD_HH

#include <dynamic-graph/fwd.hh>

namespace dynamicgraph {
namespace python {
class Interpreter;
typedef shared_ptr<Interpreter> InterpreterPtr_t;
}  // namespace python
}  // namespace dynamicgraph

#endif  // DYNAMIC_GRAPH_PYTHON_FWD_HH
+51 −67
Original line number Diff line number Diff line
// -*- mode: c++ -*-
// Copyright 2011, Florent Lamiraux, CNRS.
//
// This file is part of dynamic-graph-python.
// dynamic-graph is free software: you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public License
// as published by the Free Software Foundation, either version 3 of
// the License, or (at your option) any later version.
//
// dynamic-graph is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
// General Lesser Public License for more details.  You should have
// received a copy of the GNU Lesser General Public License along with
// dynamic-graph. If not, see <http://www.gnu.org/licenses/>.

#undef _POSIX_C_SOURCE
#undef _XOPEN_SOURCE
#include <Python.h>
#include <string>
#include "dynamic-graph/python/api.hh"
#include "dynamic-graph/python/deprecated.hh"

#ifndef DYNAMIC_GRAPH_PYTHON_INTERPRETER_H
#define DYNAMIC_GRAPH_PYTHON_INTERPRETER_H

#undef _POSIX_C_SOURCE
#undef _XOPEN_SOURCE
#include <dynamic-graph/python/fwd.hh>

#include "dynamic-graph/python/api.hh"
#include "dynamic-graph/python/python-compat.hh"

namespace dynamicgraph {
namespace python {
@@ -33,20 +18,20 @@ namespace dynamicgraph {
///
/// String sent to method python are interpreted by an onboard python
/// interpreter.
    class DYNAMIC_GRAPH_PYTHON_DLLAPI Interpreter
    {
class DYNAMIC_GRAPH_PYTHON_DLLAPI Interpreter {
 public:
  Interpreter();
  ~Interpreter();
  /// \brief Method to start python interperter.
  /// \param command string to execute
  /// Method deprecated, you *SHOULD* handle error messages.
      DYNAMIC_GRAPH_PYTHON_DEPRECATED std::string python( const std::string& command );
  [[deprecated("you *SHOULD* handle error messages")]] std::string python(
      const std::string& command);

  /// \brief Method to start python interperter.
  /// \param command string to execute, result, stdout, stderr strings
      void python( const std::string& command , std::string& result,
                   std::string& out, std::string& err);
  void python(const std::string& command, std::string& result, std::string& out,
              std::string& err);

  /// \brief Method to exectue a python script.
  /// \param filename the filename
@@ -62,14 +47,13 @@ namespace dynamicgraph {
  PyObject* globals();

 private:
      /// The Pythone thread state
  /// The Python thread state
  PyThreadState* _pyState;
  /// Pointer to the dictionary of global variables
  PyObject* globals_;
  /// Pointer to the dictionary of local variables
  PyObject* locals_;
  PyObject* mainmod_;
      PyObject* traceback_format_exception_;
};
}  // namespace python
}  // namespace dynamicgraph
+86 −0
Original line number Diff line number Diff line
#ifndef DYNAMIC_GRAPH_PYTHON_MODULE_HH
#define DYNAMIC_GRAPH_PYTHON_MODULE_HH

#ifdef PINOCCHIO_WITH_URDFDOM
// If pinocchio is used, we have to include pinocchio header before boost mpl
#include <pinocchio/fwd.hpp>
#endif

#include <dynamic-graph/entity.h>

#include <boost/mpl/for_each.hpp>
#include <boost/mpl/vector.hpp>
#include <boost/python.hpp>
#include <dynamic-graph/python/dynamic-graph-py.hh>

namespace dynamicgraph {
namespace python {

constexpr int AddSignals = 1;
constexpr int AddCommands = 2;

namespace internal {

template <typename T, int Options = AddCommands | AddSignals>
bp::object makeEntity1(const char* name) {
  Entity* ent = entity::create(T::CLASS_NAME.c_str(), name);
  assert(dynamic_cast<T*>(ent) != NULL);
  bp::object obj(bp::ptr(static_cast<T*>(ent)));
  if (Options & AddCommands) entity::addCommands(obj);
  if (Options & AddSignals) entity::addSignals(obj);
  return obj;
}
template <typename T, int Options = AddCommands | AddSignals>
bp::object makeEntity2() {
  return makeEntity1<T, Options>("");
}

}  // namespace internal

/// \tparam Options by default, all the signals and commands are added as
///         attribute to the Python object. This behaviour works fine for
///         entities that have static commands and signals.
///         If some commands or signals are added or removed dynamiccally, then
///         it is better to disable the default behaviour and handle it
///         specifically.
template <typename T,
          typename bases = boost::python::bases<dynamicgraph::Entity>,
          int Options = AddCommands | AddSignals>
inline auto exposeEntity() {
  // std::string hiddenClassName ("_" + T::CLASS_NAME);
  std::string hiddenClassName(T::CLASS_NAME);
  namespace bp = boost::python;
  bp::class_<T, bases, boost::noncopyable> obj(hiddenClassName.c_str(),
                                               bp::init<std::string>());
  /* TODO at the moment, I couldn't easily find a way to define a Python
  constructor
   * that would create the entity via the factory and then populate the
   * python object with its commands.
   * This is achieved with a factory function of the same name.
  obj.def ("__init__", bp::raw_function(+[](bp::object args, bp::dict) {
          if (bp::len(args) != 2)
            throw std::length_error("Expected 2 arguments.");
          bp::object self = args[0];
          self.attr("__init__")(bp::extract<std::string>(args[1]));
          Entity* ent = entity::create(T::CLASS_NAME.c_str(), name);
          if (dynamic_cast<T*>(ent) == NULL)
            std::cout << "foo" << std::endl;
          assert(dynamic_cast<T*>(ent) != NULL);
          self = bp::object(bp::ptr(static_cast<T*>(ent)));
          //dynamicgraph::Entity& unused =
  bp::extract<dynamicgraph::Entity&>(self);
          //entity::addCommands(self);
        })
  ;
  */
  bp::def(T::CLASS_NAME.c_str(), &internal::makeEntity1<T, Options>);
  bp::def(T::CLASS_NAME.c_str(), &internal::makeEntity2<T, Options>);
  if (!(Options & AddCommands)) obj.def("add_commands", &entity::addCommands);
  if (!(Options & AddSignals)) obj.def("add_signals", &entity::addSignals);
  return obj;
}

}  // namespace python
}  // namespace dynamicgraph

#endif  // DYNAMIC_GRAPH_PYTHON_MODULE_HH
+12 −0
Original line number Diff line number Diff line
#ifndef DGPY_PYTHON_COMPAT_H
#define DGPY_PYTHON_COMPAT_H

#include <string>

#define PY_SSIZE_T_CLEAN
#include <Python.h>

// Get any PyObject and get its str() representation as an std::string
std::string obj_to_str(PyObject* o);

#endif
+64 −0
Original line number Diff line number Diff line
// Copyright (c) 2018, Joseph Mirabel
// Authors: Joseph Mirabel (joseph.mirabel@laas.fr)

#ifndef DGPY_SIGNAL_WRAPPER
#define DGPY_SIGNAL_WRAPPER

#include <dynamic-graph/entity.h>
#include <dynamic-graph/linear-algebra.h>
#include <dynamic-graph/signal.h>

#include <boost/bind.hpp>
#include <boost/python.hpp>

#include "dynamic-graph/python/python-compat.hh"

namespace dynamicgraph {
namespace python {

class PythonSignalContainer : public Entity {
  DYNAMIC_GRAPH_ENTITY_DECL();

 public:
  using Entity::Entity;

  void signalRegistration(const SignalArray<int>& signals);

  void rmSignal(const std::string& name);
};

template <class T, class Time>
class SignalWrapper : public Signal<T, Time> {
 public:
  typedef Signal<T, Time> parent_t;
  typedef boost::python::object pyobject;

  static bool checkCallable(pyobject c, std::string& error);

  SignalWrapper(std::string name, pyobject callable)
      : parent_t(name), callable(callable) {
    typedef boost::function2<T&, T&, Time> function_t;
    function_t f = boost::bind(&SignalWrapper::call, this, _1, _2);
    this->setFunction(f);
  }

  virtual ~SignalWrapper(){};

 private:
  T& call(T& value, Time t) {
    PyGILState_STATE gstate;
    gstate = PyGILState_Ensure();
    if (PyGILState_GetThisThreadState() == NULL) {
      dgDEBUG(10) << "python thread not initialized" << std::endl;
    }
    pyobject obj = callable(t);
    value = boost::python::extract<T>(obj);
    PyGILState_Release(gstate);
    return value;
  }
  pyobject callable;
};

}  // namespace python
}  // namespace dynamicgraph
#endif
+72 −0
Original line number Diff line number Diff line
// Copyright 2020, Joseph Mirabel, LAAS-CNRS.

#include <dynamic-graph/signal-base.h>
#include <dynamic-graph/signal-ptr.h>
#include <dynamic-graph/signal-time-dependent.h>
#include <dynamic-graph/signal.h>

#include <boost/python.hpp>
#include <sstream>

#include "dynamic-graph/python/signal-wrapper.hh"

namespace dynamicgraph {
namespace python {

template <typename T, typename Time>
auto exposeSignal(const std::string& name) {
  namespace bp = boost::python;

  typedef Signal<T, Time> S_t;
  bp::class_<S_t, bp::bases<SignalBase<Time> >, boost::noncopyable> obj(
      name.c_str(), bp::init<std::string>());
  obj.add_property(
      "value",
      bp::make_function(&S_t::accessCopy,
                        bp::return_value_policy<bp::copy_const_reference>()),
      &S_t::setConstant,  // TODO check the setter
      "the signal value.\n"
      "warning: for Eigen objects, sig.value[0] = 1. may not work).");
  return obj;
}

template <typename T, typename Time>
auto exposeSignalWrapper(const std::string& name) {
  namespace bp = boost::python;

  typedef SignalWrapper<T, Time> S_t;
  bp::class_<S_t, bp::bases<Signal<T, Time> >, boost::noncopyable> obj(
      name.c_str(), bp::no_init);
  return obj;
}

template <typename T, typename Time>
auto exposeSignalPtr(const std::string& name) {
  namespace bp = boost::python;

  typedef SignalPtr<T, Time> S_t;
  bp::class_<S_t, bp::bases<Signal<T, Time> >, boost::noncopyable> obj(
      name.c_str(), bp::no_init);
  return obj;
}

template <typename T, typename Time>
auto exposeSignalTimeDependent(const std::string& name) {
  namespace bp = boost::python;

  typedef SignalTimeDependent<T, Time> S_t;
  bp::class_<S_t, bp::bases<Signal<T, Time> >, boost::noncopyable> obj(
      name.c_str(), bp::no_init);
  return obj;
}

template <typename T, typename Time>
void exposeSignalsOfType(const std::string& name) {
  exposeSignal<T, Time>("Signal" + name);
  exposeSignalPtr<T, Time>("SignalPtr" + name);
  exposeSignalWrapper<T, Time>("SignalWrapper" + name);
  exposeSignalTimeDependent<T, Time>("SignalTimeDependent" + name);
}

}  // namespace python
}  // namespace dynamicgraph

package.xml

0 → 100644
+32 −0
Original line number Diff line number Diff line
<?xml version="1.0"?>
<package format="3">
  <name>dynamic-graph-python</name>
  <version>4.0.11</version>
  <description>Dynamic graph library Python bindings</description>
  <maintainer email="guilhem.saurel@laas.fr">Guilhem Saurel</maintainer>
  <author>Nicolas Mansard</author>
  <author>Olivier Stasse</author>
  <license>BSD</license>

  <url type="website">https://github.com/stack-of-tasks/dynamic-graph-python</url>

  <build_depend>git</build_depend>
  <build_depend>doxygen</build_depend>

  <!-- The following tag is recommended by REP-136 -->
  <exec_depend condition="$ROS_VERSION == 1">catkin</exec_depend>

  <depend condition="$ROS_PYTHON_VERSION == 2">python</depend>
  <depend condition="$ROS_PYTHON_VERSION == 3">python3</depend>
  <depend condition="$ROS_PYTHON_VERSION == 2">python-numpy</depend>
  <depend condition="$ROS_PYTHON_VERSION == 3">python3-numpy</depend>
  <depend>eigen</depend>
  <depend>boost</depend>
  <depend>eigenpy</depend>
  <depend>dynamic-graph</depend>

  <buildtool_depend>cmake</buildtool_depend>
  <export>
    <build_type>cmake</build_type>
  </export>
</package>

pyproject.toml

0 → 100644
+3 −0
Original line number Diff line number Diff line
[tool.black]
exclude = "cmake"
extend-exclude = "tests/test_python-syntax_error.py"

setup.cfg

0 → 100644
+4 −0
Original line number Diff line number Diff line
[flake8]
exclude = cmake,tests/test_python-syntax_error.py
max-line-length = 88
ignore = E226, E704, E24, E121, W504, E126, E123, W503, E203
+15 −115
Original line number Diff line number Diff line
# Copyright 2010, 2011, Florent Lamiraux, Thomas Moulard, JRL, CNRS/AIST
#
# This file is part of dynamic-graph-python.
# dynamic-graph-python is free software: you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public License
# as published by the Free Software Foundation, either version 3 of
# the License, or (at your option) any later version.
#
# dynamic-graph-python is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# General Lesser Public License for more details.  You should have
# received a copy of the GNU Lesser General Public License along with
# dynamic-graph-python. If not, see <http://www.gnu.org/licenses/>.

#
# Python
#

INCLUDE_DIRECTORIES(SYSTEM ${Boost_INCLUDE_DIRS})
LINK_DIRECTORIES(${Boost_LIBRARY_DIRS} ${PYTHON_LIBRARY_DIRS})

#
#
#  Python interpreter
#
#
SET(LIBRARY_NAME ${PROJECT_NAME})
ADD_LIBRARY(${LIBRARY_NAME}
  SHARED
  interpreter.cc)

TARGET_LINK_LIBRARIES(${LIBRARY_NAME}
  ${PYTHON_LIBRARY})
TARGET_LINK_BOOST_PYTHON(${LIBRARY_NAME})

IF(UNIX)
  TARGET_LINK_LIBRARIES(${LIBRARY_NAME} ${Boost_LIBRARIES})
  TARGET_LINK_LIBRARIES(${LIBRARY_NAME} ${CMAKE_DL_LIBS})
ENDIF(UNIX)

SET_TARGET_PROPERTIES(${LIBRARY_NAME} PROPERTIES SOVERSION ${PROJECT_VERSION})
PKG_CONFIG_USE_DEPENDENCY(${LIBRARY_NAME} dynamic-graph)

INSTALL(TARGETS ${LIBRARY_NAME}
  DESTINATION lib)

#
#