Orocos Kinematics and Dynamics Library (KDL)
repository·master·Indexed 21 days ago
https://github.com/orocos/orocos_kinematics_dynamicsA real-time capable library for rigid body kinematics and dynamics calculations. It provides representations for kinematic structures and includes forward and inverse kinematic solvers. The library is implemented in C++ (orocos_kdl) with available Python bindings (python_orocos_kdl) and supports installation via CMake or ROS/catkin.
What's inside orocos_kinematics_dynamics
- The Orocos Kinematics and Dynamics Library provides real-time usable code for rigid body kinematics calculations. It includes representations for kinematic structures and provides both forward and inverse kinematic solvers.
Understand the KDL directory structure
masterThe KDL repository is organized into several functional areas. When using the library, be aware of the following directory roles:
utilities: Contains utility classes for KDL. Note: These should not be included separately by a user.experimental: Contains preliminary code snippets and non-stable features.bindings: Contains code for binding KDL to other libraries or programming languages.
Ensure version compatibility between C++ and Python bindings
masterWhen using both the C++ library and the Python bindings, you must use the same version for both. A version mismatch betweenorocos_kdlandpython_orocos_kdlcan cause significant issues.Install the Python bindings (python_orocos_kdl)
masterThe Python bindings for the library are located in thepython_orocos_kdldirectory. For detailed installation steps, refer to thepython_orocos_kdl/INSTALL.mdfile.Uninstall python_orocos_kdl bindings
masterTo remove the installed Python bindings, run the uninstall target from your build directory.
sudo make uninstallBuild Orocos KDL without catkin
masterTo build Orocos KDL as a standalone library using CMake, follow these steps:
- Clone the repository.
- Create and enter a
builddirectory to avoid building in the source folder. - Run
cmake ..with optional flags:-DCMAKE_INSTALL_PREFIX=<path>: Set the installation directory.-DENABLE_TESTS:BOOL=ON: Enable unit tests.-DCMAKE_BUILD_TYPE=<type>: Set the build type (e.g., Release, Debug).
- Run
maketo compile. - Run
sudo make installto install the library.
Additional Commands:
- Run tests:
make check(requires-DENABLE_TESTS:BOOL=ONduring cmake). - Generate API docs:
make docs. Documentation is located at<builddir>/doc/api/html. - Uninstall:
sudo make uninstall.
cd orocos_kdl mkdir build && cd build cmake .. -DCMAKE_INSTALL_PREFIX=/usr/local -DENABLE_TESTS:BOOL=ON -DCMAKE_BUILD_TYPE=Release make sudo make installInstall via ROS/catkin
masterIf you are using ROS/catkin, it is preferred to use the catkin installation method rather than the standardcmake/makemethod.Compile python_orocos_kdl with catkin
masterIf you are working within a ROS workspace, follow these steps to build the Python bindings and the underlying C++ library using
catkin:- Clone the repository into your workspace.
- Initialize the
pybind11submodule. - Build using your preferred catkin tool (e.g.,
catkin_makeorcatkin build). - Source your workspace.
Note: To generate API documentation, you can use
rosdoc_liteorcatkin_tools_document.git submodule update --init # Use your preferred catkin build tool catkin_make source devel/setup.bashInstall Python dependencies for python_orocos_kdl
masterBefore compiling the Python bindings, ensure the required Python modules are installed on your Debian/Ubuntu system:
- Install
psutilandfuture(Mandatory). - Install
Sphinx(Optional, used for generating API documentation).
# Mandatory dependencies sudo apt-get install python3-psutil python3-future # Optional: for API documentation sudo apt-get install python3-sphinx- Install
Build Orocos KDL with catkin
masterIf you are working within a ROS environment, you can build Orocos KDL using
catkin:- Clone the repository into your catkin workspace.
- Build using your preferred catkin tool (e.g.,
catkin_makeorcatkin build). - Source the workspace.
To generate API documentation in a catkin environment, you can use
rosdoc_liteorcatkin_tools_document.Install the C++ library (orocos_kdl)
masterThe C++ implementation of the library is located in theorocos_kdldirectory. For detailed installation steps, refer to theorocos_kdl/INSTALL.mdfile.Compile python_orocos_kdl without catkin
masterTo build the Python bindings manually outside of a ROS workspace:
- Clone the repository.
- Initialize the
pybind11submodule. - Mandatory: Ensure the C++ library (
orocos_kdl) is compiled following the instructions inorocos_kdl/INSTALL.md. - Create and enter a
builddirectory. - Run
cmake ... You can optionally setCMAKE_INSTALL_PREFIXorCMAKE_BUILD_TYPE. - Run
maketo compile. - Run
sudo make installto install the bindings. - Update the shared library cache with
sudo ldconfig. - Ensure
/usr/local/libis in yourLD_LIBRARY_PATH.
Verification & Documentation:
- Run tests:
python3 ../tests/PyKDLtest.py - Generate docs:
sphinx-build ../doc docs
git submodule update --init # (Ensure C++ library is already compiled) mkdir build && cd build cmake .. make sudo make install sudo ldconfig # Set LD_LIBRARY_PATH if necessary export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib # Optional: Run tests python3 ../tests/PyKDLtest.py