Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PyKDL: PyBind11 based #229

Merged
merged 136 commits into from
May 6, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
136 commits
Select commit Hold shift + click to select a range
dbe38c9
Added pybind11 KDL binding
zchen24 Jul 20, 2018
d6ef153
Working CMake with PyBind11
MatthijsBurgh Feb 7, 2020
aae2a17
Test PyBind11 in travis
MatthijsBurgh Feb 7, 2020
4c4193e
Added pickle support for frames and framevel
zchen24 Feb 8, 2020
cf757f8
Add description to default args
MatthijsBurgh Feb 9, 2020
ebacacb
Use install(TARGETS) for PyBind
MatthijsBurgh Feb 10, 2020
2d75ad0
(travis) specify os and dist
MatthijsBurgh Feb 10, 2020
c9249d4
Move pybind11 and sip into seperate folders
MatthijsBurgh Feb 14, 2020
09acd10
Depend on all SIP includes, to trigger a rebuild if any of the sip fi…
MatthijsBurgh Feb 14, 2020
c5c7a61
Whitespace fixes in SIP files
MatthijsBurgh Feb 14, 2020
f9c1822
Use PyBind11 by default
MatthijsBurgh Feb 15, 2020
1f0e3e0
Remove double line
MatthijsBurgh Feb 16, 2020
931b4e2
remove bracket from default value descriptions
MatthijsBurgh Feb 16, 2020
8b42269
Add pybind11 stl container support
MatthijsBurgh Feb 16, 2020
ce174ed
Remove get(Root)Segment of Tree from PyKDL
MatthijsBurgh Feb 16, 2020
a0497c7
(PyKDL) use classnames in declerations
MatthijsBurgh Feb 16, 2020
77f6ecf
Move declerations so class is defined before used by other classes/fu…
MatthijsBurgh Feb 16, 2020
8ed2b21
remove unneeded uint cast in frame __getitem__
MatthijsBurgh Feb 16, 2020
27d92f7
Add pybind11 eigen support
MatthijsBurgh Feb 16, 2020
d4095f0
Add __setitem__ to jnt_space_inertia_matrix
MatthijsBurgh Feb 17, 2020
9d58638
fix __getitem__ of rotation
MatthijsBurgh Feb 17, 2020
194c762
Add __setitem__ to rotation
MatthijsBurgh Feb 17, 2020
2c7b633
(PyKDL) remove manifest.xml
MatthijsBurgh Feb 17, 2020
9d7b663
(PyKDL) remove mainpage.dox
MatthijsBurgh Feb 17, 2020
65b1d8f
(PyKDL) Add properties to Vector
MatthijsBurgh Feb 18, 2020
c222077
(PyKDL) add comment to use properties in Vector
MatthijsBurgh Feb 18, 2020
4b5f8e1
(PyKDL) style update test
MatthijsBurgh Mar 14, 2020
00b8717
(PyKDL) Update tests
MatthijsBurgh Mar 14, 2020
b0217ad
Revert "(PyKDL) add comment to use properties in Vector"
MatthijsBurgh Mar 15, 2020
8b60991
Revert "(PyKDL) Add properties to Vector"
MatthijsBurgh Mar 15, 2020
009e2ee
(PyKDL) extend Vector tests
MatthijsBurgh Mar 15, 2020
8754311
(PyKDL) extend Twist tests
MatthijsBurgh Mar 15, 2020
4272586
(PyKDL) extend Wrench tests
MatthijsBurgh Mar 15, 2020
81574ee
(PyKDL)(sip) fix getitem/setitem code
MatthijsBurgh Mar 15, 2020
d0d0fd4
(PyKDL) fix setWeightTS and setWeightJS;
MatthijsBurgh Mar 15, 2020
52349c6
(PyKDL) extend Rotation tests
MatthijsBurgh Mar 15, 2020
449f9bb
(PyKDL) extend Frame tests
MatthijsBurgh Mar 15, 2020
bb2b700
(PyKDL) Add test for member of unassgined instances
MatthijsBurgh Mar 15, 2020
65b22c1
(travis) add allow_failures
MatthijsBurgh Mar 15, 2020
525cb28
(PyKDL) docstring to comment
MatthijsBurgh Mar 16, 2020
32b4e9a
(PyKDL) use context manager in pickle test
MatthijsBurgh Mar 16, 2020
aa72abc
(PyKDL) add value and grad to doubleVel
MatthijsBurgh Mar 16, 2020
cd383ca
(PyKDL) remove typedef of doubleVel
MatthijsBurgh Mar 16, 2020
1f0cb35
(PyKDL) add doubleVel test
MatthijsBurgh Mar 16, 2020
5166249
(kdl) remove inlcude of yourself
MatthijsBurgh Mar 16, 2020
cb34686
(PyKDL) framevel pickle tests use Equal func
MatthijsBurgh Mar 16, 2020
aebdab9
(kdl) include types in Rall1d oss
MatthijsBurgh Mar 16, 2020
a1470db
(PyKDL)(sip) add __repr__ for framevel classes
MatthijsBurgh Mar 16, 2020
9d9de4e
(PyKDL) add __repr__ for framevel classes
MatthijsBurgh Mar 16, 2020
a03ee0d
(PyKDL) add copy constructors for framevel classes
MatthijsBurgh Mar 16, 2020
410ae35
(PyKDL) pickle test python3 compatible
MatthijsBurgh Mar 16, 2020
20bb456
(PyKDL) fix import and test results
MatthijsBurgh Mar 16, 2020
5b02354
(kdl) rename config to cmake
MatthijsBurgh Mar 16, 2020
aa54b5b
(kdl) cleanup of repetetive cmake code
MatthijsBurgh Mar 16, 2020
4dacfa6
(kdl) remove unused dependentoption
MatthijsBurgh Mar 16, 2020
52a57b9
(kdl) remove outdated test targets
MatthijsBurgh Mar 16, 2020
33936db
(kdl) cleanup commented includes
MatthijsBurgh Mar 16, 2020
a3afe45
(kdl) add more equality operators
MatthijsBurgh Mar 16, 2020
0a848e1
(PyKDL) add equality operators
MatthijsBurgh Mar 16, 2020
dd42602
(PyKDL)(sip) add equality operators
MatthijsBurgh Mar 16, 2020
09bd8ce
(PyKDL) pickle test use assertEqual after adding equality operators
MatthijsBurgh Mar 16, 2020
564ea70
(kdl) initialize members for Rall1d/Rall2d
MatthijsBurgh Mar 17, 2020
ab11a57
(PyKDL) improve member tests
MatthijsBurgh Mar 20, 2020
b0b4582
(PyKDL) add setToZero for VectorVel
MatthijsBurgh Mar 20, 2020
85177f0
(PyKDL) assertEqual to assertAlmostEqual
MatthijsBurgh Mar 20, 2020
38d7f05
(PyKDL) add constructor of doubleVel
MatthijsBurgh Mar 20, 2020
b7b1310
(PyKDL) update VectorVel tests
MatthijsBurgh Mar 20, 2020
a031317
(kdl) fix Rall1d io
MatthijsBurgh Mar 20, 2020
0ca4f2e
(PyKDL) add constructor of doubleVel
MatthijsBurgh Mar 20, 2020
f9bd311
(PyKDL) add unary operator of doubleVel
MatthijsBurgh Mar 20, 2020
4a2cfc4
(PyKDL) add member(function) tests for VectorVel
MatthijsBurgh Mar 20, 2020
8592a23
(PyKDL) add TwistVel tests
MatthijsBurgh Mar 20, 2020
23e43d2
(PyKDL) add comments to tests
MatthijsBurgh Mar 20, 2020
fc98382
(PyKDL)(sip) add doubleVel constructors
MatthijsBurgh Mar 20, 2020
f36dacc
(PyKDL)(sip) add vectorVel setToZero
MatthijsBurgh Mar 20, 2020
0859e43
(kdl) add type info to Rall2d io
MatthijsBurgh Mar 21, 2020
0456311
(PyKDL) add unary test for doubleVel
MatthijsBurgh Mar 21, 2020
70ba2bd
(PyKDL) use assertEqual in VectorVel test
MatthijsBurgh Mar 22, 2020
033a8e6
(PyKDL) use assertEqual in TwistVel test
MatthijsBurgh Mar 22, 2020
8d29375
(PyKDL) extend TwistVel test
MatthijsBurgh Mar 22, 2020
725fcd5
(PyKDL)(sip) add unary operator to doubleVel
MatthijsBurgh Mar 22, 2020
57dab43
(PyKDL)(sip) styling in VectorVel
MatthijsBurgh Mar 22, 2020
45d8666
(PyKDL) fix TwistVel test
MatthijsBurgh Mar 22, 2020
5074de1
(kdl) don't divide by zero
MatthijsBurgh Mar 22, 2020
19895c7
(PyKDL) Improve Rotation test
MatthijsBurgh Mar 23, 2020
b337902
(PyKDL) add JntToCart functions to ChainFkSolvers
MatthijsBurgh Mar 28, 2020
cb6fb98
(PyKDL)(sip) add JntToCart functions to ChainFkSolvers
MatthijsBurgh Mar 28, 2020
0e2a8ae
(PyKDL)(sip) move std::vector support to seperate file
MatthijsBurgh Mar 28, 2020
de2d114
(PyKDL)(sip) add __setitem__ to JntSpaceInertiaMatrix
MatthijsBurgh Mar 28, 2020
ea317a8
(PyKDL) update RotationVel tests
MatthijsBurgh Mar 28, 2020
f842b4a
(PyKDL) update FrameVel tests
MatthijsBurgh Mar 28, 2020
5f07a90
(PyKDL)(sip) add extra __repr__ of kinfam
MatthijsBurgh Mar 28, 2020
a1d75a3
(PyKDL) add extra __repr__ of kinfam
MatthijsBurgh Mar 28, 2020
f23b898
(PyKDL) fix __getitem__ and __setitem__ of Jacobian
MatthijsBurgh Mar 28, 2020
3cea7a4
(PyKDL)(sip) fix include
MatthijsBurgh Mar 28, 2020
a1ff349
(kdl) initialize jacobian with zeros
MatthijsBurgh Mar 28, 2020
a774407
(PyKDL) add empty constructors to Jacobian and JntArray
MatthijsBurgh Mar 28, 2020
751ea67
(PyKDL)(sip) add empty constructors to Jacobian and JntArray
MatthijsBurgh Mar 28, 2020
37f64d9
(PyKDL) fix __getitem__ and __setitem__ of JntArray
MatthijsBurgh Mar 28, 2020
a7a7bea
(PyKDL) add __getitem__ and __setitem__ tests
MatthijsBurgh Mar 28, 2020
4b7eced
(PyKDL) fix __getitem__ and __setitem__ of JntSpaceInertiaMatrix
MatthijsBurgh Mar 28, 2020
eca64f7
(PyKDL)(sip) fix __getitem__ and __setitem__ of JntSpaceInertiaMatrix
MatthijsBurgh Mar 28, 2020
130c049
(PyKDL) add dynamics tests
MatthijsBurgh Mar 28, 2020
733dc66
(PyKDL) remove functions using containers as arg by ref
MatthijsBurgh Mar 29, 2020
f220652
(PyKDL)(sip) remove functions using containers as arg by ref
MatthijsBurgh Mar 29, 2020
6bbea2e
(travis) SIP is fixed, so remove allow_failures
MatthijsBurgh Apr 1, 2020
1540386
(travis) Also test python 3
MatthijsBurgh Apr 16, 2020
f4edb65
set PYTHON_MODULE_EXTENSION to '.so'
MatthijsBurgh Apr 16, 2020
4634955
(PyKDL) change install path
MatthijsBurgh Apr 17, 2020
dce6742
(kdl) Replace None by Fixed, None points towards Fixed
MatthijsBurgh Apr 17, 2020
acd6226
(PyKDL)(SIP) vector python3 compatible
MatthijsBurgh Apr 17, 2020
a06eb73
(PyKDL)(SIP) string python3 compatible
MatthijsBurgh Apr 17, 2020
2d1ef03
(PyKDL)(sip) no None in python3
MatthijsBurgh Apr 17, 2020
d518c8b
(PyKDL) remove None from Joint
MatthijsBurgh Apr 17, 2020
f2591a0
(PyKDL) Fix None in tests
MatthijsBurgh Apr 18, 2020
e8ecba1
(PyKDL) fix author info
MatthijsBurgh Apr 18, 2020
afe780d
(PyKDL) add missing import in test
MatthijsBurgh Apr 18, 2020
0c8b922
(PyKDL) fix shebang in test
MatthijsBurgh Apr 18, 2020
9647973
(PyKDL) fix range in test
MatthijsBurgh Apr 18, 2020
8c87e96
(PyKDL) read/write pickle binary
MatthijsBurgh Apr 18, 2020
6984454
(PyKDL) tests, update author info
MatthijsBurgh Apr 18, 2020
61f457a
(PyKDL) update author info
MatthijsBurgh Apr 18, 2020
8c2d6bb
Update Author info
MatthijsBurgh Apr 18, 2020
2efa058
(PyKDL) add author info for significant modified files
MatthijsBurgh Apr 18, 2020
8ccc304
(kdl) move to pkg format 3
MatthijsBurgh Apr 18, 2020
71b3226
(PyKDL) move to pkg format 3
MatthijsBurgh Apr 18, 2020
a66cddf
(PyKDL) add python-future test_depend
MatthijsBurgh Apr 18, 2020
fa7ca15
(PyKDL) update doc information
MatthijsBurgh Apr 18, 2020
60370c8
(kdl) add doc_depend
MatthijsBurgh Apr 18, 2020
f23632f
(PyKDL)(sip) add __version__
MatthijsBurgh Apr 18, 2020
a6fbd38
(kdl) add eps argument to Norm functions
MatthijsBurgh May 4, 2020
1470003
(PyKDL) add eps argument to norm functions
MatthijsBurgh May 4, 2020
3be9580
(PyKDL)(sip) add eps argument to norm functions
MatthijsBurgh May 4, 2020
818f669
(kdl) normalize returns 0 if norm < eps fixes #65
MatthijsBurgh May 4, 2020
0804437
(PyKDL) cmake: add depracation warning
MatthijsBurgh May 4, 2020
9ec544e
(kdl) improve norm of VectorVel
MatthijsBurgh May 5, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[submodule "python_orocos_kdl/pybind11"]
path = python_orocos_kdl/pybind11
url = https://github.com/pybind/pybind11.git
branch = v2.4.3
49 changes: 36 additions & 13 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,21 @@
language: cpp
os: linux
dist: xenial

compiler:
- gcc
- clang

env:
- OROCOS_KDL_BUILD_TYPE=Debug
- OROCOS_KDL_BUILD_TYPE=Release
- OROCOS_KDL_BUILD_TYPE=Debug BUILD_PYKDL_PYBIND11=OFF
- OROCOS_KDL_BUILD_TYPE=Debug BUILD_PYKDL_PYBIND11=ON
- OROCOS_KDL_BUILD_TYPE=Release BUILD_PYKDL_PYBIND11=OFF
- OROCOS_KDL_BUILD_TYPE=Release BUILD_PYKDL_PYBIND11=ON

before_script:
- sudo apt-get -qq update
- sudo apt-get install -y libeigen3-dev libcppunit-dev python-sip-dev python-psutil
#build orocos_kdl
- sudo apt-get install -y libeigen3-dev libcppunit-dev python-sip-dev python3-sip-dev python-psutil python3-psutil python-future python3-future
# build orocos_kdl
- cd orocos_kdl
- mkdir build
- cd build
Expand All @@ -19,23 +24,41 @@ before_script:
- make
- sudo make install
- cd ../..
#build python bindings

# build python bindings python 2
- cd python_orocos_kdl
- mkdir build
- cd build
- cmake -DCMAKE_CXX_FLAGS:STRING="-Wall" -DCMAKE_BUILD_TYPE=${OROCOS_KDL_BUILD_TYPE} ./..
#compile and install python bindings
- mkdir build2
- cd build2
- export ROS_PYTHON_VERSION=2
- cmake -DCMAKE_CXX_FLAGS:STRING="-Wall" -DCMAKE_BUILD_TYPE=${OROCOS_KDL_BUILD_TYPE} -DBUILD_PYKDL_PYBIND11=${BUILD_PYKDL_PYBIND11} ./..
# compile and install python bindings python 2
- make
- sudo make install
- export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib
- sudo ldconfig
- cd ../..

# build python bindings python 3
- cd python_orocos_kdl
- mkdir build3
- cd build3
- export ROS_PYTHON_VERSION=3
- cmake -DCMAKE_CXX_FLAGS:STRING="-Wall" -DCMAKE_BUILD_TYPE=${OROCOS_KDL_BUILD_TYPE} -DBUILD_PYKDL_PYBIND11=${BUILD_PYKDL_PYBIND11} ./..
# compile and install python bindings python 3
- make
- sudo make install
- export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib
- sudo ldconfig
- cd ../..

script:
#execute orocos_kdl tests
# execute orocos_kdl tests
- cd orocos_kdl/build
- make check
- cd ../..
#execute python bindings tests
- cd python_orocos_kdl/build
- python ../tests/PyKDLtest.py
# execute python bindings tests
- cd python_orocos_kdl
# python 2
- python2 tests/PyKDLtest.py
# python 3
- python3 tests/PyKDLtest.py
12 changes: 8 additions & 4 deletions orocos_kdl/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,14 @@ SET( KDL_CFLAGS "")

find_package(Eigen 3 QUIET)
if(NOT Eigen_FOUND)
include(${PROJ_SOURCE_DIR}/config/FindEigen3.cmake)
include(${PROJ_SOURCE_DIR}/cmake/FindEigen3.cmake)
set(Eigen_INCLUDE_DIR "${EIGEN3_INCLUDE_DIR}")
endif()
include_directories(${Eigen_INCLUDE_DIR})
SET(KDL_CFLAGS "${KDL_CFLAGS} -I${Eigen_INCLUDE_DIR}")

# Check the platform STL containers capabilities
include(config/CheckSTLContainers.cmake)
include(cmake/CheckSTLContainers.cmake)
CHECK_STL_CONTAINERS()

# Set the default option appropriately
Expand All @@ -67,6 +67,12 @@ endif(HAVE_STL_CONTAINER_INCOMPLETE_TYPES)
# Allow the user to select the Tree API version to use
set(KDL_USE_NEW_TREE_INTERFACE ${KDL_USE_NEW_TREE_INTERFACE_DEFAULT} CACHE BOOL "Use the new KDL Tree interface")

#Sanity check, inform the user
if(NOT HAVE_STL_CONTAINER_INCOMPLETE_TYPES AND NOT KDL_USE_NEW_TREE_INTERFACE)
message(WARNING "You have chosen to use the current Tree Interface, but your platform doesn't support containers of "
"incomplete types, this configuration is likely invalid")
endif()

# The new interface requires the use of shared pointers
if(KDL_USE_NEW_TREE_INTERFACE)
# We need shared_ptr from boost since not all compilers are c++11 capable
Expand All @@ -75,8 +81,6 @@ if(KDL_USE_NEW_TREE_INTERFACE)
set(KDL_INCLUDE_DIRS ${Boost_INCLUDE_DIRS})
endif(KDL_USE_NEW_TREE_INTERFACE)

INCLUDE (${PROJ_SOURCE_DIR}/config/DependentOption.cmake)

OPTION(ENABLE_TESTS OFF "Enable building of tests")
IF( ENABLE_TESTS )
# If not in standard paths, set CMAKE_xxx_PATH's in environment, eg.
Expand Down
File renamed without changes.
37 changes: 0 additions & 37 deletions orocos_kdl/config/DependentOption.cmake

This file was deleted.

14 changes: 9 additions & 5 deletions orocos_kdl/package.xml
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
<package>
<?xml version="1.0"?>
<package format="3">
<name>orocos_kdl</name>
<version>1.4.0</version>
<description>
This package contains a recent version of the Kinematics and Dynamics
Library (KDL), distributed by the Orocos Project.
Library (KDL), distributed by the Orocos Project.
</description>
<maintainer email="ruben@intermodalics.eu">Ruben Smits</maintainer>
<url>http://wiki.ros.org/orocos_kdl</url>
Expand All @@ -12,11 +13,14 @@
<buildtool_depend>cmake</buildtool_depend>
<build_depend>eigen</build_depend>

<run_depend>catkin</run_depend>
<run_depend>eigen</run_depend>
<run_depend>pkg-config</run_depend>
<exec_depend>catkin</exec_depend>
<exec_depend>eigen</exec_depend>
<exec_depend>pkg-config</exec_depend>

<test_depend>cppunit</test_depend>

<doc_depend>doxygen</doc_depend>

<export>
<build_type>cmake</build_type>
</export>
Expand Down
46 changes: 0 additions & 46 deletions orocos_kdl/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,52 +3,6 @@ FILE( GLOB KDL_HPPS [^.]*.hpp [^.]*.inl)

FILE( GLOB UTIL_HPPS utilities/[^.]*.h utilities/[^.]*.hpp)

INCLUDE(CheckCXXSourceCompiles)
SET(CMAKE_REQUIRED_FLAGS)
CHECK_CXX_SOURCE_COMPILES("
#include <string>
#include <map>
#include <vector.hpp>

class TreeElement;
typedef std::map<std::string, TreeElement> SegmentMap;

class TreeElement
{
TreeElement(const std::string& name): number(0) {}

public:
int number;
SegmentMap::const_iterator parent;
std::vector<SegmentMap::const_iterator> children;

static TreeElement Root(std::string& name)
{
return TreeElement(name);
}
};

int main()
{
return 0;
}
"
HAVE_STL_CONTAINER_INCOMPLETE_TYPES)

if(HAVE_STL_CONTAINER_INCOMPLETE_TYPES)
SET(KDL_USE_NEW_TREE_INTERFACE_DEFAULT Off)
ELSE(HAVE_STL_CONTAINER_INCOMPLETE_TYPES)
SET(KDL_USE_NEW_TREE_INTERFACE_DEFAULT On)
ENDIF(HAVE_STL_CONTAINER_INCOMPLETE_TYPES)

SET(KDL_USE_NEW_TREE_INTERFACE ${KDL_USE_NEW_TREE_INTERFACE_DEFAULT} CACHE BOOL "Use the new KDL Tree interface")

#Sanity check, inform the user
IF(NOT HAVE_STL_CONTAINER_INCOMPLETE_TYPES AND NOT KDL_USE_NEW_TREE_INTERFACE)
MESSAGE(WARNING "You have chosen to use the current Tree Interface, but your platform doesn't support containers of "
"incomplete types, this configuration is likely invalid")
ENDIF()

#In Windows (Visual Studio) it is necessary to specify the postfix
#of the debug library name and no symbols are exported by kdl,
#so it is necessary to compile it as a static library
Expand Down
8 changes: 4 additions & 4 deletions orocos_kdl/src/chain.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// Copyright (C) 2007 Ruben Smits <ruben dot smits at mech dot kuleuven dot be>
// Copyright (C) 2020 Ruben Smits <ruben dot smits at intermodalics dot eu>

// Version: 1.0
// Author: Ruben Smits <ruben dot smits at mech dot kuleuven dot be>
// Maintainer: Ruben Smits <ruben dot smits at mech dot kuleuven dot be>
// Author: Ruben Smits <ruben dot smits at intermodalics dot eu>
// Maintainer: Ruben Smits <ruben dot smits at intermodalics dot eu>
// URL: http://www.orocos.org/kdl

// This library is free software; you can redistribute it and/or
Expand Down Expand Up @@ -55,7 +55,7 @@ namespace KDL {
{
segments.push_back(segment);
nrOfSegments++;
if(segment.getJoint().getType()!=Joint::None)
if(segment.getJoint().getType()!=Joint::Fixed)
nrOfJoints++;
}

Expand Down
33 changes: 17 additions & 16 deletions orocos_kdl/src/chaindynparam.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
// Copyright (C) 2009 Dominick Vanthienen <dominick dot vanthienen at mech dot kuleuven dot be>
// Copyright (C) 2020 Ruben Smits <ruben dot smits at intermodalics dot eu>

// Version: 1.0
// Author: Dominick Vanthienen <dominick dot vanthienen at mech dot kuleuven dot be>
// Maintainer: Ruben Smits <ruben dot smits at mech dot kuleuven dot be>
// Author: Ruben Smits <ruben dot smits at intermodalics dot eu>
// Maintainer: Ruben Smits <ruben dot smits at intermodalics dot eu>
// URL: http://www.orocos.org/kdl

// This library is free software; you can redistribute it and/or
Expand Down Expand Up @@ -65,13 +66,13 @@ namespace KDL {
return (error = E_SIZE_MISMATCH);
unsigned int k=0;
double q_;

//Sweep from root to leaf
for(unsigned int i=0;i<ns;i++)
{
//Collect RigidBodyInertia
Ic[i]=chain.getSegment(i).getInertia();
if(chain.getSegment(i).getJoint().getType()!=Joint::None)
if(chain.getSegment(i).getJoint().getType()!=Joint::Fixed)
{
q_=q(k);
k++;
Expand All @@ -81,22 +82,22 @@ namespace KDL {
q_=0.0;
}
X[i]=chain.getSegment(i).pose(q_);//Remark this is the inverse of the frame for transformations from the parent to the current coord frame
S[i]=X[i].M.Inverse(chain.getSegment(i).twist(q_,1.0));
S[i]=X[i].M.Inverse(chain.getSegment(i).twist(q_,1.0));
}
//Sweep from leaf to root
int j,l;
k=nj-1; //reset k
for(int i=ns-1;i>=0;i--)
{

if(i!=0)
{
//assumption that previous segment is parent
Ic[i-1]=Ic[i-1]+X[i]*Ic[i];
}
}

F=Ic[i]*S[i];
if(chain.getSegment(i).getJoint().getType()!=Joint::None)
if(chain.getSegment(i).getJoint().getType()!=Joint::Fixed)
{
H(k,k)=dot(S[i],F);
H(k,k)+=chain.getSegment(i).getJoint().getInertia(); // add joint inertia
Expand All @@ -107,14 +108,14 @@ namespace KDL {
//assumption that previous segment is parent
F=X[l]*F; //calculate the unit force (cfr S) for every segment: F[l-1]=X[l]*F[l]
l--; //go down a segment
if(chain.getSegment(l).getJoint().getType()!=Joint::None) //if the joint connected to segment is not a fixed joint
{

if(chain.getSegment(l).getJoint().getType()!=Joint::Fixed) //if the joint connected to segment is not a fixed joint
{
j--;
H(k,j)=dot(F,S[l]); //here you actually match a certain not fixed joint with a segment
H(k,j)=dot(F,S[l]); //here you actually match a certain not fixed joint with a segment
H(j,k)=H(k,j);
}
}
}
k--; //this if-loop should be repeated nj times (k=nj-1 to k=0)
}

Expand All @@ -128,18 +129,18 @@ namespace KDL {
//make a null matrix with the size of q_dotdot and a null wrench
SetToZero(jntarraynull);


//the calculation of coriolis matrix C
return chainidsolver_coriolis.CartToJnt(q, q_dot, jntarraynull, wrenchnull, coriolis);

}

//calculate gravity matrix G
int ChainDynParam::JntToGravity(const JntArray &q,JntArray &gravity)
{

//make a null matrix with the size of q_dotdot and a null wrench

SetToZero(jntarraynull);
//the calculation of coriolis matrix C
return chainidsolver_gravity.CartToJnt(q, jntarraynull, jntarraynull, wrenchnull, gravity);
Expand Down
Loading