Commit e20645d9 authored by Olivier Stasse's avatar Olivier Stasse
Browse files

Merge jm in devel

parents ed39db7c af82eeef
Pipeline #7540 failed with stage
in 3 minutes and 13 seconds
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/
Subproject commit 4e78d6f1ece19639c6ebdda18b2f081c784e3d04 Subproject commit 083fa2cb0fa4ad594926d9bb3d246075e62ce9ee
...@@ -21,10 +21,13 @@ INCLUDE(cmake/eigen.cmake) ...@@ -21,10 +21,13 @@ INCLUDE(cmake/eigen.cmake)
INCLUDE(cmake/pthread.cmake) INCLUDE(cmake/pthread.cmake)
INCLUDE(cmake/cpack.cmake) INCLUDE(cmake/cpack.cmake)
include(cmake/header.cmake) include(cmake/header.cmake)
include(cmake/python.cmake)
SET(PROJECT_NAME dynamic-graph-python) SET(PROJECT_NAME dynamic-graph-python)
SET(PROJECT_DESCRIPTION "Dynamic graph library Python bindings") SET(PROJECT_DESCRIPTION "Dynamic graph library Python bindings")
SET(PROJECT_URL "http://github.com/jrl-umi3218/dynamic-graph-python") SET(PROJECT_URL "http://github.com/stack-of-tasks/dynamic-graph-python")
SET(DOXYGEN_USE_MATHJAX YES)
SET(CUSTOM_HEADER_DIR "dynamic-graph/python") SET(CUSTOM_HEADER_DIR "dynamic-graph/python")
# Headers list. # Headers list.
...@@ -39,6 +42,8 @@ SET(PKG_CONFIG_ADDITIONAL_VARIABLES plugindir ${PKG_CONFIG_ADDITIONAL_VARIABLES} ...@@ -39,6 +42,8 @@ SET(PKG_CONFIG_ADDITIONAL_VARIABLES plugindir ${PKG_CONFIG_ADDITIONAL_VARIABLES}
SETUP_PROJECT() SETUP_PROJECT()
FINDPYTHON(2.7 EXACT REQUIRED)
# Trigger dependency to dynamic-graph. # Trigger dependency to dynamic-graph.
ADD_REQUIRED_DEPENDENCY("dynamic-graph >= 3.0.0") ADD_REQUIRED_DEPENDENCY("dynamic-graph >= 3.0.0")
......
GNU LESSER GENERAL PUBLIC LICENSE BSD 2-Clause License
Version 3, 29 June 2007
Copyright (c) 2018, CNRS
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/> Author: Stack of Tasks Development Team
Everyone is permitted to copy and distribute verbatim copies All rights reserved.
of this license document, but changing it is not allowed.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
This version of the GNU Lesser General Public License incorporates
the terms and conditions of version 3 of the GNU General Public * Redistributions of source code must retain the above copyright notice, this
License, supplemented by the additional permissions listed below. list of conditions and the following disclaimer.
0. Additional Definitions. * Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
As used herein, "this License" refers to version 3 of the GNU Lesser and/or other materials provided with the distribution.
General Public License, and the "GNU GPL" refers to version 3 of the GNU
General Public License. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
"The Library" refers to a covered work governed by this License, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
other than an Application or a Combined Work as defined below. DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
An "Application" is any work that makes use of an interface provided DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
by the Library, but which is not otherwise based on the Library. SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
Defining a subclass of a class defined by the Library is deemed a mode CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
of using an interface provided by the Library. OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
A "Combined Work" is a work produced by combining or linking an
Application with the Library. The particular version of the Library
with which the Combined Work was made is also called the "Linked
Version".
The "Minimal Corresponding Source" for a Combined Work means the
Corresponding Source for the Combined Work, excluding any source code
for portions of the Combined Work that, considered in isolation, are
based on the Application, and not on the Linked Version.
The "Corresponding Application Code" for a Combined Work means the
object code and/or source code for the Application, including any data
and utility programs needed for reproducing the Combined Work from the
Application, but excluding the System Libraries of the Combined Work.
1. Exception to Section 3 of the GNU GPL.
You may convey a covered work under sections 3 and 4 of this License
without being bound by section 3 of the GNU GPL.
2. Conveying Modified Versions.
If you modify a copy of the Library, and, in your modifications, a
facility refers to a function or data to be supplied by an Application
that uses the facility (other than as an argument passed when the
facility is invoked), then you may convey a copy of the modified
version:
a) under this License, provided that you make a good faith effort to
ensure that, in the event an Application does not supply the
function or data, the facility still operates, and performs
whatever part of its purpose remains meaningful, or
b) under the GNU GPL, with none of the additional permissions of
this License applicable to that copy.
3. Object Code Incorporating Material from Library Header Files.
The object code form of an Application may incorporate material from
a header file that is part of the Library. You may convey such object
code under terms of your choice, provided that, if the incorporated
material is not limited to numerical parameters, data structure
layouts and accessors, or small macros, inline functions and templates
(ten or fewer lines in length), you do both of the following:
a) Give prominent notice with each copy of the object code that the
Library is used in it and that the Library and its use are
covered by this License.
b) Accompany the object code with a copy of the GNU GPL and this license
document.
4. Combined Works.
You may convey a Combined Work under terms of your choice that,
taken together, effectively do not restrict modification of the
portions of the Library contained in the Combined Work and reverse
engineering for debugging such modifications, if you also do each of
the following:
a) Give prominent notice with each copy of the Combined Work that
the Library is used in it and that the Library and its use are
covered by this License.
b) Accompany the Combined Work with a copy of the GNU GPL and this license
document.
c) For a Combined Work that displays copyright notices during
execution, include the copyright notice for the Library among
these notices, as well as a reference directing the user to the
copies of the GNU GPL and this license document.
d) Do one of the following:
0) Convey the Minimal Corresponding Source under the terms of this
License, and the Corresponding Application Code in a form
suitable for, and under terms that permit, the user to
recombine or relink the Application with a modified version of
the Linked Version to produce a modified Combined Work, in the
manner specified by section 6 of the GNU GPL for conveying
Corresponding Source.
1) Use a suitable shared library mechanism for linking with the
Library. A suitable mechanism is one that (a) uses at run time
a copy of the Library already present on the user's computer
system, and (b) will operate properly with a modified version
of the Library that is interface-compatible with the Linked
Version.
e) Provide Installation Information, but only if you would otherwise
be required to provide such information under section 6 of the
GNU GPL, and only to the extent that such information is
necessary to install and execute a modified version of the
Combined Work produced by recombining or relinking the
Application with a modified version of the Linked Version. (If
you use option 4d0, the Installation Information must accompany
the Minimal Corresponding Source and Corresponding Application
Code. If you use option 4d1, you must provide the Installation
Information in the manner specified by section 6 of the GNU GPL
for conveying Corresponding Source.)
5. Combined Libraries.
You may place library facilities that are a work based on the
Library side by side in a single library together with other library
facilities that are not Applications and are not covered by this
License, and convey such a combined library under terms of your
choice, if you do both of the following:
a) Accompany the combined library with a copy of the same work based
on the Library, uncombined with any other library facilities,
conveyed under the terms of this License.
b) Give prominent notice with the combined library that part of it
is a work based on the Library, and explaining where to find the
accompanying uncombined form of the same work.
6. Revised Versions of the GNU Lesser General Public License.
The Free Software Foundation may publish revised and/or new versions
of the GNU Lesser General Public License from time to time. Such new
versions will be similar in spirit to the present version, but may
differ in detail to address new problems or concerns.
Each version is given a distinguishing version number. If the
Library as you received it specifies that a certain numbered version
of the GNU Lesser General Public License "or any later version"
applies to it, you have the option of following the terms and
conditions either of that published version or of any later version
published by the Free Software Foundation. If the Library as you
received it does not specify a version number of the GNU Lesser
General Public License, you may choose any version of the GNU Lesser
General Public License ever published by the Free Software Foundation.
If the Library as you received it specifies that a proxy can decide
whether future versions of the GNU Lesser General Public License shall
apply, that proxy's public statement of acceptance of any version is
permanent authorization for you to choose that version for the
Library.
dynamic-graph-python dynamic-graph-python
==================== ====================
[![Build Status](https://travis-ci.org/stack-of-tasks/dynamic-graph-python.png?branch=master)](https://travis-ci.org/stack-of-tasks/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)
[![Coverage Status](https://coveralls.io/repos/stack-of-tasks/dynamic-graph-python/badge.png)](https://coveralls.io/r/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/)
Python bindings for dynamic-graph. Python bindings for dynamic-graph.
......
Subproject commit 8e9b46446f92899025173f047b3950fcd21b89f4 Subproject commit 99aafa43694125e67046bdc91c7b6485b5b6ca45
...@@ -62,6 +62,8 @@ namespace dynamicgraph { ...@@ -62,6 +62,8 @@ namespace dynamicgraph {
PyObject* globals(); PyObject* globals();
private: private:
/// The Pythone thread state
PyThreadState *_pyState;
/// Pointer to the dictionary of global variables /// Pointer to the dictionary of global variables
PyObject* globals_; PyObject* globals_;
/// Pointer to the dictionary of local variables /// Pointer to the dictionary of local variables
......
...@@ -16,14 +16,10 @@ ...@@ -16,14 +16,10 @@
# #
# Python # Python
# #
set(Python_ADDITIONAL_VERSIONS 2.7 2.6 2.5 2.4 2.3 2.2 2.1 2.0)
INCLUDE(../cmake/python.cmake)
FINDPYTHON()
INCLUDE_DIRECTORIES(${Boost_INCLUDE_DIRS}) INCLUDE_DIRECTORIES(SYSTEM ${Boost_INCLUDE_DIRS})
LINK_DIRECTORIES(${Boost_LIBRARY_DIRS} ${PYTHON_LIBRARY_DIRS}) LINK_DIRECTORIES(${Boost_LIBRARY_DIRS} ${PYTHON_LIBRARY_DIRS})
INCLUDE(../cmake/python.cmake)
# #
# #
# Python interpreter # Python interpreter
...@@ -36,6 +32,7 @@ ADD_LIBRARY(${LIBRARY_NAME} ...@@ -36,6 +32,7 @@ ADD_LIBRARY(${LIBRARY_NAME}
TARGET_LINK_LIBRARIES(${LIBRARY_NAME} TARGET_LINK_LIBRARIES(${LIBRARY_NAME}
${PYTHON_LIBRARY}) ${PYTHON_LIBRARY})
TARGET_LINK_BOOST_PYTHON(${LIBRARY_NAME})
IF(UNIX) IF(UNIX)
TARGET_LINK_LIBRARIES(${LIBRARY_NAME} ${Boost_LIBRARIES}) TARGET_LINK_LIBRARIES(${LIBRARY_NAME} ${Boost_LIBRARIES})
...@@ -46,14 +43,7 @@ SET_TARGET_PROPERTIES(${LIBRARY_NAME} PROPERTIES SOVERSION ${PROJECT_VERSION}) ...@@ -46,14 +43,7 @@ SET_TARGET_PROPERTIES(${LIBRARY_NAME} PROPERTIES SOVERSION ${PROJECT_VERSION})
PKG_CONFIG_USE_DEPENDENCY(${LIBRARY_NAME} dynamic-graph) PKG_CONFIG_USE_DEPENDENCY(${LIBRARY_NAME} dynamic-graph)
INSTALL(TARGETS ${LIBRARY_NAME} INSTALL(TARGETS ${LIBRARY_NAME}
DESTINATION ${CMAKE_INSTALL_LIBDIR}) DESTINATION lib)
SET(EXECUTABLE_NAME dg-python)
ADD_EXECUTABLE(${EXECUTABLE_NAME} dg-python.cc)
TARGET_LINK_LIBRARIES(${EXECUTABLE_NAME}
${LIBRARY_NAME}
)
INSTALL(TARGETS dg-python DESTINATION ${CMAKE_INSTALL_BINDIR})
# #
# #
...@@ -64,15 +54,17 @@ INSTALL(TARGETS dg-python DESTINATION ${CMAKE_INSTALL_BINDIR}) ...@@ -64,15 +54,17 @@ INSTALL(TARGETS dg-python DESTINATION ${CMAKE_INSTALL_BINDIR})
SET(PYTHON_MODULE wrap) SET(PYTHON_MODULE wrap)
ADD_LIBRARY(${PYTHON_MODULE} ADD_LIBRARY(${PYTHON_MODULE}
MODULE MODULE
exception-python.cc convert-dg-to-py.cc
convert-dg-to-py.cc debug-py.cc
dynamic-graph-py.cc dynamic-graph-py.cc
signal-base-py.cc entity-py.cc
entity-py.cc exception-python.cc
factory-py.cc factory-py.cc
pool-py.cc pool-py.cc
signal-caster-py.cc signal-base-py.cc
signal-caster-py.cc
signal-wrapper.cc
) )
# Remove prefix lib # Remove prefix lib
...@@ -83,8 +75,8 @@ PKG_CONFIG_USE_DEPENDENCY(${PYTHON_MODULE} dynamic-graph) ...@@ -83,8 +75,8 @@ PKG_CONFIG_USE_DEPENDENCY(${PYTHON_MODULE} dynamic-graph)
#TARGET_LINK_LIBRARIES(${PYTHON_MODULE} ${PYTHON_LIBRARY}) #TARGET_LINK_LIBRARIES(${PYTHON_MODULE} ${PYTHON_LIBRARY})
CONFIG_FILES(link-to-python.hh) CONFIG_FILES(link-to-python.hh)
INCLUDE_DIRECTORIES(${PYTHON_INCLUDE_PATH} INCLUDE_DIRECTORIES(SYSTEM ${PYTHON_INCLUDE_PATH})
${CMAKE_CURRENT_BINARY_DIR}) INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR})
# #
# Installation # Installation
...@@ -126,5 +118,3 @@ ELSE(WIN32) ...@@ -126,5 +118,3 @@ ELSE(WIN32)
SET(TRACERREALTIME_PLUGIN ${DYNAMIC_GRAPH_PLUGINDIR}/tracer-real-time${CMAKE_SHARED_LIBRARY_SUFFIX}) SET(TRACERREALTIME_PLUGIN ${DYNAMIC_GRAPH_PLUGINDIR}/tracer-real-time${CMAKE_SHARED_LIBRARY_SUFFIX})
ENDIF(WIN32) ENDIF(WIN32)
DYNAMIC_GRAPH_PYTHON_MODULE("tracer_real_time" ${TRACERREALTIME_PLUGIN} tracer_real_time-wrap) DYNAMIC_GRAPH_PYTHON_MODULE("tracer_real_time" ${TRACERREALTIME_PLUGIN} tracer_real_time-wrap)
...@@ -31,14 +31,14 @@ namespace dynamicgraph { ...@@ -31,14 +31,14 @@ namespace dynamicgraph {
namespace convert { namespace convert {
void fillMatrixRow(Matrix& m, unsigned iRow, PyObject* tuple) void fillMatrixRow(Matrix& m, unsigned iRow, PyObject* sequence)
{ {
if (PyTuple_Size(tuple) != (int)m.cols()) { if (PySequence_Size(sequence) != (int)m.cols()) {
throw ExceptionPython(ExceptionPython::MATRIX_PARSING, throw ExceptionPython(ExceptionPython::MATRIX_PARSING,
"lines of matrix have different sizes."); "lines of matrix have different sizes.");
} }
for (int iCol=0; iCol < m.cols(); iCol++) { for (int iCol=0; iCol < m.cols(); iCol++) {
PyObject* pyDouble = PyTuple_GetItem(tuple, iCol); PyObject* pyDouble = PySequence_GetItem(sequence, iCol);
if (PyFloat_Check(pyDouble)) if (PyFloat_Check(pyDouble))
m(iRow, iCol) = PyFloat_AsDouble(pyDouble); m(iRow, iCol) = PyFloat_AsDouble(pyDouble);
else if(PyInt_Check(pyDouble)) else if(PyInt_Check(pyDouble))
...@@ -49,14 +49,14 @@ namespace dynamicgraph { ...@@ -49,14 +49,14 @@ namespace dynamicgraph {
"a floating point number."); "a floating point number.");
} }
} }
void fillMatrixRow(Eigen::Matrix4d& m, unsigned iRow, PyObject* tuple) void fillMatrixRow(Eigen::Matrix4d& m, unsigned iRow, PyObject* sequence)
{ {
if (PyTuple_Size(tuple) != (int)m.cols()) { if (PySequence_Size(sequence) != (int)m.cols()) {
throw ExceptionPython(ExceptionPython::MATRIX_PARSING, throw ExceptionPython(ExceptionPython::MATRIX_PARSING,
"lines of matrix have different sizes."); "lines of matrix have different sizes.");
} }
for (int iCol=0; iCol < m.cols(); iCol++) { for (int iCol=0; iCol < m.cols(); iCol++) {
PyObject* pyDouble = PyTuple_GetItem(tuple, iCol); PyObject* pyDouble = PySequence_GetItem(sequence, iCol);
if (PyFloat_Check(pyDouble)) if (PyFloat_Check(pyDouble))
m(iRow, iCol) = PyFloat_AsDouble(pyDouble); m(iRow, iCol) = PyFloat_AsDouble(pyDouble);
else if(PyInt_Check(pyDouble)) else if(PyInt_Check(pyDouble))
...@@ -145,14 +145,14 @@ namespace dynamicgraph { ...@@ -145,14 +145,14 @@ namespace dynamicgraph {
break; break;
case (Value::VECTOR) : case (Value::VECTOR) :
// Check that argument is a tuple // Check that argument is a tuple
if (!PyTuple_Check(pyObject)) { if (!PySequence_Check(pyObject)) {
throw ExceptionPython(ExceptionPython::VALUE_PARSING, throw ExceptionPython(ExceptionPython::VALUE_PARSING,
"vector"); "vector");
} }
size = PyTuple_Size(pyObject); size = PySequence_Size(pyObject);
v.resize(size); v.resize(size);
for (Py_ssize_t i=0; i<size; i++) { for (Py_ssize_t i=0; i<size; i++) {
PyObject* pyDouble = PyTuple_GetItem(pyObject, i); PyObject* pyDouble = PySequence_GetItem(pyObject, i);
if (PyFloat_Check(pyDouble)) if (PyFloat_Check(pyDouble))
v(i) = PyFloat_AsDouble(pyDouble); v(i) = PyFloat_AsDouble(pyDouble);
else if(PyInt_Check(pyDouble)) else if(PyInt_Check(pyDouble))
...@@ -166,27 +166,27 @@ namespace dynamicgraph { ...@@ -166,27 +166,27 @@ namespace dynamicgraph {
break; break;
case (Value::MATRIX) : case (Value::MATRIX) :
// Check that argument is a tuple // Check that argument is a tuple
if (!PyTuple_Check(pyObject)) { if (!PySequence_Check(pyObject)) {
throw ExceptionPython(ExceptionPython::VALUE_PARSING, throw ExceptionPython(ExceptionPython::VALUE_PARSING,
"matrix"); "matrix");
} }
nRows = PyTuple_Size(pyObject); nRows = PySequence_Size(pyObject);
if (nRows == 0) { if (nRows == 0) {
return Value(Matrix()); return Value(Matrix());
} }
row = PyTuple_GetItem(pyObject, 0); row = PySequence_GetItem(pyObject, 0);
if (!PyTuple_Check(row)) { if (!PySequence_Check(row)) {
throw ExceptionPython(ExceptionPython::MATRIX_PARSING, throw ExceptionPython(ExceptionPython::MATRIX_PARSING,
"matrix"); "matrix");
} }
nCols = PyTuple_Size(row); nCols = PySequence_Size(row);
m.resize((unsigned int)nRows, (unsigned int)nCols); m.resize((unsigned int)nRows, (unsigned int)nCols);
fillMatrixRow(m, 0, row); fillMatrixRow(m, 0, row);
for (Py_ssize_t iRow=1; iRow<nRows; iRow++) { for (Py_ssize_t iRow=1; iRow<nRows; iRow++) {
row = PyTuple_GetItem(pyObject, iRow); row = PySequence_GetItem(pyObject, iRow);
if (!PyTuple_Check(row)) { if (!PySequence_Check(row)) {
throw ExceptionPython(ExceptionPython::MATRIX_PARSING, throw ExceptionPython(ExceptionPython::MATRIX_PARSING,
"matrix"); "matrix");
} }
...@@ -196,27 +196,27 @@ namespace dynamicgraph { ...@@ -196,27 +196,27 @@ namespace dynamicgraph {
break; break;
case (Value::MATRIX4D) : case (Value::MATRIX4D) :
// Check that argument is a tuple // Check that argument is a tuple
if (!PyTuple_Check(pyObject)) { if (!PySequence_Check(pyObject)) {
throw ExceptionPython(ExceptionPython::VALUE_PARSING, throw ExceptionPython(ExceptionPython::VALUE_PARSING,
"matrix4d"); "matrix4d");
} }
nRows = PyTuple_Size(pyObject); nRows = PySequence_Size(pyObject);
if (nRows == 0) { if (nRows == 0) {
return Value(Eigen::Matrix4d()); return Value(Eigen::Matrix4d());
} }
row = PyTuple_GetItem(pyObject, 0); row = PySequence_GetItem(pyObject, 0);
if (!PyTuple_Check(row)) { if (!PySequence_Check(row)) {
throw ExceptionPython(ExceptionPython::MATRIX_PARSING, throw ExceptionPython(ExceptionPython::MATRIX_PARSING,
"matrix4d"); "matrix4d");
} }
nCols = PyTuple_Size(row); nCols = PySequence_Size(row);
m4.resize(nRows, nCols); m4.resize(nRows, nCols);
fillMatrixRow(m4, 0, row); fillMatrixRow(m4, 0, row);
for (Py_ssize_t iRow=1; iRow<nRows; iRow++) { for (Py_ssize_t iRow=1; iRow<nRows; iRow++) {
row = PyTuple_GetItem(pyObject, iRow); row = PySequence_GetItem(pyObject, iRow);
if (!PyTuple_Check(row)) { if (!PySequence_Check(row)) {
throw ExceptionPython(ExceptionPython::MATRIX_PARSING, throw ExceptionPython(ExceptionPython::MATRIX_PARSING,
"matrix"); "matrix");
} }
...@@ -321,3 +321,4 @@ namespace dynamicgraph { ...@@ -321,3 +321,4 @@ namespace dynamicgraph {
} // namespace dynamicgraph } // namespace dynamicgraph
} // namespace python } // namespace python
} // namespace convert } // namespace convert
// Copyright 2019, Olivier Stasse, LAAS-CNRS.
//
// See LICENSE
#include <iostream>
#define ENABLE_RT_LOG
#include <dynamic-graph/real-time-logger.h>
#include <map>
#include <Python.h>
#include <dynamic-graph/pool.h>
#include <dynamic-graph/entity.h>
#include <vector>
#include "exception.hh"
#include <boost/shared_ptr.hpp>
typedef boost::shared_ptr<std::ofstream> ofstreamShrPtr;
namespace dynamicgraph {
namespace python {
extern PyObject* dgpyError;
namespace debug {
std::map<std::string, ofstreamShrPtr > mapOfFiles_