RBDL - Rigid Body Dynamics Library

Post Reply
Martin Felis
Posts: 13
Joined: Sat Oct 29, 2011 9:32 pm
Contact:

RBDL - Rigid Body Dynamics Library

Post by Martin Felis »

Hi everyone,

I have been working on a reduced coordinate rigid body dynamics library written in C++ that might be of use for some people around here. Unlike bullet, which includes integrators and collision checking, this library focuses on the dynamics of rigid multi-body systems. It is a fairly efficient[1] implementation of some well know dynamics algorithms, such as:
  • Recursive Newton Euler Algorithm for inverse dynamics
  • Composite Rigid Body Algorithm to compute the joint space inertia matrix
  • Articulated Body Algorithm (sometimes called "Featherstone Algorithm") for forward dynamics
Furthermore it contains some methods for forward and inverse kinematics and contact handling (i.e. the method described by Kokkevis and Metaxas in the Paper "Practical Physics for Articulated Characters", Game Developers Conference, 2004).

The code is tested using ~90 automated tests and uses Eigen3 (http://eigen.tuxfamily.org/index.php?title=Main_Page) as a underlying math library, but different libraries could be incorporated instead. Currently I use this software in my daily scientific research to generate human and robot motions using optimal control methods.

It is available under the zlib license and the code is hosted by bitbucket.

Here are the links: Best regards,
Martin

[1] some raw numbers concerning efficiency (system specs: i7 920 processor and a 64 bit Ubuntu Linux):
For a model with 31 degrees of freedom:
inverse dynamics: 0.79 * 1.0e-5 (s)
forward dynamics: 1.85 * 1.0e-5 (s)
The numbers represent the average time spent for each function that were obtained with the benchmark program that comes with the code and a sample count of 100.000 calls to each method.
Last edited by Martin Felis on Sat Mar 14, 2020 2:24 pm, edited 2 times in total.
kingchurch
Posts: 28
Joined: Sun May 13, 2012 7:14 am

Re: RBDL - Rigid Body Dynamics Library

Post by kingchurch »

This is awesome!

I tried to compile the source with Visual Studio 10 on Windows 7 and got the following error:

1. Cmake command I used to generate rbdl.sln
mkdir build
cd build
cmake -D CMAKE_BUILD_TYPE=Release ..\

2. Visual Studio 2010 build error:


Error 1 error C2678: binary '==' : no operator found which takes a left-hand operand of type 'std::string' (or there is no acceptable conversion) C:\Users\Kevin\Source\RBDL\rbdl\src\rbdl_version.cc 32 1 rbdl
Warning 2 warning C4099: 'RigidBodyDynamics::Model' : type name first seen using 'class' now seen using 'struct' c:\users\kevin\source\rbdl\rbdl\src\Model.h 129 1 rbdl
Warning 3 warning C4099: 'RigidBodyDynamics::Model' : type name first seen using 'class' now seen using 'struct' c:\users\kevin\source\rbdl\rbdl\src\Model.h 129 1 rbdl
Warning 4 warning C4244: 'argument' : conversion from 'double' to 'unsigned int', possible loss of data C:\Users\Kevin\Source\RBDL\rbdl\src\Model.cc 31 1 rbdl
Warning 5 warning C4099: 'RigidBodyDynamics::Model' : type name first seen using 'class' now seen using 'struct' c:\users\kevin\source\rbdl\rbdl\src\Model.h 129 1 rbdl
Error 6 error C2065: '__func__' : undeclared identifier C:\Users\Kevin\Source\RBDL\rbdl\src\Kinematics.cc 28 1 rbdl
Error 7 error C2065: '__func__' : undeclared identifier C:\Users\Kevin\Source\RBDL\rbdl\src\Kinematics.cc 73 1 rbdl
Error 8 error C2065: '__func__' : undeclared identifier C:\Users\Kevin\Source\RBDL\rbdl\src\Kinematics.cc 191 1 rbdl
Error 9 error C2057: expected constant expression C:\Users\Kevin\Source\RBDL\rbdl\src\Kinematics.cc 211 1 rbdl
Error 10 error C2466: cannot allocate an array of constant size 0 C:\Users\Kevin\Source\RBDL\rbdl\src\Kinematics.cc 211 1 rbdl
Error 11 error C2133: 'e' : unknown size C:\Users\Kevin\Source\RBDL\rbdl\src\Kinematics.cc 211 1 rbdl
Error 12 error C2065: '__func__' : undeclared identifier C:\Users\Kevin\Source\RBDL\rbdl\src\Kinematics.cc 240 1 rbdl
Error 13 error C2065: '__func__' : undeclared identifier C:\Users\Kevin\Source\RBDL\rbdl\src\Kinematics.cc 294 1 rbdl
Warning 14 warning C4018: '<' : signed/unsigned mismatch C:\Users\Kevin\Source\RBDL\rbdl\src\Kinematics.cc 374 1 rbdl
Warning 15 warning C4018: '<' : signed/unsigned mismatch C:\Users\Kevin\Source\RBDL\rbdl\src\Kinematics.cc 433 1 rbdl
Warning 16 warning C4099: 'RigidBodyDynamics::Model' : type name first seen using 'class' now seen using 'struct' c:\users\kevin\source\rbdl\rbdl\src\Model.h 129 1 rbdl
Warning 17 warning C4099: 'RigidBodyDynamics::Model' : type name first seen using 'struct' now seen using 'class' c:\users\kevin\source\rbdl\rbdl\src\Dynamics.h 21 1 rbdl
Error 18 error C2065: '__func__' : undeclared identifier C:\Users\Kevin\Source\RBDL\rbdl\src\Dynamics.cc 35 1 rbdl
Error 19 error C2065: '__func__' : undeclared identifier C:\Users\Kevin\Source\RBDL\rbdl\src\Dynamics.cc 196 1 rbdl
Error 20 error C2065: '__func__' : undeclared identifier C:\Users\Kevin\Source\RBDL\rbdl\src\Dynamics.cc 240 1 rbdl
Error 21 error C2065: '__func__' : undeclared identifier C:\Users\Kevin\Source\RBDL\rbdl\src\Dynamics.cc 311 1 rbdl
Warning 22 warning C4099: 'RigidBodyDynamics::Model' : type name first seen using 'class' now seen using 'struct' c:\users\kevin\source\rbdl\rbdl\src\Model.h 129 1 rbdl
Warning 23 warning C4099: 'RigidBodyDynamics::Model' : type name first seen using 'struct' now seen using 'class' c:\users\kevin\source\rbdl\rbdl\src\Dynamics.h 21 1 rbdl
Error 24 error C2065: '__func__' : undeclared identifier C:\Users\Kevin\Source\RBDL\rbdl\src\Contacts.cc 141 1 rbdl
Error 25 error C2065: '__func__' : undeclared identifier C:\Users\Kevin\Source\RBDL\rbdl\src\Contacts.cc 287 1 rbdl
Error 26 error C2065: '__func__' : undeclared identifier C:\Users\Kevin\Source\RBDL\rbdl\src\Contacts.cc 399 1 rbdl
Error 27 error C2065: '__func__' : undeclared identifier C:\Users\Kevin\Source\RBDL\rbdl\src\Contacts.cc 488 1 rbdl
Error 28 error C2065: '__func__' : undeclared identifier C:\Users\Kevin\Source\RBDL\rbdl\src\Contacts.cc 553 1 rbdl
29 IntelliSense: no operator "==" matches these operands c:\users\kevin\source\rbdl\rbdl\src\rbdl_version.cc 32 21 rbdl
Martin Felis
Posts: 13
Joined: Sat Oct 29, 2011 9:32 pm
Contact:

Re: RBDL - Rigid Body Dynamics Library

Post by Martin Felis »

Hi kingchurch,

I tried to fix all warnings and compiler errors you posted. But unfortunately I do not have access to a Visual Studio 10 compiler right now.

Could you check the newest version? Either by updating via mercurial or by downloading this https://bitbucket.org/rbdl/rbdl/get/f244e9a759f8.zip.

Thank you!
Martin
kingchurch
Posts: 28
Joined: Sun May 13, 2012 7:14 am

Re: RBDL - Rigid Body Dynamics Library

Post by kingchurch »

The "ALL_BUILD" project builds fine now! Thanks!
The "INSTALL" project still has some build errors, not sure if it's intended for windows platform:

------
Error 1 error MSB3073: The command "setlocal
"C:\Program Files (x86)\CMake 2.8\bin\cmake.exe" -DBUILD_TYPE=Debug -P cmake_install.cmake
if %errorlevel% neq 0 goto :cmEnd
:cmEnd
endlocal & call :cmErrorLevel %errorlevel% & goto :cmDone
:cmErrorLevel
exit /b %1
:cmDone
if %errorlevel% neq 0 goto :VCEnd
:VCEnd" exited with code 1. C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets 113 6 INSTALL
-------

When I tried to run the "rbdl" project it pops an error box as the following:

"Microsoft Visual Studio - Unable to start program C:\Source\RBDL\rbdl\build\Debug\rbdl.dll"

BTW, how to run the 60 test cases ?
Martin Felis
Posts: 13
Joined: Sat Oct 29, 2011 9:32 pm
Contact:

Re: RBDL - Rigid Body Dynamics Library

Post by Martin Felis »

The "INSTALL" project is used to install the library and header files to the appropriate directories in Linux and similar operating systems as they have a certain specification where to put things.

To use the library in Windows it is sufficient to build the dll. To use RBDL in a project you would then have to tell the compiler where to look for the include files (in your case this would be the path to the src folder of the RBDL and additionally the folder "src" in the "build" directory) and tell the linker where to find the rbdl.dll (probably "build/rbdl.dll"). With this you should be able to use RBDL in any project.

To run the test cases you need the UnitTest++ testing framework. You can find it at http://unittest-cpp.sourceforge.net/. Once obtained, you would then have to tell CMake where to find it. Easiest way would probably be using the CMake GUI.

Please note that the RBDL is only a library. It does not come with an executable that can be run to look or modify simulations. You would have to write an integrator and visualisation yourself to do so.
kingchurch
Posts: 28
Joined: Sun May 13, 2012 7:14 am

Re: RBDL - Rigid Body Dynamics Library

Post by kingchurch »

The INSTALL problem is because of lack of administrative privilege. It can be worked around by copy/paste the install cmake command line to a command prompt with administrative privilege. With that the RBDL header files can be installed to "C:\Program Files (x86)\RBDL\include\rbdl". However the library files were not installed to the "C:\Program Files (x86)\RBDL" folder.

However then I met CMake problems for "tests" folder as the following:

~~~~
Microsoft Windows [Version 6.1.7600]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.

c:\Source\RBDL\rbdl\tests>mkdir build
c:\Source\RBDL\rbdl\tests>cd build
c:\Source\RBDL\rbdl\tests\build>cmake ..\
-- Building for: Visual Studio 10
-- Check for working C compiler using: Visual Studio 10
-- Check for working C compiler using: Visual Studio 10 -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler using: Visual Studio 10
-- Check for working CXX compiler using: Visual Studio 10 -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
CMake Error at C:/Users/Source/RBDL/rbdl/CMake/FindUnitTest++.cmake:33 (ME
SSAGE):
Could not find UnitTest++
Call Stack (most recent call first):
CMakeLists.txt:26 (FIND_PACKAGE)

~~~~~~~~~

Also CMAKE fails for "example" folder as the following:

~~~~~~~~~~
Microsoft Windows [Version 6.1.7600]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.

c:\Source\RBDL\rbdl\tests>mkdir build

c:\Source\RBDL\rbdl\tests>cd build

c:\Source\RBDL\rbdl\tests\build>cmake ..\
-- Building for: Visual Studio 10
-- Check for working C compiler using: Visual Studio 10
-- Check for working C compiler using: Visual Studio 10 -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler using: Visual Studio 10
-- Check for working CXX compiler using: Visual Studio 10 -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
CMake Error at C:/Source/RBDL/rbdl/CMake/FindUnitTest++.cmake:33 (ME
SSAGE):
Could not find UnitTest++
Call Stack (most recent call first):
CMakeLists.txt:26 (FIND_PACKAGE)


-- Configuring incomplete, errors occurred!
Martin Felis
Posts: 13
Joined: Sat Oct 29, 2011 9:32 pm
Contact:

Re: RBDL - Rigid Body Dynamics Library

Post by Martin Felis »

All the errors you posted are due to CMake not finding UnitTest++:
kingchurch wrote:CMake Error at C:/Users/Source/RBDL/rbdl/CMake/FindUnitTest++.cmake:33 (ME
SSAGE):
Could not find UnitTest++
Call Stack (most recent call first):
CMakeLists.txt:26 (FIND_PACKAGE)
Please install it and set the CMake variables UNITTEST++_INCLUDE_DIR and UNITTEST++_LIBRARY appropriately if they are not detected automatically. This is best done with the CMake GUI.
Martin Felis
Posts: 13
Joined: Sat Oct 29, 2011 9:32 pm
Contact:

Re: RBDL - Rigid Body Dynamics Library

Post by Martin Felis »

Just wanted to announce the release of version 2.4.0 of RBDL, an efficient reduced-coordinate dynamics library. Among many other things it now contains four different solvers for the contact system, namely:
  • Direct: Solve the full system directly.
  • RangeSpaceSparse: First solve for the contact forces lambda and then for qddot. It uses a sparse structure preserving Cholesky decomposition to factorize the joint space inertia matrix as described in Featherstone's book.
  • NullSpace: First solve for qddot and then for the contact forces lambda
  • Kokkevis: Use a reduced variant of the Articulated Body Algorithm (a.k.a. "Featherstone Algorithm") to compute a linear system that is solved for the contact forces lambda and then compute qddot.
On top of that there have been many performance improvements and API enhancements.

The full changelog is available at https://rbdl.github.io.

The code is available from https://github.com/rbdl/rbdl (zlib license)
Post Reply