Skip to content

Commit

Permalink
Moving to 3.0.0: base folder
Browse files Browse the repository at this point in the history
  • Loading branch information
pariterre committed Jul 8, 2021
1 parent 5171561 commit a02a54b
Show file tree
Hide file tree
Showing 10 changed files with 421 additions and 253 deletions.
10 changes: 10 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
root = true

[*]
end_of_line = lf
indent_style = space
indent_size = 2
charset = utf-8

[Makefile]
indent_style = tab
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -130,3 +130,6 @@ S2MSource
pyomeca
release*
*.DS_Store

doc/html
**/build
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "addons/urdfreader/thirdparty/urdfparser"]
path = addons/urdfreader/thirdparty/urdfparser
url = https://github.com/ORB-HD/URDF_Parser
140 changes: 72 additions & 68 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
CMAKE_MINIMUM_REQUIRED(VERSION 3.0)
CMAKE_MINIMUM_REQUIRED(VERSION 3.10)

SET ( RBDL_VERSION_MAJOR 2 )
SET ( RBDL_VERSION_MINOR 6 )
SET ( RBDL_VERSION_MAJOR 3 )
SET ( RBDL_VERSION_MINOR 0 )
SET ( RBDL_VERSION_PATCH 0 )
SET ( RBDL_VERSION
${RBDL_VERSION_MAJOR}.${RBDL_VERSION_MINOR}.${RBDL_VERSION_PATCH}
Expand Down Expand Up @@ -35,55 +35,46 @@ IF(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
SET_PROPERTY(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo")
ENDIF()

# Choose the math's library backend to use
set(MATH_LIBRARY_BACKEND Eigen3 CACHE STRING "Choose the backend library for the linear algebra.")
# Set the possible values of build type for cmake-gui
set_property(CACHE MATH_LIBRARY_BACKEND PROPERTY STRINGS "Eigen3" "Simple" "Casadi")
OPTION (RBDL_USE_CASADI_MATH "Use the CasADi backend" OFF)
IF (RBDL_USE_CASADI_MATH)
FIND_PACKAGE (Casadi REQUIRED)
INCLUDE_DIRECTORIES (
${Casadi_INCLUDE_DIR}
${Casadi_INCLUDE_DIR}/..
)
ELSE (RBDL_USE_CASADI_MATH)
# Find and use the system's Eigen3 library
FIND_PACKAGE (Eigen3 3.0.0)

IF (NOT EIGEN3_FOUND)
MESSAGE (WARNING "Could not find Eigen3 on your system. Please install it!")
ENDIF (NOT EIGEN3_FOUND)

INCLUDE_DIRECTORIES (${EIGEN3_INCLUDE_DIR})
ENDIF (RBDL_USE_CASADI_MATH)

# Options
SET (RBDL_BUILD_STATIC_DEFAULT OFF)
IF (MSVC)
SET (RBDL_BUILD_STATIC_DEFAULT ON)
ENDIF (MSVC)

OPTION (RBDL_BUILD_STATIC "Build statically linked library (otherwise dynamiclly linked)" ${RBDL_BUILD_STATIC_DEFAULT})
OPTION (RBDL_BUILD_TESTS "Build the test executables" OFF)
OPTION (RBDL_ENABLE_LOGGING "Enable logging (warning: major impact on performance!)" OFF)
OPTION (RBDL_USE_SIMPLE_MATH "Use slow math instead of the fast Eigen3 library (faster compilation)" OFF)
if(${MATH_LIBRARY_BACKEND} STREQUAL "Eigen3")
set (RBDL_USE_EIGEN3_MATH ON)
set (RBDL_USE_SIMPLE_MATH OFF)
set (RBDL_USE_CASADI_MATH OFF)
elseif(${MATH_LIBRARY_BACKEND} STREQUAL "Casadi")
set (RBDL_USE_EIGEN3_MATH OFF)
set (RBDL_USE_SIMPLE_MATH OFF)
set (RBDL_USE_CASADI_MATH ON)
elseif(${MATH_LIBRARY_BACKEND} STREQUAL "Simple")
set (RBDL_USE_EIGEN3_MATH OFF)
set (RBDL_USE_SIMPLE_MATH ON)
set (RBDL_USE_CASADI_MATH OFF)
endif()
OPTION (RBDL_STORE_VERSION "Enable storing of version information in the library (requires build from valid repository)" OFF)
OPTION (RBDL_BUILD_ADDON_URDFREADER "Build the (experimental) urdf reader" OFF)
OPTION (RBDL_BUILD_ADDON_BENCHMARK "Build the benchmarking tool" OFF)
OPTION (RBDL_BUILD_ADDON_LUAMODEL "Build the lua model reader" OFF)
OPTION (RBDL_BUILD_PYTHON_WRAPPER "Build experimental python wrapper" OFF)
OPTION (RBDL_BUILD_ADDON_GEOMETRY "Build the geometry library" OFF)
OPTION (RBDL_BUILD_ADDON_MUSCLE "Build the muscle library" OFF)
OPTION (RBDL_BUILD_ADDON_MUSCLE_FITTING "Build muscle library fitting functions (requires Ipopt)" OFF)
OPTION (RBDL_USE_PYTHON_2 "Use python 2 instead of python 3" OFF)

# Loading the appropriate packages
IF (RBDL_USE_CASADI_MATH)
FIND_PACKAGE (Casadi REQUIRED)
INCLUDE_DIRECTORIES (
${Casadi_INCLUDE_DIR}
${Casadi_INCLUDE_DIR}/..)
ENDIF (RBDL_USE_CASADI_MATH)
SET (RBDL_BUILD_COMPILER_ID ${CMAKE_CXX_COMPILER_ID})
SET (RBDL_BUILD_COMPILER_VERSION ${CMAKE_CXX_COMPILER_VERSION})

IF (RBDL_USE_EIGEN3_MATH)
# Find and use the system's Eigen3 library
FIND_PACKAGE (Eigen3 3.0.0 REQUIRED)
INCLUDE_DIRECTORIES (${EIGEN3_INCLUDE_DIR})
ENDIF (RBDL_USE_EIGEN3_MATH)

# Options
SET (RBDL_BUILD_STATIC_DEFAULT OFF)
IF (MSVC)
SET (RBDL_BUILD_STATIC_DEFAULT ON)
ENDIF (MSVC)

# Addons
IF (RBDL_BUILD_ADDON_URDFREADER)
Expand All @@ -94,12 +85,13 @@ IF (RBDL_BUILD_ADDON_BENCHMARK)
ADD_SUBDIRECTORY ( addons/benchmark )
ENDIF (RBDL_BUILD_ADDON_BENCHMARK)

IF (RBDL_BUILD_ADDON_LUAMODEL)
ADD_SUBDIRECTORY ( addons/luamodel )
ENDIF (RBDL_BUILD_ADDON_LUAMODEL)


IF(RBDL_BUILD_ADDON_MUSCLE)
SET(RBDL_BUILD_ADDON_GEOMETRY ON CACHE BOOL "Build the geometry library" FORCE)
IF (RBDL_BUILD_ADDON_MUSCLE_FITTING)
SET(CUSTOM_IPOPT_PATH "" CACHE PATH "Path to specific IPOPT Installation")
ENDIF (RBDL_BUILD_ADDON_MUSCLE_FITTING)
ADD_SUBDIRECTORY ( addons/muscle )
IF(RBDL_BUILD_TESTS)
ADD_SUBDIRECTORY ( addons/muscle/tests )
Expand All @@ -114,7 +106,12 @@ IF(RBDL_BUILD_ADDON_GEOMETRY)
ENDIF(RBDL_BUILD_TESTS)
ENDIF(RBDL_BUILD_ADDON_GEOMETRY)


IF (RBDL_BUILD_ADDON_LUAMODEL)
ADD_SUBDIRECTORY ( addons/luamodel )
IF(RBDL_BUILD_TESTS)
ADD_SUBDIRECTORY ( addons/luamodel/tests )
ENDIF(RBDL_BUILD_TESTS)
ENDIF (RBDL_BUILD_ADDON_LUAMODEL)

IF (RBDL_BUILD_TESTS)
ADD_SUBDIRECTORY ( tests )
Expand All @@ -125,12 +122,15 @@ SET ( RBDL_SOURCES
src/rbdl_version.cc
src/rbdl_mathutils.cc
src/rbdl_utils.cc
src/Constraints.cc
src/Dynamics.cc
src/rbdl_errors.cc
src/Constraints.cc
src/Constraint_Contact.cc
src/Constraint_Loop.cc
src/Dynamics.cc
src/Logging.cc
src/Joint.cc
src/Model.cc
src/Kinematics.cc
src/Kinematics.cc
)

IF (MSVC AND NOT RBDL_BUILD_STATIC)
Expand All @@ -150,11 +150,16 @@ IF (RBDL_BUILD_STATIC)
rbdl_luamodel-static
)
ENDIF (RBDL_BUILD_ADDON_LUAMODEL)
IF (RBDL_USE_CASADI_MATH)
TARGET_LINK_LIBRARIES ( rbdl-static
${Casadi_LIBRARY}
)
ENDIF (RBDL_USE_CASADI_MATH)
IF (RBDL_BUILD_ADDON_URDFREADER)
TARGET_LINK_LIBRARIES ( rbdl-static
rbdl_urdfreader-static
)
ENDIF (RBDL_BUILD_ADDON_URDFREADER)
IF (RBDL_USE_CASADI_MATH)
TARGET_LINK_LIBRARIES ( rbdl-static
${Casadi_LIBRARY}
)
ENDIF (RBDL_USE_CASADI_MATH)

INSTALL (TARGETS rbdl-static
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
Expand All @@ -167,26 +172,31 @@ ELSE (RBDL_BUILD_STATIC)
SOVERSION ${RBDL_SO_VERSION}
)

IF (RBDL_USE_CASADI_MATH)
TARGET_LINK_LIBRARIES ( rbdl
${Casadi_LIBRARY}
)
ENDIF (RBDL_USE_CASADI_MATH)

INSTALL (TARGETS rbdl
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
)
IF (RBDL_USE_CASADI_MATH)
TARGET_LINK_LIBRARIES ( rbdl
${Casadi_LIBRARY}
)
ENDIF (RBDL_USE_CASADI_MATH)
ENDIF (RBDL_BUILD_STATIC)

IF (RBDL_STORE_VERSION)
# Set versioning information that can be queried during runtime
EXEC_PROGRAM("hg" ${CMAKE_CURRENT_SOURCE_DIR} ARGS "id -i"
OUTPUT_VARIABLE RBDL_BUILD_REVISION)
EXEC_PROGRAM("hg" ${CMAKE_CURRENT_SOURCE_DIR} ARGS "branch"
OUTPUT_VARIABLE RBDL_BUILD_BRANCH)
EXECUTE_PROCESS(COMMAND "git" "rev-parse" "HEAD"
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
OUTPUT_VARIABLE RBDL_BUILD_COMMIT)
STRING(REGEX REPLACE "\n$" "" RBDL_BUILD_COMMIT "${RBDL_BUILD_COMMIT}")
EXECUTE_PROCESS(COMMAND "git" "describe" "--all" "--dirty" "--long"
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
OUTPUT_VARIABLE RBDL_BUILD_BRANCH)
STRING(REGEX REPLACE "\n$" "" RBDL_BUILD_BRANCH "${RBDL_BUILD_BRANCH}")
SET (RBDL_BUILD_TYPE ${CMAKE_BUILD_TYPE})
ELSE (RBDL_STORE_VERSION)
SET (RBDL_BUILD_REVISION "unknown")
SET (RBDL_BUILD_COMMIT "unknown")
SET (RBDL_BUILD_BRANCH "unknown")
SET (RBDL_BUILD_TYPE "unknown")
ENDIF (RBDL_STORE_VERSION)
Expand All @@ -199,7 +209,6 @@ CONFIGURE_FILE (
# Python wrapper
IF (RBDL_BUILD_PYTHON_WRAPPER)
add_subdirectory ( python )

ENDIF (RBDL_BUILD_PYTHON_WRAPPER)

# Installation
Expand All @@ -210,17 +219,12 @@ FILE ( GLOB headers

INSTALL ( FILES ${headers} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/rbdl )

# Setup of SimpleMath install settings
# Setup of CasADi install settings
IF (RBDL_USE_CASADI_MATH)
INSTALL ( DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/include/rbdl/CasadiMath"
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/rbdl
)
ENDIF (RBDL_USE_CASADI_MATH)
IF (RBDL_USE_SIMPLE_MATH)
INSTALL ( DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/include/rbdl/SimpleMath"
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/rbdl
)
ENDIF (RBDL_USE_SIMPLE_MATH)

# pkg-config
CONFIGURE_FILE (
Expand Down
66 changes: 17 additions & 49 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ described in Featherstone's book and to a lesser extent general multibody
dynamics and kinematics computations. A person who is familiar with
Featherstone's book should have an easy time to understand the code and
therefore the variable naming conventions used in the book should when
possible used in the code, e.g.:
possible used in the code, e.g.:

- the joint space inertia matrix is denoted with H
- the coriolis forces are denoted with C
Expand All @@ -28,7 +28,7 @@ programming patterns.

This is what RBDL aims to be:

* RBDL aims to be lean
* RBDL aims to be lean
* RBDL aims to be easily integrated into other projects
* RBDL aims to be suitable as a foundation for sophisticated dynamics packages
* RBDL gives you access to its internals and provides only a thin abstraction layer over the actual computation
Expand All @@ -48,7 +48,7 @@ architecture.
RBDL is published under the very permissive zlib license that gives you a
lot of freedom in the use of full library or parts of it. The core part
of the library is solely using this license but addons may use different
licenses.
licenses.

There is no formal contributor license agreement for this project. Instead
when you submit patches or create a pull request it is assumed that you
Expand Down Expand Up @@ -88,7 +88,7 @@ of ```SpatialVector```s in the ```Model``` structure.
### Examples

struct Model {
std::vector<SpatialVector> v; // ok, v is an
std::vector<SpatialVector> v; // ok, v is an
std::vector<SpatialVector> S; // ok, S is commonly used in a reference algorithm
std::vector<double> u; // ok
std::vector<Vector3d> multdof3_u; // ok, 3-dof specialization of Model::u
Expand All @@ -113,8 +113,12 @@ many editors (see http://editorconfig.org/ for more details).

## Error Handling

RBDL will fail loudly and abort if an error occurs. This allows you to spot
errors early on. RBDL does not use exceptions.
RBDL has a base class for all the errors that can occur. So when calling a function that may fail catching for this base class
is sufficient to catch all possible error types.

Due to historic reasons there may still be places in the code where abort is called instead of throwing an error, the change to exceptions
was made because just aborting caused issues when trying to use RBDL to develop applications, and killing the entire process is
not acceptable for this.

Code must compile without warnings with all compiler warnings enabled.
Please also consider checking code with static code analyzers such as
Expand Down Expand Up @@ -147,58 +151,22 @@ The doxygen comments should be written in the header files and not in the

## Testing

All code contributions must provide unit tests. RBDL uses UnitTest++
(https://github.com/unittest-cpp/unittest-cpp) as a testing framework. Many
All code contributions must provide unit tests. RBDL uses Catch2
(https://github.com/catchorg/Catch2.git) as a testing framework. Many
small tests that check single features are preferred over large tests that
test multiple things simultaneously.

Bugfixes ideally come with a test case that reproduce the bug.

## Branching and Bookmarks

RBDL uses Mercurial (https://mercurial-scm.org) as version control system.
The branching concept of mercurial is different than in git. Git's
branching concept is captured in mercurial using bookmarks
(https://www.mercurial-scm.org/wiki/Bookmarks).

The ```default``` branch is reserved for releases. Bugfixes and
contributions happen in the ```dev``` branch but should have a bookmark
assigned to them.

Please do not create new branches, i.e. do not run ```hg branch
<branchname>```.

### Working on a new feature

The following steps are advised when working on a new feature for RBDL:

1. Clone the official repository.
2. Switch to the ```dev``` branch.
3. Create a bookmark that describes that feature preferably in a single
word.
4. Commit all changes to this bookmark in the ```dev``` branch.
5. Publish your work online and notify the RBDL maintainer(s).

Here are the commands to perform steps 1.-4.:

# Step 1: clone official repository
hg clone https://bitbucket.org/rbdl/rbdl <newfeature> && cd <newfeature>

# Step 2: switch to the dev branch
hg update dev

# Step 3: create a bookmark
hg bookmark newfeature

# ...
# Make changes
# ...

# Step 4: commit changes
hg commit

For step 5 the easiest would be to push your changes to a fork of the
official repository on bitbucket and create a pull request.
1. Fork the official repository at https://github.com/rbdl/rbdl
2. Create a new branch for your work that branches off the official dev
branch.
3. Perform your changes in your branch.
4. When ready perform a pull request against the dev branch.

## Debugging

Expand Down
Loading

0 comments on commit a02a54b

Please sign in to comment.